Documentation ¶
Index ¶
- func NewOption(name, desc string) selector
- func ParseFloat(a any) (float32, bool)
- func ParseInt(a any) (int, bool)
- func ParseString(a any) (string, bool)
- type AttachmentBuilder
- type BooleanBuilder
- type ChannelBuilder
- type Choice
- type Command
- type CommandBuilder
- type CommandPermission
- type CommandPermissionType
- type CommandType
- type DoubleBuilder
- type EditCommandBuilder
- type GlobalQuery
- type GuildQuery
- type MentionableBuilder
- type NumberBuilder
- type Option
- type OptionBuilder
- type OptionSelector
- type OptionType
- type PermissionList
- type Query
- type RoleBuilder
- type StringBuilder
- type SubCommandBuilder
- type SubCommandGroupBuilder
- type UserBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseFloat ¶
func ParseString ¶
Types ¶
type AttachmentBuilder ¶
type AttachmentBuilder baseOptionBuilder[AttachmentBuilder]
type BooleanBuilder ¶
type BooleanBuilder baseOptionBuilder[BooleanBuilder]
type ChannelBuilder ¶
type ChannelBuilder interface { Types(allowed ...discord.ChannelType) ChannelBuilder // contains filtered or unexported methods }
type Command ¶
type Command struct { NameLocalizations map[string]string `json:"name_localizations,omitempty"` DescriptionLocalizations map[string]string `json:"description_localizations,omitempty"` Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` Options []Option `json:"options,omitempty"` GuildID snowflake.ID `json:"guild_id,omitempty"` ID snowflake.ID `json:"id,omitempty"` ApplicationID snowflake.ID `json:"application_id,omitempty"` DefaultMemberPermissions permissions.Permission `json:"default_member_permissions,omitempty"` Version snowflake.ID `json:"version,omitempty"` Type CommandType `json:"type,omitempty"` DM bool `json:"dm_permission,omitempty"` DefaultPermission bool `json:"default_permission,omitempty"` }
Ref: https://discord.com/developers/docs/interactions/application-commands#application-command-object
type CommandBuilder ¶
type CommandBuilder baseCommandBuilder[CommandBuilder]
type CommandPermission ¶
type CommandPermission struct { ID snowflake.ID `json:"id"` Type CommandPermissionType `json:"type"` GuildID snowflake.ID `json:"guild_id"` Permission bool `json:"permission"` }
CommandPermission https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure
type CommandPermissionType ¶
type CommandPermissionType int
CommandPermissionType https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
const ( PermissionTypeRole CommandPermissionType = iota + 1 PermissionTypeUser )
type CommandType ¶
type CommandType uint8
const ( CommandTypeChatInput CommandType = iota + 1 CommandTypeUser CommandTypeMessage )
type DoubleBuilder ¶
type DoubleBuilder[A any] interface { MaxValue(val A) DoubleBuilder[A] MinValue(val A) DoubleBuilder[A] AutoComplete() DoubleBuilder[A] Choices(list []Choice) DoubleBuilder[A] // contains filtered or unexported methods }
type EditCommandBuilder ¶
type EditCommandBuilder interface { Name(str string) EditCommandBuilder Description(str string) EditCommandBuilder // contains filtered or unexported methods }
type GlobalQuery ¶
type GlobalQuery interface { List() ([]Command, error) Create(name, desc string) CommandBuilder Get(id snowflake.ID) (Command, error) Edit(id snowflake.ID) EditCommandBuilder Delete(id snowflake.ID) error }
type GuildQuery ¶
type GuildQuery interface { Get(id snowflake.ID) (Command, error) Create(name, desc string) CommandBuilder Edit(id snowflake.ID) EditCommandBuilder Delete(id snowflake.ID) error Permissions() (PermissionList, error) CommandPermissions(id snowflake.ID) (PermissionList, error) EditPermissions(id snowflake.ID, perms PermissionList) error }
type MentionableBuilder ¶
type MentionableBuilder baseOptionBuilder[MentionableBuilder]
type NumberBuilder ¶
type NumberBuilder[A any] interface { MaxValue(val A) NumberBuilder[A] MinValue(val A) NumberBuilder[A] AutoComplete() NumberBuilder[A] Choices(list []Choice) NumberBuilder[A] // contains filtered or unexported methods }
type Option ¶
type Option struct { MaxValue any `json:"max_value,omitempty"` MinValue any `json:"min_value,omitempty"` DescriptionLocalizations map[string]string `json:"description_localizations,omitempty"` NameLocalizations map[string]string `json:"name_localizations,omitempty"` Description string `json:"description"` Name string `json:"name"` Choices []Choice `json:"choices,omitempty"` Options []Option `json:"options,omitempty"` ChannelTypes []discord.ChannelType `json:"channel_types,omitempty"` MinLength uint16 `json:"min_length,omitempty"` MaxLength uint16 `json:"max_length,omitempty"` Required bool `json:"required"` Type OptionType `json:"type"` Autocomplete bool `json:"autocomplete,omitempty"` }
type OptionBuilder ¶
type OptionBuilder interface {
Build() Option
}
type OptionSelector ¶
type OptionSelector interface { String() StringBuilder[string] Number() NumberBuilder[int] Double() DoubleBuilder[float64] Channel() ChannelBuilder Boolean() BooleanBuilder User() UserBuilder Role() RoleBuilder Mentionable() MentionableBuilder Attachment() AttachmentBuilder SubCommand() SubCommandBuilder SubCommandGroup() SubCommandGroupBuilder }
type OptionType ¶
type OptionType uint8
const ( OptionTypeSubCommand OptionType = iota + 1 OptionTypeSubCommandGroup OptionTypeString OptionTypeInteger OptionTypeBoolean OptionTypeUser OptionTypeChannel OptionTypeRole OptionTypeMentionable OptionTypeDouble OptionTypeAttachment )
type PermissionList ¶
type PermissionList []CommandPermission
func (*PermissionList) Allow ¶
func (x *PermissionList) Allow(t CommandPermissionType, id snowflake.ID)
func (*PermissionList) Disallow ¶
func (x *PermissionList) Disallow(t CommandPermissionType, id snowflake.ID)
func (PermissionList) Get ¶
func (x PermissionList) Get(id snowflake.ID) *CommandPermission
func (*PermissionList) Remove ¶
func (x *PermissionList) Remove(id snowflake.ID) bool
type Query ¶
type Query interface { Global() GlobalQuery Guild(id snowflake.ID) GuildQuery }
func NewClientWithAppID ¶
type RoleBuilder ¶
type RoleBuilder baseOptionBuilder[RoleBuilder]
type StringBuilder ¶
type StringBuilder[A any] interface { MinLength(len uint16) StringBuilder[A] MaxLength(len uint16) StringBuilder[A] AutoComplete() StringBuilder[A] Choices(list []Choice) StringBuilder[A] // contains filtered or unexported methods }
type SubCommandBuilder ¶
type SubCommandBuilder interface { Option(bl OptionBuilder) SubCommandBuilder Build() Option // contains filtered or unexported methods }
type SubCommandGroupBuilder ¶
type SubCommandGroupBuilder interface { Option(bl OptionBuilder) SubCommandGroupBuilder Build() Option // contains filtered or unexported methods }
type UserBuilder ¶
type UserBuilder baseOptionBuilder[UserBuilder]
Click to show internal directories.
Click to hide internal directories.