Documentation ¶
Index ¶
- Constants
- Variables
- type AutocompleteHandler
- type Button
- type ButtonHandler
- type ButtonStyle
- type Choice
- type Component
- type ComponentEmoji
- type ContextMenuCommand
- type ContextMenuHandler
- type ContextMenuKind
- type Ctx
- type EmbedBuilder
- func (e EmbedBuilder) AddField(name, value string, inline bool) EmbedBuilder
- func (e EmbedBuilder) Author(url, name, iconURL string) EmbedBuilder
- func (e EmbedBuilder) Color(color int) EmbedBuilder
- func (e EmbedBuilder) Description(description string) EmbedBuilder
- func (e EmbedBuilder) Footer(text, iconURL string) EmbedBuilder
- func (e EmbedBuilder) Image(url string) EmbedBuilder
- func (e EmbedBuilder) Thumbnail(url string) EmbedBuilder
- func (e EmbedBuilder) Timestamp(timestamp string) EmbedBuilder
- func (e EmbedBuilder) Title(title string) EmbedBuilder
- func (e EmbedBuilder) URL(url string) EmbedBuilder
- type InteractionCtx
- func (i *InteractionCtx) Acknowledge() error
- func (i *InteractionCtx) Author() *discordgo.Member
- func (i *InteractionCtx) Channel() string
- func (i *InteractionCtx) Dg() *discordgo.Session
- func (i *InteractionCtx) Guild() string
- func (i *InteractionCtx) Modal(m Modal) error
- func (i *InteractionCtx) Respond(msg MessageSend) error
- type MessageCtx
- func (m *MessageCtx) Acknowledge() error
- func (m *MessageCtx) Author() *discordgo.Member
- func (m *MessageCtx) Channel() string
- func (m *MessageCtx) Dg() *discordgo.Session
- func (m *MessageCtx) Guild() string
- func (m *MessageCtx) Message() *discordgo.Message
- func (m *MessageCtx) Respond(msg MessageSend) error
- type MessageHandler
- type MessageSend
- type MiddlewareFunc
- type Modal
- type ModalHandler
- type ModalInput
- type ModalInputStyle
- type Option
- type OptionKind
- type Select
- type SelectHandler
- type SelectOption
- type Sevcord
- func (s *Sevcord) AddButtonHandler(id string, handler ButtonHandler)
- func (s *Sevcord) AddMiddleware(m MiddlewareFunc)
- func (s *Sevcord) AddSelectHandler(id string, handler SelectHandler)
- func (s *Sevcord) Dg() *discordgo.Session
- func (s *Sevcord) Listen()
- func (s *Sevcord) RegisterSlashCommand(cmd SlashCommandObject)
- func (s *Sevcord) SetMessageHandler(handler MessageHandler)
- type SlashCommand
- type SlashCommandAttachment
- type SlashCommandGroup
- type SlashCommandHandler
- type SlashCommandObject
Constants ¶
View Source
const ( ContextMenuKindMessage = ContextMenuKind(discordgo.MessageApplicationCommand) // The string passed is message ID ContextMenuKindUser = ContextMenuKind(discordgo.UserApplicationCommand) // The string passed is User ID )
Variables ¶
View Source
var Logger = log.Default()
Functions ¶
This section is empty.
Types ¶
type AutocompleteHandler ¶
type Button ¶
type Button struct { Label string Style ButtonStyle // Handler Handler string // ID of handler Params string // Params to pass to handler // Optional Emoji *ComponentEmoji URL string // Only link button can have this Disabled bool }
func NewButton ¶
func NewButton(label string, style ButtonStyle, handler string, params string) *Button
func (*Button) SetDisabled ¶
func (*Button) WithEmoji ¶
func (b *Button) WithEmoji(emoji ComponentEmoji) *Button
type ButtonHandler ¶
type ButtonStyle ¶
type ButtonStyle int
const ( ButtonStylePrimary ButtonStyle = 1 ButtonStyleSecondary ButtonStyle = 2 ButtonStyleSuccess ButtonStyle = 3 ButtonStyleDanger ButtonStyle = 4 ButtonStyleLink ButtonStyle = 5 )
type ComponentEmoji ¶
type ComponentEmoji struct {
// contains filtered or unexported fields
}
func ComponentEmojiCustom ¶
func ComponentEmojiCustom(name, id string, animated bool) ComponentEmoji
func ComponentEmojiDefault ¶
func ComponentEmojiDefault(emoji rune) ComponentEmoji
type ContextMenuCommand ¶
type ContextMenuCommand struct { Kind ContextMenuKind Name string Handler ContextMenuHandler }
type ContextMenuHandler ¶
type ContextMenuKind ¶
type ContextMenuKind int
type Ctx ¶
type Ctx interface { Dg() *discordgo.Session // Allows access to underlying discordgo session // Talk to user Acknowledge() error // Indicates progress Respond(msg MessageSend) error // Displays message to user (note: in interactions, if not acknowledged this will be ephemeral) // Get info Author() *discordgo.Member Channel() string Guild() string }
type EmbedBuilder ¶
type EmbedBuilder struct {
// contains filtered or unexported fields
}
func (EmbedBuilder) AddField ¶
func (e EmbedBuilder) AddField(name, value string, inline bool) EmbedBuilder
func (EmbedBuilder) Author ¶
func (e EmbedBuilder) Author(url, name, iconURL string) EmbedBuilder
func (EmbedBuilder) Color ¶
func (e EmbedBuilder) Color(color int) EmbedBuilder
func (EmbedBuilder) Description ¶
func (e EmbedBuilder) Description(description string) EmbedBuilder
func (EmbedBuilder) Footer ¶
func (e EmbedBuilder) Footer(text, iconURL string) EmbedBuilder
func (EmbedBuilder) Image ¶
func (e EmbedBuilder) Image(url string) EmbedBuilder
func (EmbedBuilder) Thumbnail ¶
func (e EmbedBuilder) Thumbnail(url string) EmbedBuilder
func (EmbedBuilder) Timestamp ¶
func (e EmbedBuilder) Timestamp(timestamp string) EmbedBuilder
func (EmbedBuilder) Title ¶
func (e EmbedBuilder) Title(title string) EmbedBuilder
func (EmbedBuilder) URL ¶
func (e EmbedBuilder) URL(url string) EmbedBuilder
type InteractionCtx ¶
type InteractionCtx struct {
// contains filtered or unexported fields
}
InteractionCtx represents context for an interaction
func (*InteractionCtx) Acknowledge ¶
func (i *InteractionCtx) Acknowledge() error
func (*InteractionCtx) Author ¶
func (i *InteractionCtx) Author() *discordgo.Member
func (*InteractionCtx) Channel ¶ added in v2.1.1
func (i *InteractionCtx) Channel() string
func (*InteractionCtx) Dg ¶
func (i *InteractionCtx) Dg() *discordgo.Session
func (*InteractionCtx) Guild ¶ added in v2.1.1
func (i *InteractionCtx) Guild() string
func (*InteractionCtx) Modal ¶
func (i *InteractionCtx) Modal(m Modal) error
func (*InteractionCtx) Respond ¶
func (i *InteractionCtx) Respond(msg MessageSend) error
type MessageCtx ¶ added in v2.2.0
type MessageCtx struct {
// contains filtered or unexported fields
}
MessageCtx represents a message context
func (*MessageCtx) Acknowledge ¶ added in v2.2.0
func (m *MessageCtx) Acknowledge() error
func (*MessageCtx) Author ¶ added in v2.2.0
func (m *MessageCtx) Author() *discordgo.Member
func (*MessageCtx) Channel ¶ added in v2.2.0
func (m *MessageCtx) Channel() string
func (*MessageCtx) Dg ¶ added in v2.2.0
func (m *MessageCtx) Dg() *discordgo.Session
func (*MessageCtx) Guild ¶ added in v2.2.0
func (m *MessageCtx) Guild() string
func (*MessageCtx) Message ¶ added in v2.2.0
func (m *MessageCtx) Message() *discordgo.Message
func (*MessageCtx) Respond ¶ added in v2.2.0
func (m *MessageCtx) Respond(msg MessageSend) error
type MessageHandler ¶ added in v2.2.0
type MessageSend ¶
type MessageSend struct {
// contains filtered or unexported fields
}
func NewMessage ¶
func NewMessage(content string) MessageSend
func (MessageSend) AddComponentRow ¶
func (m MessageSend) AddComponentRow(components ...Component) MessageSend
func (MessageSend) AddEmbed ¶
func (m MessageSend) AddEmbed(embed EmbedBuilder) MessageSend
func (MessageSend) AddFile ¶
func (m MessageSend) AddFile(name, contentType string, reader io.Reader) MessageSend
func (MessageSend) Content ¶
func (m MessageSend) Content(content string) MessageSend
type MiddlewareFunc ¶ added in v2.1.1
MiddlewareFunc accepts context and returns whether or not to continue
type Modal ¶
type Modal struct { Title string Inputs []ModalInput Handler ModalHandler }
func NewModal ¶
func NewModal(title string, handler ModalHandler) Modal
func (Modal) Input ¶
func (m Modal) Input(inp ModalInput) Modal
type ModalInput ¶
type ModalInput struct { Label string Placeholder string Style ModalInputStyle Required bool MinLength int MaxLength int }
func NewModalInput ¶
func NewModalInput(label, placeholder string, style ModalInputStyle, maxLength int) ModalInput
func (ModalInput) SetLength ¶
func (m ModalInput) SetLength(min, max int) ModalInput
func (ModalInput) SetRequired ¶
func (m ModalInput) SetRequired(required bool) ModalInput
type ModalInputStyle ¶
type ModalInputStyle int
const ( ModalInputStyleSentence ModalInputStyle = 1 ModalInputStyleParagraph ModalInputStyle = 2 )
type Option ¶
type Option struct { Name string Description string Kind OptionKind Required bool Choices []Choice // Optional Autocomplete AutocompleteHandler // Optional }
func (Option) AddChoices ¶
func (Option) AutoComplete ¶
func (o Option) AutoComplete(a AutocompleteHandler) Option
type OptionKind ¶
type OptionKind int
const ( OptionKindString OptionKind = iota // string OptionKindInt // int OptionKindBool // bool OptionKindUser // *User OptionKindChannel // channel id (string) OptionKindRole // role id (string) OptionKindFloat // float64 OptionKindAttachment // *SlashCommandAttachment )
type Select ¶
type Select struct { Placeholder string Options []SelectOption // Handler Handler string // ID of handler Params string // Params to pass to handler // Optional MinValues int MaxValues int Disabled bool }
func (*Select) Option ¶
func (s *Select) Option(option SelectOption) *Select
func (*Select) SetDisabled ¶
type SelectHandler ¶
type SelectOption ¶
type SelectOption struct { Label string Description string ID string // Must be unique // Optional Emoji *ComponentEmoji Default bool // Whether it is automatically ticked }
func NewSelectOption ¶
func NewSelectOption(label, description, id string) SelectOption
func (SelectOption) SetDefault ¶
func (s SelectOption) SetDefault(defaulted bool) SelectOption
func (SelectOption) WithEmoji ¶
func (s SelectOption) WithEmoji(emoji ComponentEmoji) SelectOption
type Sevcord ¶
type Sevcord struct {
// contains filtered or unexported fields
}
func (*Sevcord) AddButtonHandler ¶
func (s *Sevcord) AddButtonHandler(id string, handler ButtonHandler)
func (*Sevcord) AddMiddleware ¶ added in v2.1.1
func (s *Sevcord) AddMiddleware(m MiddlewareFunc)
AddMiddleware adds middleware, a function that is run before every command handler is called. Middleware is run in the order it is added. Note that middleware is not run for message handlers
func (*Sevcord) AddSelectHandler ¶
func (s *Sevcord) AddSelectHandler(id string, handler SelectHandler)
func (*Sevcord) Dg ¶
Dg gets the global discordgo session. NOTE: Only use this to add handlers/intents, use the one provided with Ctx for anything else
func (*Sevcord) RegisterSlashCommand ¶
func (s *Sevcord) RegisterSlashCommand(cmd SlashCommandObject)
func (*Sevcord) SetMessageHandler ¶ added in v2.2.0
func (s *Sevcord) SetMessageHandler(handler MessageHandler)
type SlashCommand ¶
type SlashCommand struct { Name string Description string Options []Option Permissions *int Handler SlashCommandHandler }
func NewSlashCommand ¶
func NewSlashCommand(name, description string, handler SlashCommandHandler, options ...Option) *SlashCommand
func (*SlashCommand) RequirePermissions ¶
func (s *SlashCommand) RequirePermissions(p int)
RequirePermissions accepts a discordgo permissions bit mask
type SlashCommandAttachment ¶
type SlashCommandGroup ¶
type SlashCommandGroup struct { Name string Description string Children []SlashCommandObject Permissions *int }
NOTE: Can only have 2 levels of subcommands
func NewSlashCommandGroup ¶
func NewSlashCommandGroup(name string, description string, children ...SlashCommandObject) *SlashCommandGroup
func (*SlashCommandGroup) RequirePermissions ¶
func (s *SlashCommandGroup) RequirePermissions(p int)
RequirePermissions accepts a discordgo permissions bit mask
type SlashCommandHandler ¶
type SlashCommandObject ¶
type SlashCommandObject interface {
// contains filtered or unexported methods
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.