2024-11-21 21:24:46 -03:00
|
|
|
package bot
|
|
|
|
|
|
2024-11-22 10:37:40 -03:00
|
|
|
import (
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
|
)
|
2024-11-21 21:24:46 -03:00
|
|
|
|
|
|
|
|
type Command interface {
|
|
|
|
|
ApplicationCommand() *discordgo.ApplicationCommand
|
2024-11-22 19:00:58 -03:00
|
|
|
Validate() error
|
2024-11-21 21:24:46 -03:00
|
|
|
}
|
|
|
|
|
|
2024-11-22 10:37:40 -03:00
|
|
|
type Handler[CTX any] interface {
|
|
|
|
|
Handle(ctx CTX) error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type HandlerFunc[CTX any] func(ctx CTX) error
|
|
|
|
|
|
|
|
|
|
func (h HandlerFunc[CTX]) Handle(ctx CTX) error {
|
|
|
|
|
return h(ctx)
|
2024-11-21 21:24:46 -03:00
|
|
|
}
|
|
|
|
|
|
2024-11-22 19:06:32 -03:00
|
|
|
type Ctx struct {
|
2024-11-22 10:37:40 -03:00
|
|
|
discordgo.Interaction
|
|
|
|
|
}
|
2024-11-21 21:24:46 -03:00
|
|
|
|