Documentation
¶
Index ¶
- Constants
- Variables
- func AcceptAllInteractionFilter(i *discordgo.InteractionCreate) bool
- func CollectComponentInteractions(ctx context.Context, s *discordgo.Session, f InteractionFilter) <-chan *discordgo.InteractionCreate
- func CollectSingleComponentInteraction(ctx context.Context, s *discordgo.Session, f InteractionFilter) (*discordgo.InteractionCreate, error)
- func GetBoolOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *bool
- func GetBoolOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) bool
- func GetChannelOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) *discordgo.Channel
- func GetChannelOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) *discordgo.Channel
- func GetFloatOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *float64
- func GetFloatOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) float64
- func GetFocusedOption(options []*discordgo.ApplicationCommandInteractionDataOption) *discordgo.ApplicationCommandInteractionDataOption
- func GetIntOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *int64
- func GetIntOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) int64
- func GetInteractionFollowupDeadline(i *discordgo.Interaction) time.Time
- func GetInteractionResponseDeadline(i *discordgo.Interaction) time.Time
- func GetInteractionUser(i *discordgo.InteractionCreate) *discordgo.User
- func GetOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *discordgo.ApplicationCommandInteractionDataOption
- func GetRequiredBoolOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (bool, error)
- func GetRequiredChannelOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) (*discordgo.Channel, error)
- func GetRequiredFloatOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (float64, error)
- func GetRequiredIntOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (int64, error)
- func GetRequiredOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (*discordgo.ApplicationCommandInteractionDataOption, error)
- func GetRequiredRoleOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) (*discordgo.Role, error)
- func GetRequiredStringOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (string, error)
- func GetRequiredUintOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (uint64, error)
- func GetRequiredUserOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) (*discordgo.User, error)
- func GetRoleOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) *discordgo.Role
- func GetRoleOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) *discordgo.Role
- func GetStringOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *string
- func GetStringOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, ...) string
- func GetUintOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *uint64
- func GetUintOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) uint64
- func GetUserOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) *discordgo.User
- func GetUserOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, ...) *discordgo.User
- func IsSameInteractionUser(i1, i2 *discordgo.InteractionCreate) bool
- func NewIncNonce() (nonce string)
- func NewNonce() (nonce string, err error)
- func UnmarshalOptions(options []*discordgo.ApplicationCommandInteractionDataOption, v any) error
- type EmbedBuilder
- func (b *EmbedBuilder) AddField(name, value string, inline bool) *EmbedBuilder
- func (b *EmbedBuilder) ClearFields() *EmbedBuilder
- func (b *EmbedBuilder) SetAuthor(name, iconUrl, url string) *EmbedBuilder
- func (b *EmbedBuilder) SetColor(c color.Color) *EmbedBuilder
- func (b *EmbedBuilder) SetColorFromInt(c int) *EmbedBuilder
- func (b *EmbedBuilder) SetDescription(description string) *EmbedBuilder
- func (b *EmbedBuilder) SetFooter(text, iconUrl string) *EmbedBuilder
- func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetTimestamp(t time.Time) *EmbedBuilder
- func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder
- func (b *EmbedBuilder) SplitOnFields(maxFields int) []*EmbedBuilder
- type InteractionFilter
- func NewCustomIDFilter(customID string) InteractionFilter
- func NewInteractionUserFilter(interaction *discordgo.InteractionCreate) InteractionFilter
- func NewMessageFilter(messageID string) InteractionFilter
- func NewMultiFilter(filters ...InteractionFilter) InteractionFilter
- func NewUserFilter(userID string) InteractionFilter
- type MessageComponentCollector
- func (cc *MessageComponentCollector) Close()
- func (cc *MessageComponentCollector) Collect(ctx context.Context, messageID string, f InteractionFilter) (<-chan *discordgo.InteractionCreate, error)
- func (cc *MessageComponentCollector) CollectOnce(ctx context.Context, messageID string, f InteractionFilter) (i *discordgo.InteractionCreate, err error)
Constants ¶
View Source
const InteractionTokenLifetime = 15 * time.Minute
View Source
const ResponseDeadline = 3 * time.Second
Variables ¶
View Source
var ( ColorPrimary = color.RGBA{R: 0xF3, G: 0xB6, B: 0xAF, A: 0xFF} ColorSecondary = color.RGBA{R: 0xEC, G: 0xD1, B: 0xA0, A: 0xFF} ColorSuccess = color.RGBA{R: 0x36, G: 0x9E, B: 0x42, A: 0xFF} ColorWarning = color.RGBA{R: 0xED, G: 0xB6, B: 0x3E, A: 0xFF} ColorDanger = color.RGBA{R: 0xE0, G: 0x38, B: 0x38, A: 0xFF} ColorInfo = color.RGBA{R: 0x57, G: 0x8B, B: 0xF2, A: 0xFF} )
View Source
var ErrMessageHasHandler = errors.New("the selected message already has an associated message component interaction handler")
TODO: handle this case
View Source
var ErrOptionNotFound = errors.New("option not found")
Functions ¶
func AcceptAllInteractionFilter ¶
func AcceptAllInteractionFilter(i *discordgo.InteractionCreate) bool
func CollectComponentInteractions ¶
func CollectComponentInteractions(ctx context.Context, s *discordgo.Session, f InteractionFilter) <-chan *discordgo.InteractionCreate
func CollectSingleComponentInteraction ¶
func CollectSingleComponentInteraction(ctx context.Context, s *discordgo.Session, f InteractionFilter) (*discordgo.InteractionCreate, error)
func GetBoolOption ¶
func GetBoolOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *bool
func GetBoolOptionOrDefault ¶
func GetBoolOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, defaultValue bool) bool
func GetChannelOption ¶
func GetFloatOption ¶
func GetFloatOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *float64
func GetFloatOptionOrDefault ¶
func GetFloatOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, defaultValue float64) float64
func GetFocusedOption ¶
func GetFocusedOption(options []*discordgo.ApplicationCommandInteractionDataOption) *discordgo.ApplicationCommandInteractionDataOption
func GetIntOption ¶
func GetIntOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *int64
func GetIntOptionOrDefault ¶
func GetIntOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, defaultValue int64) int64
func GetInteractionFollowupDeadline ¶
func GetInteractionFollowupDeadline(i *discordgo.Interaction) time.Time
func GetInteractionResponseDeadline ¶
func GetInteractionResponseDeadline(i *discordgo.Interaction) time.Time
func GetInteractionUser ¶
func GetInteractionUser(i *discordgo.InteractionCreate) *discordgo.User
Because member is nil when not in a guild and I am going to cry if I get one more nil pointer error
func GetOption ¶
func GetOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *discordgo.ApplicationCommandInteractionDataOption
func GetRequiredBoolOption ¶
func GetRequiredBoolOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (bool, error)
func GetRequiredFloatOption ¶
func GetRequiredFloatOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (float64, error)
func GetRequiredIntOption ¶
func GetRequiredIntOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (int64, error)
func GetRequiredOption ¶
func GetRequiredOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (*discordgo.ApplicationCommandInteractionDataOption, error)
func GetRequiredRoleOption ¶
func GetRequiredStringOption ¶
func GetRequiredStringOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (string, error)
func GetRequiredUintOption ¶
func GetRequiredUintOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) (uint64, error)
func GetRequiredUserOption ¶
func GetRoleOption ¶
func GetRoleOptionOrDefault ¶
func GetStringOption ¶
func GetStringOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *string
func GetStringOptionOrDefault ¶
func GetStringOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key, defaultValue string) string
func GetUintOption ¶
func GetUintOption(options []*discordgo.ApplicationCommandInteractionDataOption, key string) *uint64
func GetUintOptionOrDefault ¶
func GetUintOptionOrDefault(options []*discordgo.ApplicationCommandInteractionDataOption, key string, defaultValue uint64) uint64
func GetUserOption ¶
func GetUserOptionOrDefault ¶
func IsSameInteractionUser ¶
func IsSameInteractionUser(i1, i2 *discordgo.InteractionCreate) bool
func NewIncNonce ¶
func NewIncNonce() (nonce string)
func UnmarshalOptions ¶
func UnmarshalOptions(options []*discordgo.ApplicationCommandInteractionDataOption, v any) error
Types ¶
type EmbedBuilder ¶
type EmbedBuilder struct {
*discordgo.MessageEmbed
}
func NewEmbedBuilder ¶
func NewEmbedBuilder() *EmbedBuilder
func (*EmbedBuilder) AddField ¶
func (b *EmbedBuilder) AddField(name, value string, inline bool) *EmbedBuilder
func (*EmbedBuilder) ClearFields ¶
func (b *EmbedBuilder) ClearFields() *EmbedBuilder
func (*EmbedBuilder) SetAuthor ¶
func (b *EmbedBuilder) SetAuthor(name, iconUrl, url string) *EmbedBuilder
func (*EmbedBuilder) SetColor ¶
func (b *EmbedBuilder) SetColor(c color.Color) *EmbedBuilder
func (*EmbedBuilder) SetColorFromInt ¶
func (b *EmbedBuilder) SetColorFromInt(c int) *EmbedBuilder
func (*EmbedBuilder) SetDescription ¶
func (b *EmbedBuilder) SetDescription(description string) *EmbedBuilder
func (*EmbedBuilder) SetFooter ¶
func (b *EmbedBuilder) SetFooter(text, iconUrl string) *EmbedBuilder
func (*EmbedBuilder) SetImage ¶
func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder
func (*EmbedBuilder) SetThumbnail ¶
func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder
func (*EmbedBuilder) SetTimestamp ¶
func (b *EmbedBuilder) SetTimestamp(t time.Time) *EmbedBuilder
func (*EmbedBuilder) SetTitle ¶
func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder
func (*EmbedBuilder) SplitOnFields ¶
func (b *EmbedBuilder) SplitOnFields(maxFields int) []*EmbedBuilder
SplitOnFields returns multiple embed builders with identical content as the current builder except the fields, which is split amongst the new builders. Note: splits into shallow copies.
type InteractionFilter ¶
type InteractionFilter func(i *discordgo.InteractionCreate) bool
func NewCustomIDFilter ¶
func NewCustomIDFilter(customID string) InteractionFilter
func NewInteractionUserFilter ¶
func NewInteractionUserFilter(interaction *discordgo.InteractionCreate) InteractionFilter
func NewMessageFilter ¶
func NewMessageFilter(messageID string) InteractionFilter
func NewMultiFilter ¶
func NewMultiFilter(filters ...InteractionFilter) InteractionFilter
func NewUserFilter ¶
func NewUserFilter(userID string) InteractionFilter
type MessageComponentCollector ¶
type MessageComponentCollector struct {
// contains filtered or unexported fields
}
func NewMessageComponentCollector ¶
func NewMessageComponentCollector(s *discordgo.Session) *MessageComponentCollector
func (*MessageComponentCollector) Close ¶
func (cc *MessageComponentCollector) Close()
func (*MessageComponentCollector) Collect ¶
func (cc *MessageComponentCollector) Collect( ctx context.Context, messageID string, f InteractionFilter, ) (<-chan *discordgo.InteractionCreate, error)
func (*MessageComponentCollector) CollectOnce ¶
func (cc *MessageComponentCollector) CollectOnce( ctx context.Context, messageID string, f InteractionFilter, ) (i *discordgo.InteractionCreate, err error)
Click to show internal directories.
Click to hide internal directories.