Versions in this module Expand all Collapse all v0 v0.1.0 Sep 17, 2026 Changes in this version + var ErrAlreadyResponded = errors.New("discordkit: interaction already acknowledged") + var ErrInvalidCommand = errors.New("discordkit: invalid command") + var ErrInvalidComponent = errors.New("discordkit: invalid component") + var ErrInvalidCustomID = errors.New("discordkit: invalid custom ID") + var ErrInvalidInteraction = errors.New("discordkit: operation is invalid for this interaction") + var ErrInvalidMessage = errors.New("discordkit: invalid message") + var ErrMissingOption = errors.New("discordkit: option missing or invalid") + var ErrNotResponded = errors.New("discordkit: interaction has not been acknowledged") + var ErrRouteConflict = errors.New("discordkit: route conflict") + var ErrRouteNotFound = errors.New("discordkit: route not found") + func AttachmentOption(name, description string) *simpleOptionBuilder + func BooleanOption(name, description string) *simpleOptionBuilder + func BuildCommands(builders ...*CommandBuilder) ([]*discordgo.ApplicationCommand, error) + func Components(nodes ...Component) []discordgo.MessageComponent + func MentionableOption(name, description string) *simpleOptionBuilder + func RoleOption(name, description string) *simpleOptionBuilder + func UserOption(name, description string) *simpleOptionBuilder + func ValidateMessageComponents(components []discordgo.MessageComponent) error + func ValidateModalComponents(components []discordgo.MessageComponent) error + type ButtonBuilder struct + func Button(label, customID string) *ButtonBuilder + func LinkButton(label, url string) *ButtonBuilder + func PremiumButton(skuID string) *ButtonBuilder + func (b *ButtonBuilder) Danger() *ButtonBuilder + func (b *ButtonBuilder) Disabled() *ButtonBuilder + func (b *ButtonBuilder) Emoji(e discordgo.ComponentEmoji) *ButtonBuilder + func (b *ButtonBuilder) Primary() *ButtonBuilder + func (b *ButtonBuilder) Secondary() *ButtonBuilder + func (b *ButtonBuilder) Success() *ButtonBuilder + type ChannelOptionBuilder struct + func ChannelOption(name, description string) *ChannelOptionBuilder + func (b *ChannelOptionBuilder) ChannelTypes(types ...discordgo.ChannelType) *ChannelOptionBuilder + func (b *ChannelOptionBuilder) NameLocalizations(m map[discordgo.Locale]string) *ChannelOptionBuilder + func (b *ChannelOptionBuilder) Required() *ChannelOptionBuilder + type ChannelSelectBuilder struct + func ChannelSelect(customID string) *ChannelSelectBuilder + func (b *ChannelSelectBuilder) ChannelTypes(types ...discordgo.ChannelType) *ChannelSelectBuilder + func (b *ChannelSelectBuilder) DefaultValues(values ...discordgo.SelectMenuDefaultValue) *ChannelSelectBuilder + func (b *ChannelSelectBuilder) Disabled() *ChannelSelectBuilder + func (b *ChannelSelectBuilder) MaxValues(n int) *ChannelSelectBuilder + func (b *ChannelSelectBuilder) MinValues(n int) *ChannelSelectBuilder + func (b *ChannelSelectBuilder) Placeholder(p string) *ChannelSelectBuilder + type ChoiceValue struct + func Choice(name string, value any) ChoiceValue + func (c ChoiceValue) Localized(localizations map[discordgo.Locale]string) ChoiceValue + type CommandBuilder struct + func Command(name, description string, options ...Option) *CommandBuilder + func MessageCommand(name string) *CommandBuilder + func UserCommand(name string) *CommandBuilder + func (b *CommandBuilder) Build() (*discordgo.ApplicationCommand, error) + func (b *CommandBuilder) Contexts(contexts ...discordgo.InteractionContextType) *CommandBuilder + func (b *CommandBuilder) DefaultMemberPermissions(perms int64) *CommandBuilder + func (b *CommandBuilder) DescriptionLocalizations(m map[discordgo.Locale]string) *CommandBuilder + func (b *CommandBuilder) IntegrationTypes(types ...discordgo.ApplicationIntegrationType) *CommandBuilder + func (b *CommandBuilder) MustBuild() *discordgo.ApplicationCommand + func (b *CommandBuilder) NSFW() *CommandBuilder + func (b *CommandBuilder) NameLocalizations(m map[discordgo.Locale]string) *CommandBuilder + func (b *CommandBuilder) Options(options ...Option) *CommandBuilder + type Component interface + func Raw(c discordgo.MessageComponent) Component + type ContainerBuilder struct + func Container(children ...Component) *ContainerBuilder + func (b *ContainerBuilder) AccentColor(color int) *ContainerBuilder + func (b *ContainerBuilder) Spoiler() *ContainerBuilder + type Context struct + Interaction *discordgo.InteractionCreate + Session *discordgo.Session + func NewContext(s *discordgo.Session, i *discordgo.InteractionCreate) *Context + func (c *Context) Attachment(name string) (*discordgo.MessageAttachment, bool) + func (c *Context) Autocomplete(choices ...ChoiceValue) error + func (c *Context) Bool(name string) (bool, bool) + func (c *Context) Channel(name string) (*discordgo.Channel, bool) + func (c *Context) ChannelID() string + func (c *Context) Context() context.Context + func (c *Context) Defer(ephemeral bool) error + func (c *Context) DeferUpdate() error + func (c *Context) DeleteResponse() error + func (c *Context) Edit(spec MessageSpec) (*discordgo.Message, error) + func (c *Context) Ephemeral(spec MessageSpec) error + func (c *Context) EphemeralText(content string) error + func (c *Context) Float(name string) (float64, bool) + func (c *Context) FocusedOption() (*discordgo.ApplicationCommandInteractionDataOption, bool) + func (c *Context) Followup(spec MessageSpec) (*discordgo.Message, error) + func (c *Context) FollowupEdit(messageID string, spec MessageSpec) (*discordgo.Message, error) + func (c *Context) Form() *FormData + func (c *Context) GuildID() string + func (c *Context) Int(name string) (int64, bool) + func (c *Context) IsDM() bool + func (c *Context) IsGuild() bool + func (c *Context) Locale() discordgo.Locale + func (c *Context) Member() *discordgo.Member + func (c *Context) MemberOption(name string) (*discordgo.Member, bool) + func (c *Context) Mentionable(name string) (Mentionable, bool) + func (c *Context) MustAttachment(name string) *discordgo.MessageAttachment + func (c *Context) MustBool(name string) bool + func (c *Context) MustChannel(name string) *discordgo.Channel + func (c *Context) MustFloat(name string) float64 + func (c *Context) MustInt(name string) int64 + func (c *Context) MustMemberOption(name string) *discordgo.Member + func (c *Context) MustMentionable(name string) Mentionable + func (c *Context) MustParam(name string) string + func (c *Context) MustRole(name string) *discordgo.Role + func (c *Context) MustString(name string) string + func (c *Context) MustUserOption(name string) *discordgo.User + func (c *Context) Option(name string) (*discordgo.ApplicationCommandInteractionDataOption, bool) + func (c *Context) Param(name string) (string, bool) + func (c *Context) Reply(spec MessageSpec) error + func (c *Context) ReplyText(content string) error + func (c *Context) RequireAttachment(name string) (*discordgo.MessageAttachment, error) + func (c *Context) RequireBool(name string) (bool, error) + func (c *Context) RequireChannel(name string) (*discordgo.Channel, error) + func (c *Context) RequireFloat(name string) (float64, error) + func (c *Context) RequireInt(name string) (int64, error) + func (c *Context) RequireMemberOption(name string) (*discordgo.Member, error) + func (c *Context) RequireMentionable(name string) (Mentionable, error) + func (c *Context) RequireParam(name string) (string, error) + func (c *Context) RequireRole(name string) (*discordgo.Role, error) + func (c *Context) RequireString(name string) (string, error) + func (c *Context) RequireUserOption(name string) (*discordgo.User, error) + func (c *Context) Role(name string) (*discordgo.Role, bool) + func (c *Context) SetContext(ctx context.Context) + func (c *Context) ShowModal(m Modal) error + func (c *Context) String(name string) (string, bool) + func (c *Context) Update(spec MessageSpec) error + func (c *Context) User() *discordgo.User + func (c *Context) UserOption(name string) (*discordgo.User, bool) + type CustomID string + func (id CustomID) Validate() error + type EntitySelectBuilder struct + func MentionableSelect(customID string) *EntitySelectBuilder + func RoleSelect(customID string) *EntitySelectBuilder + func UserSelect(customID string) *EntitySelectBuilder + func (b *EntitySelectBuilder) DefaultValues(values ...discordgo.SelectMenuDefaultValue) *EntitySelectBuilder + func (b *EntitySelectBuilder) Disabled() *EntitySelectBuilder + func (b *EntitySelectBuilder) MaxValues(n int) *EntitySelectBuilder + func (b *EntitySelectBuilder) MinValues(n int) *EntitySelectBuilder + func (b *EntitySelectBuilder) Placeholder(p string) *EntitySelectBuilder + type FieldBuilder struct + func Field(label string, input Component) *FieldBuilder + func (b *FieldBuilder) Description(d string) *FieldBuilder + type FileBuilder struct + func File(url string) *FileBuilder + func (b *FileBuilder) Spoiler() *FileBuilder + type FileUploadBuilder struct + func FileUpload(customID string) *FileUploadBuilder + func (b *FileUploadBuilder) FileTypes(types ...string) *FileUploadBuilder + func (b *FileUploadBuilder) MaxValues(n int) *FileUploadBuilder + func (b *FileUploadBuilder) MinValues(n int) *FileUploadBuilder + func (b *FileUploadBuilder) Required(required bool) *FileUploadBuilder + type FormData struct + func (f *FormData) Files(customID string) ([]*discordgo.MessageAttachment, bool) + func (f *FormData) MustString(customID string) string + func (f *FormData) RequireFiles(customID string) ([]*discordgo.MessageAttachment, error) + func (f *FormData) RequireString(customID string) (string, error) + func (f *FormData) RequireStrings(customID string) ([]string, error) + func (f *FormData) String(customID string) (string, bool) + func (f *FormData) Strings(customID string) ([]string, bool) + type GalleryBuilder struct + func Gallery(items ...GalleryItem) *GalleryBuilder + type GalleryItem struct + func MediaItem(url string) GalleryItem + func (g GalleryItem) Description(d string) GalleryItem + func (g GalleryItem) Spoiler() GalleryItem + type Group struct + func (g *Group) Autocomplete(p, o string, h Handler, m ...Middleware) error + func (g *Group) Command(p string, h Handler, m ...Middleware) error + func (g *Group) Component(p string, h Handler, m ...Middleware) error + func (g *Group) Modal(p string, h Handler, m ...Middleware) error + type Handler func(*Context) error + type IntegerOptionBuilder struct + func IntegerOption(name, description string) *IntegerOptionBuilder + func (b *IntegerOptionBuilder) Autocomplete() *IntegerOptionBuilder + func (b *IntegerOptionBuilder) Choices(choices ...ChoiceValue) *IntegerOptionBuilder + func (b *IntegerOptionBuilder) Max(n int64) *IntegerOptionBuilder + func (b *IntegerOptionBuilder) Min(n int64) *IntegerOptionBuilder + func (b *IntegerOptionBuilder) NameLocalizations(m map[discordgo.Locale]string) *IntegerOptionBuilder + func (b *IntegerOptionBuilder) Required() *IntegerOptionBuilder + type Mentionable struct + Role *discordgo.Role + User *discordgo.User + func (m Mentionable) Valid() bool + type MessageSpec struct + AllowedMentions *discordgo.MessageAllowedMentions + Attachments []*discordgo.MessageAttachment + Components []discordgo.MessageComponent + Content string + Embeds []*discordgo.MessageEmbed + Ephemeral bool + Files []*discordgo.File + Poll *discordgo.Poll + func (m MessageSpec) InteractionResponseData() (*discordgo.InteractionResponseData, error) + func (m MessageSpec) MessageEdit(channelID, messageID string) (*discordgo.MessageEdit, error) + func (m MessageSpec) WebhookEdit() (*discordgo.WebhookEdit, error) + func (m MessageSpec) WebhookParams() (*discordgo.WebhookParams, error) + type Middleware func(Handler) Handler + func Logging(logger *slog.Logger) Middleware + func Recovery() Middleware + func RequireGuild() Middleware + func RequirePermissions(permissions int64) Middleware + type Modal struct + func ModalOf(customID, title string, components ...discordgo.MessageComponent) Modal + type ModalBuilder struct + func Form(customID, title string, fields ...Component) *ModalBuilder + func (b *ModalBuilder) Build() (Modal, error) + func (b *ModalBuilder) Fields(fields ...Component) *ModalBuilder + func (b *ModalBuilder) MustBuild() Modal + type NumberOptionBuilder struct + func NumberOption(name, description string) *NumberOptionBuilder + func (b *NumberOptionBuilder) Autocomplete() *NumberOptionBuilder + func (b *NumberOptionBuilder) Choices(choices ...ChoiceValue) *NumberOptionBuilder + func (b *NumberOptionBuilder) Max(n float64) *NumberOptionBuilder + func (b *NumberOptionBuilder) Min(n float64) *NumberOptionBuilder + func (b *NumberOptionBuilder) NameLocalizations(m map[discordgo.Locale]string) *NumberOptionBuilder + func (b *NumberOptionBuilder) Required() *NumberOptionBuilder + type Option interface + type PanicError struct + Stack []byte + Value any + func (e *PanicError) Error() string + func (e *PanicError) Unwrap() error + type RouteBuilder struct + func Route(pattern string) *RouteBuilder + func (b *RouteBuilder) Build() (CustomID, error) + func (b *RouteBuilder) MustBuild() CustomID + func (b *RouteBuilder) Param(name, value string) *RouteBuilder + type Router struct + func NewRouter(middleware ...Middleware) *Router + func (r *Router) Autocomplete(path, option string, h Handler, m ...Middleware) error + func (r *Router) Command(path string, h Handler, m ...Middleware) error + func (r *Router) Component(path string, h Handler, m ...Middleware) error + func (r *Router) Dispatch(c *Context) error + func (r *Router) Group(prefix string, m ...Middleware) *Group + func (r *Router) Handle(s *discordgo.Session, i *discordgo.InteractionCreate) + func (r *Router) Modal(path string, h Handler, m ...Middleware) error + func (r *Router) OnError(h func(*Context, error)) + func (r *Router) Use(m ...Middleware) + type RowBuilder struct + func Row(children ...Component) *RowBuilder + type SectionBuilder struct + func Section(texts ...Component) *SectionBuilder + func (b *SectionBuilder) Accessory(a Component) *SectionBuilder + type SelectOptionBuilder struct + func SelectOption(label, value string) *SelectOptionBuilder + func (b *SelectOptionBuilder) Default() *SelectOptionBuilder + func (b *SelectOptionBuilder) Description(d string) *SelectOptionBuilder + func (b *SelectOptionBuilder) Emoji(e discordgo.ComponentEmoji) *SelectOptionBuilder + type SeparatorBuilder struct + func Separator() *SeparatorBuilder + func (b *SeparatorBuilder) Divider(on bool) *SeparatorBuilder + func (b *SeparatorBuilder) Large() *SeparatorBuilder + type StringOptionBuilder struct + func StringOption(name, description string) *StringOptionBuilder + func (b *StringOptionBuilder) Autocomplete() *StringOptionBuilder + func (b *StringOptionBuilder) Choices(choices ...ChoiceValue) *StringOptionBuilder + func (b *StringOptionBuilder) MaxLen(n int) *StringOptionBuilder + func (b *StringOptionBuilder) MinLen(n int) *StringOptionBuilder + func (b *StringOptionBuilder) NameLocalizations(m map[discordgo.Locale]string) *StringOptionBuilder + func (b *StringOptionBuilder) Required() *StringOptionBuilder + type StringSelectBuilder struct + func StringSelect(customID string) *StringSelectBuilder + func (b *StringSelectBuilder) Disabled() *StringSelectBuilder + func (b *StringSelectBuilder) MaxValues(n int) *StringSelectBuilder + func (b *StringSelectBuilder) MinValues(n int) *StringSelectBuilder + func (b *StringSelectBuilder) Options(options ...*SelectOptionBuilder) *StringSelectBuilder + func (b *StringSelectBuilder) Placeholder(p string) *StringSelectBuilder + func (b *StringSelectBuilder) Required() *StringSelectBuilder + type SubCommandBuilder struct + func SubCommand(name, description string, options ...Option) *SubCommandBuilder + func (b *SubCommandBuilder) NameLocalizations(m map[discordgo.Locale]string) *SubCommandBuilder + type SubCommandGroupBuilder struct + func SubCommandGroup(name, description string, subcommands ...*SubCommandBuilder) *SubCommandGroupBuilder + func (b *SubCommandGroupBuilder) NameLocalizations(m map[discordgo.Locale]string) *SubCommandGroupBuilder + type SyncOptions struct + Delete bool + GuildID string + type SyncPlan struct + Create []*discordgo.ApplicationCommand + Delete []*discordgo.ApplicationCommand + Unchanged []*discordgo.ApplicationCommand + Update []*discordgo.ApplicationCommand + func DiffCommands(remote, desired []*discordgo.ApplicationCommand, deleteObsolete bool) SyncPlan + func SyncCommands(s *discordgo.Session, appID string, desired []*discordgo.ApplicationCommand, ...) (SyncPlan, error) + func (p SyncPlan) Empty() bool + type TextDisplayBuilder struct + func Text(content string) *TextDisplayBuilder + type TextInputBuilder struct + func TextInput(customID string) *TextInputBuilder + func (b *TextInputBuilder) MaxLen(n int) *TextInputBuilder + func (b *TextInputBuilder) MinLen(n int) *TextInputBuilder + func (b *TextInputBuilder) Paragraph() *TextInputBuilder + func (b *TextInputBuilder) Placeholder(p string) *TextInputBuilder + func (b *TextInputBuilder) Required(required bool) *TextInputBuilder + func (b *TextInputBuilder) Value(v string) *TextInputBuilder + type ThumbnailBuilder struct + func Thumbnail(url string) *ThumbnailBuilder + func (b *ThumbnailBuilder) Description(d string) *ThumbnailBuilder + func (b *ThumbnailBuilder) Spoiler() *ThumbnailBuilder