Add plugin support for commands

This commit is contained in:
2023-06-16 02:08:29 +00:00
parent 7b0c8351a8
commit b252d5e62e
6 changed files with 41 additions and 34 deletions

24
common/chat_commands.go Normal file
View File

@ -0,0 +1,24 @@
package common
import "github.com/bwmarrin/discordgo"
type CommandOptionType uint64
const (
CommandTypeString CommandOptionType = CommandOptionType(discordgo.ApplicationCommandOptionString)
CommandTypeInt CommandOptionType = CommandOptionType(discordgo.ApplicationCommandOptionInteger)
CommandTypeBool CommandOptionType = CommandOptionType(discordgo.ApplicationCommandOptionBoolean)
CommandTypeFloat CommandOptionType = CommandOptionType(discordgo.ApplicationCommandOptionNumber)
)
type ChatCommandConfiguration struct {
Description string
EphemeralResponse bool
Options map[string]ChatCommandOption
}
type ChatCommandOption struct {
Description string
Type CommandOptionType
Required bool
}

View File

@ -21,5 +21,8 @@ type ModuleManager interface {
CreateEvent(event Event) error
Notify(message string) error
// Commands
RegisterCommand(string, ChatCommandConfiguration, func(User, map[string]any) string)
RegisterChatSyncModule(ID string, plugin ChatSyncModule) error
}