Documentation ¶
Index ¶
- func Execute(bot *Minidis) error
- type ComponentContext
- type ComponentInteractionProps
- type CustomHandlers
- type EditProps
- type FollowupContext
- type FollowupProps
- type MessageCommandContext
- type MessageCommandProps
- type Minidis
- func (m *Minidis) AddCommand(cmd *SlashCommandProps) *SlashCommandProps
- func (m *Minidis) AddComponentHandler(cpi *ComponentInteractionProps)
- func (m *Minidis) AddCustomComponentHandler(handler func(s *SlashContext, c *ComponentContext) error)
- func (m *Minidis) AddCustomModalSubmitHandler(handler func(s *SlashContext, c *ModalSubmitContext) error)
- func (m *Minidis) AddMessageCommand(cmd *MessageCommandProps)
- func (m *Minidis) AddModalSubmitHandler(mi *ModalInteractionProps)
- func (m *Minidis) AddUserCommand(cmd *UserCommandProps)
- func (m *Minidis) ClearCommands() error
- func (m *Minidis) NewComponentContext(event *discordgo.Interaction) *ComponentContext
- func (m *Minidis) NewModalContext(data discordgo.ModalSubmitInteractionData) *ModalSubmitContext
- func (m *Minidis) NewSlashContext(session *discordgo.Session, inter *discordgo.Interaction, isSlash bool) *SlashContext
- func (m *Minidis) OnBeforeStart(v func(s *discordgo.Session))
- func (m *Minidis) OnClose(v func(s *discordgo.Session))
- func (m *Minidis) OnReady(v func(s *discordgo.Session, i *discordgo.Ready))
- func (m *Minidis) RegisterCommands(cmds ...*SlashCommandProps)
- func (m *Minidis) Run() error
- func (m *Minidis) SetIntents(intents discordgo.Intent)
- func (m *Minidis) SyncToGuilds(guildIDs ...string)
- type ModalInteractionProps
- type ModalSubmitContext
- type ReplyModalProps
- type ReplyProps
- type SlashCommandProps
- type SlashContext
- func (s *SlashContext) DeferReply(ephemeral bool) error
- func (s *SlashContext) Delete() error
- func (s *SlashContext) Edit(content string) error
- func (s *SlashContext) EditC(reply EditProps) error
- func (s *SlashContext) Followup(content string) (*FollowupContext, error)
- func (s *SlashContext) FollowupC(reply FollowupProps) (*FollowupContext, error)
- func (s *SlashContext) Reply(content string, embeds ...*discordgo.MessageEmbed) error
- func (s *SlashContext) ReplyC(reply ReplyProps) error
- func (s *SlashContext) ReplyEphemeral(content string, embeds ...*discordgo.MessageEmbed) error
- func (s *SlashContext) ReplyModal(reply ReplyModalProps) error
- func (s *SlashContext) ReplyString(content string) error
- type SlashSubcommandGroupProps
- type SlashSubcommandProps
- type UserCommandContext
- type UserCommandProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComponentContext ¶
type ComponentContext struct {
Data discordgo.MessageComponentInteractionData
}
type ComponentInteractionProps ¶
type ComponentInteractionProps struct { ID string Execute func(s *SlashContext, c *ComponentContext) error }
type CustomHandlers ¶
type CustomHandlers struct {
// contains filtered or unexported fields
}
type EditProps ¶
type EditProps struct { Content string Embeds []*discordgo.MessageEmbed Components []discordgo.MessageComponent Attachments []*discordgo.File AllowedMentions *discordgo.MessageAllowedMentions }
type FollowupContext ¶
type FollowupContext struct { Interaction *discordgo.Interaction Session *discordgo.Session AppID string // contains filtered or unexported fields }
func (*FollowupContext) Delete ¶
func (f *FollowupContext) Delete() error
Delete deletes the followup message.
func (*FollowupContext) Edit ¶
func (f *FollowupContext) Edit(content string) error
Edit edits the followup message.
func (*FollowupContext) EditC ¶
func (f *FollowupContext) EditC(reply EditProps) error
EditC is the full edit interaction component structure.
type FollowupProps ¶
type FollowupProps ReplyProps
type MessageCommandContext ¶
type MessageCommandContext struct { Interaction *discordgo.Interaction Session *discordgo.Session Message *discordgo.Message }
func (*MessageCommandContext) ReplyC ¶
func (m *MessageCommandContext) ReplyC(reply ReplyProps) error
type MessageCommandProps ¶
type MessageCommandProps struct { Name string Execute func(c *MessageCommandContext) error }
type Minidis ¶
func (*Minidis) AddCommand ¶
func (m *Minidis) AddCommand(cmd *SlashCommandProps) *SlashCommandProps
AddCommand adds a new slash command.
func (*Minidis) AddComponentHandler ¶
func (m *Minidis) AddComponentHandler(cpi *ComponentInteractionProps)
AddComponentHandler adds a function handler once the `id` is called.
func (*Minidis) AddCustomComponentHandler ¶
func (m *Minidis) AddCustomComponentHandler(handler func(s *SlashContext, c *ComponentContext) error)
AddCustomComponentHandler is a fallback handler for the AddComponentHandler. This is usefull if you have custom component ids that are changing or unique. This is called if the component's id has no handler set.
func (*Minidis) AddCustomModalSubmitHandler ¶
func (m *Minidis) AddCustomModalSubmitHandler(handler func(s *SlashContext, c *ModalSubmitContext) error)
AddCustomModalSubmitHandler is a fallback handler for AddModalSubmitHandler. This is useful if you have custom mod ids that are changing or unique. This is called if the component's id has no handler set.
func (*Minidis) AddMessageCommand ¶
func (m *Minidis) AddMessageCommand(cmd *MessageCommandProps)
AddMessageCommand adds a new message command.
func (*Minidis) AddModalSubmitHandler ¶
func (m *Minidis) AddModalSubmitHandler(mi *ModalInteractionProps)
AddModalSubmitHandler adds a new modal submit interaction handler for a specific custom id.
func (*Minidis) AddUserCommand ¶
func (m *Minidis) AddUserCommand(cmd *UserCommandProps)
AddUserCommand adds a new user command.
func (*Minidis) ClearCommands ¶
ClearCommands removes the application commands from the guild. If there are no guilds specified using `SyncToGuilds()`, global commands will be removed.
func (*Minidis) NewComponentContext ¶
func (m *Minidis) NewComponentContext(event *discordgo.Interaction) *ComponentContext
func (*Minidis) NewModalContext ¶
func (m *Minidis) NewModalContext(data discordgo.ModalSubmitInteractionData) *ModalSubmitContext
func (*Minidis) NewSlashContext ¶
func (m *Minidis) NewSlashContext(session *discordgo.Session, inter *discordgo.Interaction, isSlash bool) *SlashContext
Creates a new slash context for slash command interaction. This is called internally.
func (*Minidis) OnBeforeStart ¶
OnBeforeStart adds a custom function that will be called before syncing the application commands and running the bot.
func (*Minidis) RegisterCommands ¶
func (m *Minidis) RegisterCommands(cmds ...*SlashCommandProps)
RegisterCommands is used for adding multiple already defined commands. It does not return anything. It just wrap the `AddCommand` function.
func (*Minidis) SetIntents ¶
SetIntents sets the required or used intents by the bot.
func (*Minidis) SyncToGuilds ¶
Sync the commands to these guilds.
type ModalInteractionProps ¶
type ModalInteractionProps struct { ID string Execute func(s *SlashContext, c *ModalSubmitContext) error }
type ModalSubmitContext ¶
type ModalSubmitContext struct {
Data discordgo.ModalSubmitInteractionData
}
type ReplyModalProps ¶
type ReplyModalProps struct { Title string CustomID string Components []discordgo.MessageComponent }
type ReplyProps ¶
type ReplyProps struct { Content string Embeds []*discordgo.MessageEmbed Components []discordgo.MessageComponent IsEphemeral bool Attachments []*discordgo.File AllowedMentions *discordgo.MessageAllowedMentions }
type SlashCommandProps ¶
type SlashCommandProps struct { Name string // Name of the command Description string // Description of the command NameLocalizations *map[discordgo.Locale]string DescriptionLocalizations *map[discordgo.Locale]string DefaultMemberPermissions int64 DmPermission bool Options []*discordgo.ApplicationCommandOption Execute func(c *SlashContext) error // contains filtered or unexported fields }
func (*SlashCommandProps) AddSubcommand ¶
func (s *SlashCommandProps) AddSubcommand(cmd *SlashSubcommandProps)
AddSubcommand adds a new sub command for the parent command. Note: this will make your parent command not execute.
func (*SlashCommandProps) AddSubcommandGroup ¶
func (s *SlashCommandProps) AddSubcommandGroup(group *SlashSubcommandGroupProps) *SlashSubcommandGroupProps
AddSubcommand adds a new group for sub commands for the parent command. Note: this will make your parent command not execute.
type SlashContext ¶
type SlashContext struct { Interaction *discordgo.Interaction Session *discordgo.Session AppID string Author *discordgo.User Member *discordgo.Member // only filled when called in a guild IsDM bool Bot *discordgo.User // this is the bot user Id string GuildId string GuildLocale *discordgo.Locale Local discordgo.Locale ChannelId string // NOTE: this is empty if component is called Options map[string]*discordgo.ApplicationCommandInteractionDataOption }
func (*SlashContext) DeferReply ¶
func (s *SlashContext) DeferReply(ephemeral bool) error
DeferReply sends an interaction response where the user sees a loading state. After sending, 15 minutes is given to complete your command's tasks. This is considered as an interaction response, so you should not use the `Reply*` functions after. - `ephemeral` -> only the user sees the loading state
func (*SlashContext) Delete ¶
func (s *SlashContext) Delete() error
Delete deletes the interaction response.
func (*SlashContext) Edit ¶
func (s *SlashContext) Edit(content string) error
Edit edis the interaction response.
func (*SlashContext) EditC ¶
func (s *SlashContext) EditC(reply EditProps) error
EditC is the full edit interaction component structure.
func (*SlashContext) Followup ¶
func (s *SlashContext) Followup(content string) (*FollowupContext, error)
Followup creates a followup message to the interaction response.
func (*SlashContext) FollowupC ¶
func (s *SlashContext) FollowupC(reply FollowupProps) (*FollowupContext, error)
FollowupC is the full followup component structure.
func (*SlashContext) Reply ¶
func (s *SlashContext) Reply(content string, embeds ...*discordgo.MessageEmbed) error
Reply sends a string content with embeds if there is.
func (*SlashContext) ReplyC ¶
func (s *SlashContext) ReplyC(reply ReplyProps) error
ReplyC is the full reply component structure.
func (*SlashContext) ReplyEphemeral ¶
func (s *SlashContext) ReplyEphemeral(content string, embeds ...*discordgo.MessageEmbed) error
Reply sends a string content with embeds if there is. `Ephemeral` - the response message will only be seen by the user who called it.
func (*SlashContext) ReplyModal ¶
func (s *SlashContext) ReplyModal(reply ReplyModalProps) error
ReplyModal returns a modal component as InteractionResponse
func (*SlashContext) ReplyString ¶
func (s *SlashContext) ReplyString(content string) error
SendText sends a string text as interaction response.
type SlashSubcommandGroupProps ¶
type SlashSubcommandGroupProps struct { Name string Description string // contains filtered or unexported fields }
func (*SlashSubcommandGroupProps) AddSubcommand ¶
func (s *SlashSubcommandGroupProps) AddSubcommand(cmd *SlashSubcommandProps)
AddSubcommand adds a new sub command for the subcommmand group. Note: this will make your parent command not execute.
type SlashSubcommandProps ¶
type SlashSubcommandProps struct { Name string Description string Options []*discordgo.ApplicationCommandOption Execute func(c *SlashContext) error }
type UserCommandContext ¶
type UserCommandContext struct { Interaction *discordgo.Interaction Session *discordgo.Session Member *discordgo.Member User *discordgo.User }
func (*UserCommandContext) ReplyC ¶
func (m *UserCommandContext) ReplyC(reply ReplyProps) error
type UserCommandProps ¶
type UserCommandProps struct { Command string Execute func(c *UserCommandContext) error }