1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-07-13 00:35:36 +00:00

WIP design draft

This commit is contained in:
diamondburned 2021-10-10 11:43:20 -07:00
parent 918cce64e9
commit 14f53f15c5
No known key found for this signature in database
GPG key ID: D78C4471CE776659
3 changed files with 86 additions and 0 deletions

15
bot/bot.go Normal file
View file

@ -0,0 +1,15 @@
package bot
import (
"github.com/diamondburned/arikawa/v3/state"
)
type Parser interface {
Parse(string) error
}
type Autocompleter interface{}
type State struct {
*state.State
}

37
bot/bot_example_test.go Normal file
View file

@ -0,0 +1,37 @@
package bot_test
import (
"time"
"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/bot"
)
type duration time.Duration
func (d *duration) Parse(s string) error {
t, err := time.ParseDuration(s)
if err != nil {
return err
}
*d = duration(t)
return nil
}
type Main struct {
*bot.State
}
type pingArgs struct {
Delay duration
}
func (m *Main) Ping(args pingArgs) api.InteractionResponseData {
}
type echoArgs struct {
Message string
}
func (m *Main) Echo(args echoArgs) (string, error) {}

View file

@ -0,0 +1,34 @@
package component
import "github.com/diamondburned/arikawa/v3/discord"
// Component describes a bot component.
type Component interface {
ToComponent() discord.Component
}
// Row describes a row of components.
type Row []Component
// Select describes a select component, which shows the user a list of choices
// to select from.
type Select struct {
Options []Option
Placeholder string
NSelections [2]int // default [1, 1], format [min, max]
Disabled bool
}
// Option is a select option.
type Option struct {
Label string
Description string
Emoji discord.Emoji // ID, Name and Animated
Default bool
}
// Button is a clickable button.
type Button struct {
Style discord.ButtonStyle
Label string
}