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:
parent
918cce64e9
commit
14f53f15c5
15
bot/bot.go
Normal file
15
bot/bot.go
Normal 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
37
bot/bot_example_test.go
Normal 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) {}
|
34
bot/component/component.go
Normal file
34
bot/component/component.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue