Documentation ¶
Index ¶
- Variables
- func RequestOptions(ctx context.Context, reason ...string) discordgo.RequestOption
- type ApplicationCommandInteractionHandler
- type ApplicationCommandMetadata
- type Bot
- func (b *Bot) Close() error
- func (b *Bot) GetEmoji(name string) *discordgo.Emoji
- func (b *Bot) GetEmojiForMessage(name, fallback string) string
- func (b *Bot) GetEmojiForReaction(name, fallback string) string
- func (b *Bot) GetGuild(ctx context.Context, id string) (*discordgo.Guild, error)
- func (b *Bot) GetUserVoiceChannel(userID string) (guildID, channelID string)
- func (b *Bot) Health(ctx context.Context) (any, error)
- func (b *Bot) JoinUserVoiceChannel(userID string) (*discordgo.VoiceConnection, error)
- func (b *Bot) LeaveUserVoiceChannel(userID string) error
- func (b *Bot) Open(ctx context.Context, deadline time.Duration) error
- func (b *Bot) Ready(ctx context.Context) bool
- func (b *Bot) RegisterCommand(ctx context.Context, cmd any) error
- func (b *Bot) RegisterInteractions(ctx context.Context) error
- func (b *Bot) SendInteractionDeferral(ctx context.Context, interaction *discordgo.Interaction) error
- func (b *Bot) SendInteractionEdit(ctx context.Context, interaction *discordgo.Interaction, ...) error
- func (b *Bot) SendInteractionMessageReply(ctx context.Context, interaction *discordgo.Interaction, content string) error
- func (b *Bot) SendInteractionReply(ctx context.Context, interaction *discordgo.Interaction, ...) error
- func (b *Bot) SendMessageReaction(ctx context.Context, message *discordgo.Message, emoji, emojiFallback string) error
- func (b *Bot) SendMessageReply(ctx context.Context, message *discordgo.Message, content string) error
- type BotOptions
- type CommandMetadata
- type Guild
- type MessageComponentInteractionHandler
- type MessageEmbed
- func (e *MessageEmbed) AddField(name, value string, isInline ...bool) *MessageEmbed
- func (e *MessageEmbed) Embed() *discordgo.MessageEmbed
- func (e *MessageEmbed) SetTitle(title string) *MessageEmbed
- func (e *MessageEmbed) SetType(embedType discordgo.EmbedType) *MessageEmbed
- func (e *MessageEmbed) SetURL(url string) *MessageEmbed
- type MessageHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCommandNotImplemented = errors.New("command not implemented") ErrInvalidCommand = errors.New("input did not satisfy a command interface") ErrNotApplicationCommandInteractionHandler = errors.New("command does not implement the application command interaction handler interface") ErrNotMessageComponentInteractionHandler = errors.New("command does not implement the message component interaction handler interface") ErrNotMessageHandler = errors.New("command does not implement the message handler interface") )
Functions ¶
func RequestOptions ¶
func RequestOptions(ctx context.Context, reason ...string) discordgo.RequestOption
Types ¶
type ApplicationCommandInteractionHandler ¶
type ApplicationCommandInteractionHandler interface { CommandMetadata ApplicationCommandMetadata OnApplicationCommand(context.Context, *Bot, *discordgo.InteractionCreate, *discordgo.ApplicationCommandInteractionData) }
type ApplicationCommandMetadata ¶
type ApplicationCommandMetadata interface {
ApplicationCommand() *discordgo.ApplicationCommand
}
type Bot ¶
type Bot struct { BotOptions Session *discordgo.Session Commands map[string]any }
func NewBot ¶
func NewBot(opts BotOptions) (*Bot, error)
func (*Bot) GetEmojiForMessage ¶
func (*Bot) GetEmojiForReaction ¶
func (*Bot) GetUserVoiceChannel ¶
func (*Bot) JoinUserVoiceChannel ¶
func (b *Bot) JoinUserVoiceChannel(userID string) (*discordgo.VoiceConnection, error)
func (*Bot) LeaveUserVoiceChannel ¶
func (*Bot) SendInteractionDeferral ¶
func (*Bot) SendInteractionEdit ¶
func (b *Bot) SendInteractionEdit(ctx context.Context, interaction *discordgo.Interaction, edit *discordgo.WebhookEdit) error
func (*Bot) SendInteractionMessageReply ¶
func (*Bot) SendInteractionReply ¶
func (b *Bot) SendInteractionReply(ctx context.Context, interaction *discordgo.Interaction, response *discordgo.InteractionResponse) error
func (*Bot) SendMessageReaction ¶
type BotOptions ¶
type CommandMetadata ¶
type Guild ¶
func GuildFromContext ¶
type MessageComponentInteractionHandler ¶
type MessageComponentInteractionHandler interface { CommandMetadata ApplicationCommandMetadata OnMessageComponent(context.Context, *Bot, *discordgo.InteractionCreate, *discordgo.MessageComponentInteractionData) }
type MessageEmbed ¶
type MessageEmbed discordgo.MessageEmbed
func NewMessageEmbed ¶
func NewMessageEmbed() *MessageEmbed
func (*MessageEmbed) AddField ¶
func (e *MessageEmbed) AddField(name, value string, isInline ...bool) *MessageEmbed
func (*MessageEmbed) Embed ¶
func (e *MessageEmbed) Embed() *discordgo.MessageEmbed
func (*MessageEmbed) SetTitle ¶
func (e *MessageEmbed) SetTitle(title string) *MessageEmbed
func (*MessageEmbed) SetType ¶
func (e *MessageEmbed) SetType(embedType discordgo.EmbedType) *MessageEmbed
func (*MessageEmbed) SetURL ¶
func (e *MessageEmbed) SetURL(url string) *MessageEmbed
type MessageHandler ¶
type MessageHandler interface { CommandMetadata OnMessage(context.Context, *Bot, *discordgo.MessageCreate, []string) }
Click to show internal directories.
Click to hide internal directories.