Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteRole(c Ctx, id string, guild string) error
- type AutocompleteHandler
- type Button
- type ButtonHandler
- type ButtonStyle
- type Channel
- type ChannelType
- type Choice
- type Client
- type ClientParams
- type Color
- type Component
- type ComponentEmoji
- type ContextMenuCommand
- type ContextMenuHandler
- type ContextMenuKind
- type Ctx
- type EmbedBuilder
- func (e *EmbedBuilder) Author(name, url, iconurl string) *EmbedBuilder
- func (e *EmbedBuilder) Color(color int) *EmbedBuilder
- func (e *EmbedBuilder) Description(description string) *EmbedBuilder
- func (e *EmbedBuilder) Field(title string, description string, inline bool) *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
- type File
- type InteractionCtx
- type Message
- type MessageAttachment
- type MessageCtx
- type MessageFlags
- type MessageHandler
- type Modal
- type ModalHandler
- type ModalInput
- type ModalInputStyle
- type Option
- type OptionKind
- type Permissions
- type ReplyFrom
- type Response
- type Role
- type Select
- type SelectHandler
- type SelectOption
- type SlashCommand
- type SlashCommandAttachment
- type SlashCommandGroup
- type SlashCommandHandler
- type SlashCommandObject
- type User
- type UserFlag
Constants ¶
View Source
const ( ContextMenuKindMessage = ContextMenuKind(discordgo.MessageApplicationCommand) // The string passed is message ID ContextMenuKindUser = ContextMenuKind(discordgo.UserApplicationCommand) // The string passed is User ID )
View Source
const ( // Text channel permissions PermissionViewChannel = Permissions(discordgo.PermissionViewChannel) PermissionSendMessages = Permissions(discordgo.PermissionSendMessages) PermissionSendTTSMessages = Permissions(discordgo.PermissionSendTTSMessages) PermissionManageMessages = Permissions(discordgo.PermissionManageMessages) PermissionEmbedLinks = Permissions(discordgo.PermissionEmbedLinks) PermissionAttachFiles = Permissions(discordgo.PermissionAttachFiles) PermissionReadMessageHistory = Permissions(discordgo.PermissionReadMessageHistory) PermissionMentionEveryone = Permissions(discordgo.PermissionMentionEveryone) PermissionUseExternalEmojis = Permissions(discordgo.PermissionUseExternalEmojis) PermissionUseSlashCommands = Permissions(discordgo.PermissionUseSlashCommands) PermissionManageThreads = Permissions(discordgo.PermissionManageThreads) PermissionCreatePublicThreads = Permissions(discordgo.PermissionCreatePublicThreads) PermissionCreatePrivateThreads = Permissions(discordgo.PermissionCreatePrivateThreads) PermissionUseExternalStickers = Permissions(discordgo.PermissionUseExternalStickers) PermissionSendMessagesInThreads = Permissions(discordgo.PermissionSendMessagesInThreads) PermissionAddReactions = Permissions(discordgo.PermissionAddReactions) // Voice channel permissions PermissionVoiceConnect = Permissions(discordgo.PermissionVoiceConnect) PermissionVoiceSpeak = Permissions(discordgo.PermissionVoiceSpeak) PermissionVoiceMuteMembers = Permissions(discordgo.PermissionVoiceMuteMembers) PermissionVoiceDeafenMembers = Permissions(discordgo.PermissionVoiceDeafenMembers) PermissionVoiceMoveMembers = Permissions(discordgo.PermissionVoiceMoveMembers) PermissionVoiceUseVAD = Permissions(discordgo.PermissionVoiceUseVAD) PermissionVoicePrioritySpeaker = Permissions(discordgo.PermissionVoicePrioritySpeaker) PermissionVoiceStreamVideo = Permissions(discordgo.PermissionVoiceStreamVideo) PermissionUseActivities = Permissions(discordgo.PermissionUseActivities) // Management permissions PermissionChangeNickname = Permissions(discordgo.PermissionChangeNickname) PermissionManageNicknames = Permissions(discordgo.PermissionManageNicknames) PermissionManageRoles = Permissions(discordgo.PermissionManageRoles) PermissionManageWebhooks = Permissions(discordgo.PermissionManageWebhooks) PermissionManageEmojis = Permissions(discordgo.PermissionManageEmojis) PermissionManageEvents = Permissions(discordgo.PermissionManageEvents) PermissionCreateInstantInvite = Permissions(discordgo.PermissionCreateInstantInvite) PermissionKickMembers = Permissions(discordgo.PermissionKickMembers) PermissionBanMembers = Permissions(discordgo.PermissionBanMembers) PermissionAdministrator = Permissions(discordgo.PermissionAdministrator) PermissionManageChannels = Permissions(discordgo.PermissionManageChannels) PermissionManageServer = Permissions(discordgo.PermissionManageServer) PermissionViewAuditLogs = Permissions(discordgo.PermissionViewAuditLogs) PermissionViewGuildInsights = Permissions(discordgo.PermissionViewGuildInsights) PermissionModerateMembers = Permissions(discordgo.PermissionModerateMembers) )
View Source
const ( MessageFlagPublished = MessageFlags(discordgo.MessageFlagsCrossPosted) // Whether the message was published to another channel MessageFlagCrossPosted = MessageFlags(discordgo.MessageFlagsIsCrossPosted) // Whether the message was received from an announcement channel MessageFlagLoading = MessageFlags(discordgo.MessageFlagsLoading) // "The bot is thinking..." )
All possible message flags on a message event
Variables ¶
View Source
var Logger = log.Default()
Functions ¶
Types ¶
type AutocompleteHandler ¶
type Button ¶
type Button struct { Label string Style ButtonStyle Handler ButtonHandler // Optional Emoji *ComponentEmoji URL string // Only link button can have this Disabled bool }
type ButtonHandler ¶
type ButtonHandler func(ctx Ctx)
type ButtonStyle ¶
type ButtonStyle int
const ( ButtonStylePrimary ButtonStyle = 1 ButtonStyleSecondary ButtonStyle = 2 ButtonStyleSuccess ButtonStyle = 3 ButtonStyleDanger ButtonStyle = 4 ButtonStyleLink ButtonStyle = 5 )
type Channel ¶
type ChannelType ¶
type ChannelType int
Channels
const ( ChannelTypeGuildText ChannelType = 0 ChannelTypeDM ChannelType = 1 ChannelTypeGuildVoice ChannelType = 2 ChannelTypeGroupDM ChannelType = 3 ChannelTypeGuildCategory ChannelType = 4 ChannelTypeGuildNews ChannelType = 5 ChannelTypeGuildStore ChannelType = 6 ChannelTypeGuildNewsThread ChannelType = 10 ChannelTypeGuildPublicThread ChannelType = 11 ChannelTypeGuildPrivateThread ChannelType = 12 ChannelTypeGuildStageVoice ChannelType = 13 )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) HandleContextMenuCommand ¶
func (c *Client) HandleContextMenuCommand(cmd *ContextMenuCommand)
func (*Client) HandleMessage ¶
func (c *Client) HandleMessage(m MessageHandler)
HandleMessage updates the internal message handler. NOTE: This will replace the previous handler if there was one
func (*Client) HandleSlashCommand ¶
func (c *Client) HandleSlashCommand(cmd SlashCommandObject)
type ClientParams ¶
type Color ¶
type Color int
Color represents a discord color, and is the decimal representation of a hex color. For example: blue would be `Color(0x0000FF)`
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 EmbedBuilder ¶
type EmbedBuilder struct {
// contains filtered or unexported fields
}
func NewEmbedBuilder ¶
func NewEmbedBuilder(title string) *EmbedBuilder
func (*EmbedBuilder) Author ¶
func (e *EmbedBuilder) Author(name, url, 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) Field ¶
func (e *EmbedBuilder) Field(title string, description string, inline bool) *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
type InteractionCtx ¶
type InteractionCtx struct {
// contains filtered or unexported fields
}
func (*InteractionCtx) Acknowledge ¶
func (i *InteractionCtx) Acknowledge()
func (*InteractionCtx) Channel ¶
func (i *InteractionCtx) Channel() string
func (*InteractionCtx) Edit ¶
func (i *InteractionCtx) Edit(r *Response)
func (*InteractionCtx) Guild ¶
func (i *InteractionCtx) Guild() string
func (*InteractionCtx) Modal ¶
func (i *InteractionCtx) Modal(m *Modal)
func (*InteractionCtx) Respond ¶
func (i *InteractionCtx) Respond(r *Response)
func (*InteractionCtx) User ¶
func (i *InteractionCtx) User() *User
type Message ¶
type Message struct { ID string Channel string // The ID of the channel the message was sent in Guild string // THE ID of the guild the message was sent in EditedTime *time.Time // The time when the message was edited, nil if not edited Author *User Attachments []MessageAttachment Content string TTS bool ReplyFrom *ReplyFrom // What this message is replying to (if any) // Mentions Mentions []*User // Users mentioned (NOTE: This does not include their guild data) MentionRoles []string // Role IDs mentioned MentionEveryone bool // Mentions everyone }
TODO: Interaction info & embed info
type MessageAttachment ¶
type MessageCtx ¶
type MessageCtx struct {
// contains filtered or unexported fields
}
func (*MessageCtx) Acknowledge ¶
func (m *MessageCtx) Acknowledge()
func (*MessageCtx) Channel ¶
func (m *MessageCtx) Channel() string
func (*MessageCtx) Edit ¶
func (m *MessageCtx) Edit(r *Response)
func (*MessageCtx) Guild ¶
func (m *MessageCtx) Guild() string
func (*MessageCtx) Respond ¶
func (m *MessageCtx) Respond(r *Response)
func (*MessageCtx) User ¶
func (m *MessageCtx) User() *User
type MessageFlags ¶
type MessageFlags int
type MessageHandler ¶
type Modal ¶
type Modal struct { Title string Inputs []ModalInput Handler ModalHandler }
type ModalHandler ¶
type 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 }
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 Permissions ¶
type Permissions int64
Permissions
func CombinePermissions ¶
func CombinePermissions(perms ...Permissions) Permissions
func (Permissions) Add ¶
func (p Permissions) Add(perms ...Permissions) Permissions
func (Permissions) Has ¶
func (p Permissions) Has(perm Permissions) bool
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func EmbedResponse ¶
func EmbedResponse(e *EmbedBuilder) *Response
func MessageResponse ¶
func (*Response) ComponentRow ¶
type Role ¶
type Role struct { // Not used for creating role ID string Position int // Position in role hierarchy Managed bool // If its managed by an integration (if true cannot give/take role) // Required to create role Name string Mentionable bool Hoist bool // Shows up seperately in member list Color Color // Hex color of role Permissions Permissions }
func CreateRole ¶
CreateRole creates the role and returns the role created
func GetGuildRole ¶
GetGuildRole gets a role from a guild (NOTE: This will try to get the role from the cache if possible)
type Select ¶
type Select struct { Placeholder string Options []SelectOption Handler SelectHandler // Optional MinValues int MaxValues int Disabled bool }
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 }
type SlashCommand ¶
type SlashCommand struct { Name string Description string Options []Option Permissions *Permissions // Leave nil for everyone to use, only works for top-level commands Handler SlashCommandHandler }
type SlashCommandAttachment ¶
type SlashCommandGroup ¶
type SlashCommandGroup struct { Name string Description string Children []SlashCommandObject Permissions *Permissions // Leave nil for everyone to use, only works for top-level commands }
NOTE: Can only have 2 of these and then a command
type SlashCommandHandler ¶
type SlashCommandObject ¶
type SlashCommandObject interface {
// contains filtered or unexported methods
}
type User ¶
type User struct { ID string Username string Discriminator string // 4 numbers after name BannerColor int Bot bool System bool AvatarURL string BannerURL string // Guild user options Guild *string // Whether the following fields are filled out or not (if nil, then no, otherwise it is the Guild ID) JoinedAt time.Time Nickname string Deaf bool // Deafened on guild level Mute bool // Muted on guild level GuildAvatarURL string // Blank if no custom avatar Roles []string // IDs of roles Permissions Permissions // contains filtered or unexported fields }
type UserFlag ¶
type UserFlag int
Users
const ( UserFlagDiscordEmployee UserFlag = 1 << 0 UserFlagDiscordPartner UserFlag = 1 << 1 UserFlagHypeSquadEvents UserFlag = 1 << 2 UserFlagBugHunterLevel1 UserFlag = 1 << 3 UserFlagHouseBravery UserFlag = 1 << 6 UserFlagHouseBrilliance UserFlag = 1 << 7 UserFlagHouseBalance UserFlag = 1 << 8 UserFlagEarlySupporter UserFlag = 1 << 9 UserFlagTeamUser UserFlag = 1 << 10 UserFlagSystem UserFlag = 1 << 12 UserFlagBugHunterLevel2 UserFlag = 1 << 14 UserFlagVerifiedBot UserFlag = 1 << 16 UserFlagVerifiedBotDeveloper UserFlag = 1 << 17 UserFlagDiscordCertifiedModerator UserFlag = 1 << 18 )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.