Documentation ¶
Index ¶
- Constants
- type Feature
- type SCM
- func (scm *SCM) AddFeature(feature *Feature)
- func (scm *SCM) AddFeatures(features []*Feature)
- func (scm *SCM) CreateCommands(s *discordgo.Session, guildID string) error
- func (scm *SCM) DeleteCommands(s *discordgo.Session, guildID string) error
- func (scm *SCM) HandleInteractionCreate(s *discordgo.Session, i *discordgo.InteractionCreate)
Constants ¶
const ( InteractionTypeApplicationCommand = discordgo.InteractionApplicationCommand InteractionTypeMessageComponent = discordgo.InteractionMessageComponent InteractionTypeCommandAutocomplete = discordgo.InteractionApplicationCommandAutocomplete InteractionTypeModalSubmit = discordgo.InteractionModalSubmit )
Some constants for convenience
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Feature ¶
type Feature struct { Type discordgo.InteractionType Handler func(*discordgo.Session, *discordgo.InteractionCreate) // ApplicationCommand if Type is discordgo.InteractionApplicationCommand or discordgo.InteractionApplicationCommandAutocomplete // Not needed for Type discordgo.InteractionMessageComponent ApplicationCommand *discordgo.ApplicationCommand // CustomID if Type is discordgo.InteractionMessageComponent // can also be a regular expression CustomID string }
Feature essentially represents a command or a message component that you want to receive and respond to.
type SCM ¶
type SCM struct { Features []*Feature // contains filtered or unexported fields }
SCM represents the interaction manager, which handles responding to interactions as well as registering slash commands with the Discord API.
func (*SCM) AddFeature ¶
AddFeature adds a Feature to the SCM.
func (*SCM) AddFeatures ¶
AddFeatures adds multiple Features to the SCM.
func (*SCM) CreateCommands ¶
CreateCommands registers any commands (Features with Type discordgo.InteractionApplicationCommand or discordgo.InteractionApplicationCommandAutocomplete) with the API. Leave guildID as empty string for global commands. NOTE: Bot must already be started beforehand.
func (*SCM) DeleteCommands ¶
DeleteCommands deletes any commands registered using CreateCommands with the API.
func (*SCM) HandleInteractionCreate ¶
func (scm *SCM) HandleInteractionCreate(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleInteractionCreate receives incoming interactions and runs the respective Feature's Handler.