Documentation
¶
Index ¶
- Constants
- Variables
- func GetOS() string
- func Verify(disgo Disgo, r *http.Request, key ed25519.PublicKey) bool
- type ActionRow
- type Activity
- type ActivityAssets
- type ActivityEmoji
- type ActivityParty
- type ActivitySecrets
- type ActivityTimestamps
- type ActivityType
- type AddBan
- type AddMember
- type AllowedMentionType
- type AllowedMentions
- type Attachment
- type AudioController
- type AuditLog
- type AuditLogChangeKey
- type AuditLogEntry
- type AuditLogEvent
- type AuditLogFilterOptions
- type Ban
- type Button
- func NewButton(style ButtonStyle, label string, customID string, url string, emoji *Emoji, ...) Button
- func NewDangerButton(label string, customID string, emoji *Emoji) Button
- func NewLinkButton(label string, url string, emoji *Emoji, disabled bool) Button
- func NewPrimaryButton(label string, customID string, emoji *Emoji) Button
- func NewSecondaryButton(label string, customID string, emoji *Emoji) Button
- func NewSuccessButton(label string, customID string, emoji *Emoji) Button
- func (b Button) AsDisabled() Button
- func (b Button) AsEnabled() Button
- func (b Button) WithCustomID(customID string) Button
- func (b Button) WithDisabled(disabled bool) Button
- func (b Button) WithEmoji(emoji *Emoji) Button
- func (b Button) WithLabel(label string) Button
- func (b Button) WithStyle(style ButtonStyle) Button
- func (b Button) WithURL(url string) Button
- type ButtonInteraction
- type ButtonInteractionData
- type ButtonStyle
- type Cache
- type CacheFlags
- func (c CacheFlags) Add(bits ...CacheFlags) CacheFlags
- func (c CacheFlags) Has(bit CacheFlags) bool
- func (c CacheFlags) HasAll(bits ...CacheFlags) bool
- func (c CacheFlags) Missing(bit CacheFlags) bool
- func (c CacheFlags) MissingAny(bits ...CacheFlags) bool
- func (c CacheFlags) Remove(bits ...CacheFlags) CacheFlags
- type CacheStrategy
- type Category
- type Channel
- type ChannelType
- type Command
- func (c Command) Delete() error
- func (c *Command) Fetch() error
- func (c *Command) FetchPermissions(guildID Snowflake) (*GuildCommandPermissions, error)
- func (c Command) FromGuild() bool
- func (c Command) GetPermissions(guildID Snowflake) *GuildCommandPermissions
- func (c Command) Guild() *Guild
- func (c *Command) SetPermissions(guildID Snowflake, permissions ...CommandPermission) error
- func (c *Command) ToCreate() CommandCreate
- func (c *Command) Update(command CommandUpdate) error
- type CommandCreate
- type CommandInteraction
- func (i *CommandInteraction) CommandID() Snowflake
- func (i *CommandInteraction) CommandName() string
- func (i *CommandInteraction) CommandPath() string
- func (i *CommandInteraction) Options() []Option
- func (i *CommandInteraction) SubCommandGroupName() *string
- func (i *CommandInteraction) SubCommandName() *string
- type CommandInteractionData
- type CommandOption
- func NewBooleanOption(name string, description string, options ...CommandOption) CommandOption
- func NewChannelOption(name string, description string, options ...CommandOption) CommandOption
- func NewCommandOption(optionType CommandOptionType, name string, description string, ...) CommandOption
- func NewIntegerOption(name string, description string, options ...CommandOption) CommandOption
- func NewMentionableOption(name string, description string, options ...CommandOption) CommandOption
- func NewNumberOption(name string, description string, options ...CommandOption) CommandOption
- func NewRoleOption(name string, description string, options ...CommandOption) CommandOption
- func NewStringOption(name string, description string, options ...CommandOption) CommandOption
- func NewSubCommand(name string, description string, options ...CommandOption) CommandOption
- func NewSubCommandGroup(name string, description string, options ...CommandOption) CommandOption
- func NewUserOption(name string, description string, options ...CommandOption) CommandOption
- type CommandOptionType
- type CommandPermission
- type CommandPermissionType
- type CommandUpdate
- type Component
- type ComponentImpl
- type ComponentInteraction
- type ComponentInteractionData
- type ComponentType
- type CreateDMChannel
- type CreateGuild
- type CreateGuildFromTemplate
- type CreateGuildTemplate
- type CreateRole
- type DMChannel
- type DeconstructedSnowflake
- type Disgo
- type DisgoBuilder
- type Embed
- type EmbedAuthor
- type EmbedBuilder
- func (b *EmbedBuilder) AddField(name string, value string, inline bool) *EmbedBuilder
- func (b *EmbedBuilder) AddFields(field *EmbedField, fields ...*EmbedField) *EmbedBuilder
- func (b *EmbedBuilder) Build() Embed
- func (b *EmbedBuilder) ClearFields() *EmbedBuilder
- func (b *EmbedBuilder) RemoveField(i int) *EmbedBuilder
- func (b *EmbedBuilder) SetAuthor(name string, url string, iconURL string) *EmbedBuilder
- func (b *EmbedBuilder) SetAuthorIcon(iconURL string) *EmbedBuilder
- func (b *EmbedBuilder) SetAuthorName(name string) *EmbedBuilder
- func (b *EmbedBuilder) SetAuthorURL(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetColor(color int) *EmbedBuilder
- func (b *EmbedBuilder) SetDescription(description string) *EmbedBuilder
- func (b *EmbedBuilder) SetDescriptionf(description string, a ...interface{}) *EmbedBuilder
- func (b *EmbedBuilder) SetEmbedAuthor(author *EmbedAuthor) *EmbedBuilder
- func (b *EmbedBuilder) SetEmbedFooter(footer *EmbedFooter) *EmbedBuilder
- func (b *EmbedBuilder) SetField(i int, name string, value string, inline bool) *EmbedBuilder
- func (b *EmbedBuilder) SetFields(fields ...*EmbedField) *EmbedBuilder
- func (b *EmbedBuilder) SetFooter(text string, iconURL string) *EmbedBuilder
- func (b *EmbedBuilder) SetFooterIcon(iconURL string) *EmbedBuilder
- func (b *EmbedBuilder) SetFooterText(text string) *EmbedBuilder
- func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder
- func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder
- func (b *EmbedBuilder) SetTitlef(title string, a ...interface{}) *EmbedBuilder
- func (b *EmbedBuilder) SetURL(url string) *EmbedBuilder
- type EmbedField
- type EmbedFooter
- type EmbedProvider
- type EmbedResource
- type EmbedType
- type Emoji
- type EntityBuilder
- type ErrorResponse
- type Event
- type EventHandler
- type EventListener
- type EventManager
- type ExpandedInvite
- type ExplicitContentFilterLevel
- type FullGuild
- type FullInteraction
- type Gateway
- type GatewayBotRs
- type GatewayCommand
- type GatewayEventHandler
- type GatewayEventType
- type GatewayIntents
- func (p GatewayIntents) Add(bits ...GatewayIntents) GatewayIntents
- func (p GatewayIntents) Has(bit GatewayIntents) bool
- func (p GatewayIntents) HasAll(bits ...GatewayIntents) bool
- func (p GatewayIntents) Missing(bit GatewayIntents) bool
- func (p GatewayIntents) MissingAny(bits ...GatewayIntents) bool
- func (p GatewayIntents) Remove(bits ...GatewayIntents) GatewayIntents
- type GatewayOp
- type GatewayPacket
- type GatewayRs
- type GatewayStatus
- type Guild
- func (g *Guild) AddMember(userID Snowflake, addMember AddMember) (*Member, restclient.RestError)
- func (g *Guild) BanMember(userID Snowflake, reason string, deleteMessageDays int) restclient.RestError
- func (g *Guild) CreateCommand(command CommandCreate) (*Command, restclient.RestError)
- func (g *Guild) CreateRole(createRole CreateRole) (*Role, restclient.RestError)
- func (g *Guild) CreateTemplate(createGuildTemplate CreateGuildTemplate) (*GuildTemplate, restclient.RestError)
- func (g *Guild) Delete() restclient.RestError
- func (g *Guild) DeleteCommand(commandID Snowflake) restclient.RestError
- func (g *Guild) DeleteIntegration(integrationID Snowflake) restclient.RestError
- func (g *Guild) DeleteRole(roleID Snowflake) restclient.RestError
- func (g *Guild) DeleteTemplate(code string) (*GuildTemplate, restclient.RestError)
- func (g *Guild) Disconnect() error
- func (g *Guild) EditCommand(commandID Snowflake, command CommandUpdate) (*Command, restclient.RestError)
- func (g *Guild) GetAuditLogs(userID Snowflake, actionType AuditLogEvent, before Snowflake, limit int) (*AuditLog, restclient.RestError)
- func (g *Guild) GetBan(userID Snowflake) (*Ban, restclient.RestError)
- func (g *Guild) GetBans() ([]Ban, restclient.RestError)
- func (g *Guild) GetCommand(commandID Snowflake) (*Command, restclient.RestError)
- func (g *Guild) GetCommandPermissions(commandID Snowflake) (*GuildCommandPermissions, restclient.RestError)
- func (g *Guild) GetCommands() ([]*Command, restclient.RestError)
- func (g *Guild) GetCommandsPermissions() ([]*GuildCommandPermissions, restclient.RestError)
- func (g *Guild) GetIntegrations() ([]*Integration, restclient.RestError)
- func (g *Guild) GetMember(userID Snowflake) *Member
- func (g *Guild) GetTemplates() ([]*GuildTemplate, restclient.RestError)
- func (g *Guild) IconURL(size int) *string
- func (g *Guild) KickMember(userID Snowflake, reason string) restclient.RestError
- func (g *Guild) Leave() restclient.RestError
- func (g *Guild) PublicRole() *Role
- func (g *Guild) Roles() []*Role
- func (g *Guild) SelfMember() *Member
- func (g *Guild) SetCommandPermissions(commandID Snowflake, permissions SetGuildCommandPermissions) (*GuildCommandPermissions, error)
- func (g *Guild) SetCommands(commands ...CommandCreate) ([]*Command, restclient.RestError)
- func (g *Guild) SetCommandsPermissions(commandPermissions ...SetGuildCommandPermissions) ([]*GuildCommandPermissions, error)
- func (g *Guild) SyncTemplate(code string) (*GuildTemplate, restclient.RestError)
- func (g *Guild) UnbanMember(userID Snowflake) restclient.RestError
- func (g *Guild) Update(updateGuild UpdateGuild) (*Guild, restclient.RestError)
- func (g *Guild) UpdateMember(userID Snowflake, updateMember UpdateMember) (*Member, restclient.RestError)
- func (g *Guild) UpdateRole(roleID Snowflake, role UpdateRole) (*Role, restclient.RestError)
- func (g *Guild) UpdateTemplate(code string, updateGuildTemplate UpdateGuildTemplate) (*GuildTemplate, restclient.RestError)
- type GuildChannel
- type GuildCommandPermissions
- type GuildFeature
- type GuildPreview
- type GuildTemplate
- type GuildWelcomeChannel
- type GuildWelcomeScreen
- type HeartbeatCommand
- type HelloGatewayEventData
- type IdentifyCommand
- type IdentifyCommandDataProperties
- type Integration
- type IntegrationAccount
- type IntegrationApplication
- type IntegrationType
- type Interaction
- func (i *Interaction) DMChannel() *DMChannel
- func (i *Interaction) DeferReply(ephemeral bool) restclient.RestError
- func (i *Interaction) DeleteFollowup(messageID Snowflake) restclient.RestError
- func (i *Interaction) DeleteOriginal() restclient.RestError
- func (i *Interaction) EditFollowup(messageID Snowflake, messageUpdate MessageUpdate) (*Message, restclient.RestError)
- func (i *Interaction) EditOriginal(messageUpdate MessageUpdate) (*Message, restclient.RestError)
- func (i *Interaction) FromWebhook() bool
- func (i *Interaction) Guild() *Guild
- func (i *Interaction) GuildChannel() *GuildChannel
- func (i *Interaction) MessageChannel() *MessageChannel
- func (i *Interaction) Reply(messageCreate MessageCreate) restclient.RestError
- func (i *Interaction) Respond(responseType InteractionResponseType, data interface{}) restclient.RestError
- func (i *Interaction) SendFollowup(messageCreate MessageCreate) (*Message, restclient.RestError)
- func (i *Interaction) TextChannel() *TextChannel
- type InteractionResponse
- type InteractionResponseType
- type InteractionType
- type Invite
- type InviteChannel
- type InviteGuild
- type InviteUser
- type MFALevel
- type Member
- func (m *Member) AddRole(roleID Snowflake) restclient.RestError
- func (m *Member) Ban(reason string, deleteMessageDays int) restclient.RestError
- func (m *Member) EffectiveName() string
- func (m *Member) Guild() *Guild
- func (m *Member) IsOwner() bool
- func (m *Member) Kick(reason string) restclient.RestError
- func (m *Member) Move(channelID *Snowflake) (*Member, restclient.RestError)
- func (m *Member) Permissions() Permissions
- func (m *Member) RemoveRole(roleID Snowflake) restclient.RestError
- func (m *Member) Roles() []*Role
- func (m *Member) Unban() restclient.RestError
- func (m *Member) Update(updateGuildMember UpdateMember) (*Member, restclient.RestError)
- func (m *Member) VoiceState() *VoiceState
- type MemberCachePolicy
- type Mentionable
- type Message
- func (m *Message) ActionRows() []ActionRow
- func (m *Message) AddReaction(emoji string) restclient.RestError
- func (m *Message) AddReactionByEmote(emote Emoji) restclient.RestError
- func (m *Message) ButtonByID(customID string) *Button
- func (m *Message) Buttons() []Button
- func (m *Message) Channel() *MessageChannel
- func (m *Message) ComponentByID(customID string) Component
- func (m *Message) Crosspost() (*Message, restclient.RestError)
- func (m *Message) Delete() restclient.RestError
- func (m *Message) Guild() *Guild
- func (m *Message) IsEphemeral() bool
- func (m *Message) Marshal() ([]byte, error)
- func (m *Message) Reply(message MessageCreate) (*Message, restclient.RestError)
- func (m *Message) SelectMenuByID(customID string) *SelectMenu
- func (m *Message) SelectMenus() []SelectMenu
- func (m *Message) Unmarshal(data []byte) error
- func (m *Message) Update(message MessageUpdate) (*Message, restclient.RestError)
- type MessageActivity
- type MessageActivityType
- type MessageApplication
- type MessageBulkDelete
- type MessageCachePolicy
- type MessageChannel
- func (c MessageChannel) BulkDeleteMessages(messageIDs ...Snowflake) restclient.RestError
- func (c MessageChannel) CrosspostMessage(messageID Snowflake) (*Message, restclient.RestError)
- func (c MessageChannel) DeleteMessage(messageID Snowflake) restclient.RestError
- func (c MessageChannel) EditMessage(messageID Snowflake, message MessageUpdate) (*Message, restclient.RestError)
- func (c MessageChannel) SendMessage(message MessageCreate) (*Message, restclient.RestError)
- type MessageCreate
- type MessageCreateBuilder
- func (b *MessageCreateBuilder) AddActionRow(components ...Component) *MessageCreateBuilder
- func (b *MessageCreateBuilder) AddActionRows(actionRows ...ActionRow) *MessageCreateBuilder
- func (b *MessageCreateBuilder) AddEmbeds(embeds ...Embed) *MessageCreateBuilder
- func (b *MessageCreateBuilder) AddFile(name string, reader io.Reader, flags ...restclient.FileFlags) *MessageCreateBuilder
- func (b *MessageCreateBuilder) AddFiles(files ...restclient.File) *MessageCreateBuilder
- func (b *MessageCreateBuilder) AddFlags(flags ...MessageFlags) *MessageCreateBuilder
- func (b *MessageCreateBuilder) Build() MessageCreate
- func (b *MessageCreateBuilder) ClearActionRows() *MessageCreateBuilder
- func (b *MessageCreateBuilder) ClearAllowedMentions() *MessageCreateBuilder
- func (b *MessageCreateBuilder) ClearContent() *MessageCreateBuilder
- func (b *MessageCreateBuilder) ClearEmbeds() *MessageCreateBuilder
- func (b *MessageCreateBuilder) ClearFiles() *MessageCreateBuilder
- func (b *MessageCreateBuilder) ClearFlags() *MessageCreateBuilder
- func (b *MessageCreateBuilder) RemoveActionRow(i int) *MessageCreateBuilder
- func (b *MessageCreateBuilder) RemoveEmbed(i int) *MessageCreateBuilder
- func (b *MessageCreateBuilder) RemoveFiles(i int) *MessageCreateBuilder
- func (b *MessageCreateBuilder) RemoveFlags(flags ...MessageFlags) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetActionRow(i int, actionRow ActionRow) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetActionRows(actionRows ...ActionRow) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetContent(content string) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetContentf(content string, a ...interface{}) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetEmbed(i int, embed Embed) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetEmbeds(embeds ...Embed) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetEphemeral(ephemeral bool) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetFile(i int, file restclient.File) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetFiles(files ...restclient.File) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetFlags(flags MessageFlags) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetMessageReference(messageReference *MessageReference) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetMessageReferenceByID(messageID Snowflake) *MessageCreateBuilder
- func (b *MessageCreateBuilder) SetTTS(tts bool) *MessageCreateBuilder
- type MessageFlags
- func (f MessageFlags) Add(bits ...MessageFlags) MessageFlags
- func (f MessageFlags) Has(bit MessageFlags) bool
- func (f MessageFlags) HasAll(bits ...MessageFlags) bool
- func (f MessageFlags) Missing(bit MessageFlags) bool
- func (f MessageFlags) MissingAny(bits ...MessageFlags) bool
- func (f MessageFlags) Remove(bits ...MessageFlags) MessageFlags
- type MessageInteraction
- type MessageNotifications
- type MessageReaction
- type MessageReference
- type MessageSticker
- type MessageStickerFormatType
- type MessageType
- type MessageUpdate
- type MessageUpdateBuilder
- func (b *MessageUpdateBuilder) AddActionRow(components ...Component) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) AddActionRows(actionRows ...ActionRow) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) AddEmbeds(embeds ...Embed) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) AddFile(name string, reader io.Reader, flags ...restclient.FileFlags) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) AddFiles(files ...restclient.File) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) AddFlags(flags ...MessageFlags) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) Build() MessageUpdate
- func (b *MessageUpdateBuilder) ClearActionRows() *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) ClearAllowedMentions() *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) ClearContent() *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) ClearEmbeds() *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) ClearFiles() *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) ClearFlags() *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) RemoveActionRow(i int) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) RemoveEmbed(i int) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) RemoveFiles(i int) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) RemoveFlags(flags ...MessageFlags) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) RetainAttachments(attachments ...Attachment) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) RetainAttachmentsByID(attachmentIDs ...Snowflake) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetActionRow(i int, actionRow ActionRow) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetActionRows(actionRows ...ActionRow) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetContent(content string) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetContentf(content string, a ...interface{}) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetEmbed(i int, embed Embed) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetEmbeds(embeds ...Embed) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetFile(i int, file restclient.File) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetFiles(files ...restclient.File) *MessageUpdateBuilder
- func (b *MessageUpdateBuilder) SetFlags(flags MessageFlags) *MessageUpdateBuilder
- type MoveMember
- type Option
- func (o Option) Bool() bool
- func (o Option) Category() *Category
- func (o Option) Channel() *Channel
- func (o Option) Float() float64
- func (o Option) Float32() float32
- func (o Option) GuildChannel() *GuildChannel
- func (o Option) Integer() int
- func (o Option) Member() *Member
- func (o Option) MessageChannel() *MessageChannel
- func (o Option) Role() *Role
- func (o Option) Snowflake() Snowflake
- func (o Option) StoreChannel() *StoreChannel
- func (o Option) String() string
- func (o Option) TextChannel() *TextChannel
- func (o Option) User() *User
- func (o Option) VoiceChannel() *VoiceChannel
- type OptionChoice
- type OptionalAuditLogEntryInfo
- type Options
- type PartialChannel
- type PartialGuild
- type PartialRole
- type PermissionOverwrite
- type PermissionOverwriteType
- type Permissions
- func (p Permissions) Add(bits ...Permissions) Permissions
- func (p Permissions) Has(bit Permissions) bool
- func (p Permissions) HasAll(bits ...Permissions) bool
- func (p Permissions) MarshalJSON() ([]byte, error)
- func (p Permissions) Missing(bit Permissions) bool
- func (p Permissions) MissingAny(bits ...Permissions) bool
- func (p Permissions) Remove(bits ...Permissions) Permissions
- func (p *Permissions) UnmarshalJSON(b []byte) error
- type PremiumTier
- type RawGatewayEvent
- type RawOption
- type ReadyGatewayEvent
- type RequestGuildMembersCommand
- type Resolved
- type RestClient
- type ResumeCommand
- type Role
- func (r *Role) Delete() restclient.RestError
- func (r *Role) Guild() *Guild
- func (r *Role) Mention() string
- func (r *Role) SetPosition(rolePositionUpdate UpdateRolePosition) ([]*Role, restclient.RestError)
- func (r *Role) String() string
- func (r *Role) Update(roleUpdate UpdateRole) (*Role, restclient.RestError)
- type RoleTag
- type SelectMenu
- func (m SelectMenu) AddOptions(options ...SelectOption) SelectMenu
- func (m SelectMenu) RemoveOption(index int) SelectMenu
- func (m SelectMenu) SetOption(value string, option SelectOption) SelectMenu
- func (m SelectMenu) SetOptions(options ...SelectOption) SelectMenu
- func (m SelectMenu) WithCustomID(customID string) SelectMenu
- func (m SelectMenu) WithMaxValues(maxValue int) SelectMenu
- func (m SelectMenu) WithMinValues(minValue int) SelectMenu
- func (m SelectMenu) WithPlaceholder(placeholder string) SelectMenu
- type SelectMenuInteraction
- type SelectMenuInteractionData
- type SelectOption
- func (o SelectOption) WithDefault(defaultOption bool) SelectOption
- func (o SelectOption) WithDescription(description string) SelectOption
- func (o SelectOption) WithEmoji(emoji *Emoji) SelectOption
- func (o SelectOption) WithLabel(label string) SelectOption
- func (o SelectOption) WithValue(value string) SelectOption
- type SelfUser
- type SetGuildCommandPermissions
- type SetGuildCommandsPermissions
- type Snowflake
- type StoreChannel
- type SystemChannelFlag
- type TargetType
- type TextChannel
- type Timestamp
- type TimestampFlag
- type UnmarshalComponent
- type UpdateGuild
- type UpdateGuildTemplate
- type UpdateMember
- type UpdateRole
- type UpdateRolePosition
- type UpdateSelfNick
- type UpdateSelfUser
- type UpdateStatusCommand
- type UpdateVoiceStateCommand
- type User
- type UserFlags
- func (f UserFlags) Add(bits ...UserFlags) UserFlags
- func (f UserFlags) Has(bit UserFlags) bool
- func (f UserFlags) HasAll(bits ...UserFlags) bool
- func (f UserFlags) Missing(bit UserFlags) bool
- func (f UserFlags) MissingAny(bits ...UserFlags) bool
- func (f UserFlags) Remove(bits ...UserFlags) UserFlags
- type VerificationLevel
- type VoiceChannel
- type VoiceDispatchInterceptor
- type VoiceServerUpdate
- type VoiceServerUpdateEvent
- type VoiceState
- type VoiceStateUpdateEvent
- type Webhook
- type WebhookEventHandler
- type WebhookServer
- type WebhookType
Constants ¶
const ( ButtonStylePrimary = iota + 1 ButtonStyleSecondary ButtonStyleSuccess ButtonStyleDanger ButtonStyleLink )
Supported ButtonStyle(s)
const ( CommandPermissionTypeRole = iota + 1 CommandPermissionTypeUser )
types of CommandPermissionType
const ( ComponentTypeActionRow = iota + 1 ComponentTypeButton ComponentTypeSelectMenu )
Supported ComponentType(s)
const GitHub = "https://github.com/DisgoOrg/disgo"
GitHub is the Disgo GitHub URL
Variables ¶
var ( ErrNoGateway = errors.New("no gateway initialized") ErrNoGatewayConn = errors.New("no active gateway connection found") )
errors returned when no gateway or ws conn exists
var DefaultMessageAllowedMentions = AllowedMentions{ Parse: []AllowedMentionType{AllowedMentionTypeUsers, AllowedMentionTypeRoles, AllowedMentionTypeEveryone}, Roles: []Snowflake{}, Users: []Snowflake{}, RepliedUser: true, }
DefaultMessageAllowedMentions gives you the default AllowedMentions for a Message
var ErrDMChannelToYourself = restclient.NewError(nil, errors.New("can't open a dm channel to yourself"))
ErrDMChannelToYourself occurs when opening a DMChannel to yourself
var ErrMaxCommands = errors.New("you can provide a max of 100 application commands")
ErrMaxCommands returned if a Guild reached max of 100 Command(s)
var ErrNoTimestampMatch = errors.New("no matching timestamp found in string")
ErrNoTimestampMatch is returned when no valid Timestamp is found in the Message
var PatternTimestampFlag = regexp.MustCompile("<t:(?P<time>-?\\d{1,17})(?::(?P<format>[tTdDfFR]))?>")
PatternTimestampFlag the regexp.Regexp to parse a Timestamp from a Message
var UserAgent = "DiscordBot (" + GitHub + ", " + Version + ")"
UserAgent is the global useragent disgo uses for all its requests
var Version = getVersion()
Version returns the current used Disgo version in the format vx.x.x
Functions ¶
func GetOS ¶
func GetOS() string
GetOS returns the simplified version of the operating system for sending to Discord in the IdentifyCommandDataProperties.OS payload
func Verify ¶
Verify implements the verification side of the discord interactions api signing algorithm, as documented here: https://discord.com/developers/docs/interactions/slash-commands#security-and-authorization Credit: https://github.com/bsdlp/discord-interactions-go/blob/main/interactions/verify.go
Types ¶
type ActionRow ¶ added in v0.4.0
type ActionRow struct {
ComponentImpl
Components []Component `json:"components"`
}
ActionRow holds up to 5 Component(s) in a row
func NewActionRow ¶ added in v0.4.0
NewActionRow creates a new ActionRow holding th provided Component(s)
func (ActionRow) AddComponents ¶ added in v0.4.5
AddComponents returns a new ActionRow with the provided Component(s) added
func (ActionRow) RemoveComponent ¶ added in v0.4.5
RemoveComponent returns a new ActionRow with the provided Component at the index removed
func (ActionRow) SetComponent ¶ added in v0.4.5
SetComponent returns a new ActionRow with the Component which has the customID replaced
func (ActionRow) SetComponents ¶ added in v0.4.5
SetComponents returns a new ActionRow with the provided Component(s)
type Activity ¶
type Activity struct {
Name string `json:"name"`
Type ActivityType `json:"type"`
URL *string `json:"url"`
CreatedAt time.Time `json:"created_at"`
Timestamps *ActivityTimestamps `json:"timestamps,omitempty"`
ApplicationID Snowflake `json:"application_id,omitempty"`
Details *string `json:"details,omitempty"`
State *string `json:"state,omitempty"`
Emoji *ActivityEmoji `json:"emoji,omitempty"`
Party *ActivityParty `json:"party,omitempty"`
Assets *ActivityAssets `json:"assets,omitempty"`
Secrets *ActivitySecrets `json:"secrets,omitempty"`
Instance *bool `json:"instance,omitempty"`
Flags int `json:"flags,omitempty"`
}
Activity represents the fields of a user's presence
type ActivityAssets ¶
type ActivityAssets struct {
LargeImage string `json:"large_image,omitempty"`
LargeText string `json:"large_text,omitempty"`
SmallImage string `json:"small_image,omitempty"`
SmallText string `json:"small_text,omitempty"`
}
ActivityAssets are the images for the presence and hover texts
type ActivityEmoji ¶
type ActivityEmoji struct {
Name string `json:"name"`
ID *Snowflake `json:"id,omitempty"`
Animated *bool `json:"animated,omitempty"`
}
ActivityEmoji is an Emoji object for an Activity
type ActivityParty ¶
ActivityParty is information about the party of the player
type ActivitySecrets ¶
type ActivitySecrets struct {
Join string `json:"join,omitempty"`
Spectate string `json:"spectate,omitempty"`
Match string `json:"match,omitempty"`
}
ActivitySecrets contain secrets for Rich Presence joining and spectating
type ActivityTimestamps ¶
type ActivityTimestamps struct {
Start *time.Time `json:"start,omitempty"`
End *time.Time `json:"end,omitempty"`
}
ActivityTimestamps represents when a user started and ended their activity
type ActivityType ¶
type ActivityType int
ActivityType represents the status of a user, one of Game, Streaming, Listening, Watching, Custom or Competing
const ( Game ActivityType = iota Streaming Listening Watching Custom Competing )
Constants for activities
type AddBan ¶ added in v0.5.4
type AddBan struct {
DeleteMessageDays int `json:"delete_message_days,omitempty"`
Reason string `json:"reason,omitempty"`
}
AddBan is used to ban a User (https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params)
type AddMember ¶ added in v0.4.5
type AddMember struct {
AccessToken string `json:"access_token"`
Nick string `json:"nick,omitempty"`
Roles []Snowflake `json:"roles,omitempty"`
Mute bool `json:"mute,omitempty"`
Deaf bool `json:"deaf,omitempty"`
}
AddMember is used to add a member via the oauth2 access token to a guild
type AllowedMentionType ¶
type AllowedMentionType string
AllowedMentionType ?
const ( AllowedMentionTypeRoles AllowedMentionType = "roles" AllowedMentionTypeUsers AllowedMentionType = "users" AllowedMentionTypeEveryone AllowedMentionType = "everyone" )
All AllowedMentionType(s)
type AllowedMentions ¶
type AllowedMentions struct {
Parse []AllowedMentionType `json:"parse"`
Roles []Snowflake `json:"roles"`
Users []Snowflake `json:"users"`
RepliedUser bool `json:"replied_user"`
}
AllowedMentions are used for avoiding mentioning users in Message and Interaction
type Attachment ¶ added in v0.4.3
type Attachment struct {
ID Snowflake `json:"id,omitempty"`
Filename string `json:"filename"`
Size int `json:"size"`
URL string `json:"url"`
ProxyURL string `json:"proxy_url"`
Height *int `json:"height"`
Width *int `json:"width"`
}
Attachment is used for files sent in a Message
type AudioController ¶ added in v0.2.0
type AudioController interface {
Disgo() Disgo
Connect(guildID Snowflake, channelID Snowflake) error
Disconnect(guildID Snowflake) error
}
AudioController lets you Connect / Disconnect from a VoiceChannel
type AuditLog ¶ added in v0.5.3
type AuditLog struct {
Disgo Disgo `json:"-"`
GuildID Snowflake `json:"-"`
AuditLogFilterOptions AuditLogFilterOptions `json:"-"`
Webhooks map[Snowflake]*Webhook `json:"webhooks"`
Users map[Snowflake]*User `json:"users"`
Integrations map[Snowflake]*Integration `json:"integrations"`
Entries []AuditLogEntry `json:"entries"`
}
AuditLog (https://discord.com/developers/docs/resources/audit-log) These are logs of events that occurred, accessible via the Discord API.
type AuditLogChangeKey ¶ added in v0.5.3
type AuditLogChangeKey struct {
Name *string `json:"name"`
Description *string `json:"description"`
IconHash *string `json:"icon_hash"`
SplashHash *string `json:"splash_hash"`
DiscoverySplashHash *string `json:"discovery_splash_hash"`
BannerHash *string `json:"banner_hash"`
OwnerID *Snowflake `json:"owner_id"`
Region *string `json:"region"`
PreferredLocale *string `json:"preferred_locale"`
AFKChannelID *Snowflake `json:"afk_channel_id"`
AFKTimeout *int `json:"afk_timeout"`
RulesChannelID *Snowflake `json:"rules_channel_id"`
PublicUpdatesChannelID *Snowflake `json:"public_updates_channel_id"`
MFALevel *MFALevel `json:"mfa_level"`
VerificationLevel *VerificationLevel `json:"verification_level"`
ExplicitContentFilterLevel *ExplicitContentFilterLevel `json:"explicit_content_filter"`
DefaultMessageNotifications *MessageNotifications `json:"default_message_notifications"`
VanityURLCode *string `json:"vanity_url_code"`
Add []PartialRole `json:"$add"`
Remove []PartialRole `json:"$remove"`
PruneDeleteDays *int `json:"prune_delete_days"`
WidgetEnabled *bool `json:"widget_enabled"`
WidgetChannelID *string `json:"widget_channel_id"`
SystemChannelID *string `json:"system_channel_id"`
Position *int `json:"position"`
Topic *string `json:"topic"`
Bitrate *int `json:"bitrate"`
PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"`
NSFW *bool `json:"nsfw"`
ApplicationID *Snowflake `json:"application_id"`
RateLimitPerUser *int `json:"ratelimit_per_user"`
Permissions *string `json:"permissions"`
Color *int `json:"color"`
Hoist *bool `json:"hoist"`
Mentionable *bool `json:"mentionable"`
Allow *Permissions `json:"allow"`
Deny *Permissions `json:"deny"`
Code *string `json:"code"`
ChannelID *Snowflake `json:"channel_id"`
InviterID *Snowflake `json:"inviter_id"`
MaxUses *int `json:"max_uses"`
Uses *int `json:"uses"`
MaxAge *string `json:"max_age"`
Temporary *bool `json:"temporary"`
Deaf *bool `json:"deaf"`
Mute *bool `json:"mute"`
Nick *string `json:"nick"`
AvatarHash *string `json:"avatar_hash"`
ID *Snowflake `json:"id"`
Type interface{} `json:"type"`
EnableEmoticons *bool `json:"enable_emoticons"`
ExpireBehavior *int `json:"expire_behavior"`
ExpireGracePeriod *int `json:"expire_grace_period"`
UserLimit *int `json:"user_limit"`
PrivacyLevel *int `json:"privacy_level"`
}
AuditLogChangeKey (https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key) is data representing changes values/settings in an audit log.
type AuditLogEntry ¶ added in v0.5.3
type AuditLogEntry struct {
TargetID *Snowflake `json:"target_id"`
Changes []AuditLogChangeKey `json:"changes"`
UserID Snowflake `json:"user_id"`
ID Snowflake `json:"id"`
ActionType AuditLogEvent `json:"action_type"`
Options *OptionalAuditLogEntryInfo `json:"options"`
Reason *string `json:"reason"`
}
AuditLogEntry (https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object)
type AuditLogEvent ¶ added in v0.5.3
type AuditLogEvent int
AuditLogEvent is an 8-bit unsigned integer representing an audit log event.
const ( AuditLogEventChannelCreate AuditLogEvent = iota + 10 AuditLogEventChannelUpdate AuditLogEventChannelDelete AuditLogEventChannelOverwriteCreate AuditLogEventChannelOverwriteUpdate AuditLogEventChannelOverwriteDelete )
AuditLogEventChannelCreate
const ( AuditLogEventMemberKick AuditLogEvent = iota + 20 AuditLogEventMemberPrune AuditLogEventMemberBanAdd AuditLogEventMemberBanRemove AuditLogEventMemberUpdate AuditLogEventMemberRoleUpdate AuditLogEventMemberMove AuditLogEventMemberDisconnect AuditLogEventBotAdd )
AuditLogEventMemberKick
const ( AuditLogEventRoleCreate AuditLogEvent = iota + 30 AuditLogEventRoleUpdate AuditLogEventRoleDelete )
AuditLogEventRoleCreate
const ( AuditLogEventInviteCreate AuditLogEvent = iota + 40 AuditLogEventInviteUpdate AuditLogEventInviteDelete )
AuditLogEventInviteCreate
const ( AuditLogEventWebhookCreate AuditLogEvent = iota + 50 AuditLogEventWebhookUpdate AuditLogEventWebhookDelete )
AuditLogEventWebhookCreate
const ( AuditLogEventEmojiCreate AuditLogEvent = iota + 60 AuditLogEventEmojiUpdate AuditLogEventEmojiDelete )
AuditLogEventEmojiCreate
const ( AuditLogEventMessageDelete AuditLogEvent = iota + 72 AuditLogEventMessageBulkDelete AuditLogEventMessagePin AuditLogEventMessageUnpin )
AuditLogEventMessageDelete
const ( AuditLogEventIntegrationCreate AuditLogEvent = iota + 80 AuditLogEventIntegrationUpdate AuditLogEventIntegrationDelete AuditLogEventStageInstanceCreate AuditLogEventStageInstanceUpdate AuditLogEventStageInstanceDelete )
AuditLogEventIntegrationCreate
const (
AuditLogEventGuildUpdate AuditLogEvent = 1
)
AuditLogEventGuildUpdate ...
type AuditLogFilterOptions ¶ added in v0.5.6
type AuditLogFilterOptions struct {
UserID Snowflake
ActionType AuditLogEvent
Before Snowflake
Limit int
}
AuditLogFilterOptions fields used to filter audit-log retrieving
type Ban ¶ added in v0.5.4
Ban represents a banned User from a Guild (https://discord.com/developers/docs/resources/guild#ban-object)
type Button ¶ added in v0.4.0
type Button struct {
ComponentImpl
Style ButtonStyle `json:"style,omitempty"`
Label string `json:"label,omitempty"`
Emoji *Emoji `json:"emoji,omitempty"`
CustomID string `json:"custom_id,omitempty"`
URL string `json:"url,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
Button can be attacked to all messages & be clicked by a User. If clicked it fires an events.ButtonClickEvent with the declared customID
func NewButton ¶ added in v0.4.0
func NewButton(style ButtonStyle, label string, customID string, url string, emoji *Emoji, disabled bool) Button
NewButton creates a new Button with the provided parameters. Link Button(s) need a URL and other Button(s) need a customID
func NewDangerButton ¶ added in v0.4.0
NewDangerButton creates a new Button with ButtonStyleDanger & the provided parameters
func NewLinkButton ¶ added in v0.4.0
NewLinkButton creates a new link Button with ButtonStyleLink & the provided parameters
func NewPrimaryButton ¶ added in v0.4.0
NewPrimaryButton creates a new Button with ButtonStylePrimary & the provided parameters
func NewSecondaryButton ¶ added in v0.4.0
NewSecondaryButton creates a new Button with ButtonStyleSecondary & the provided parameters
func NewSuccessButton ¶ added in v0.4.0
NewSuccessButton creates a new Button with ButtonStyleSuccess & the provided parameters
func (Button) AsDisabled ¶ added in v0.4.5
AsDisabled returns a new Button but disabled
func (Button) WithCustomID ¶ added in v0.4.5
WithCustomID returns a new Button with the provided custom id
func (Button) WithDisabled ¶ added in v0.4.5
WithDisabled returns a new Button but disabled/enabled
func (Button) WithStyle ¶ added in v0.4.5
func (b Button) WithStyle(style ButtonStyle) Button
WithStyle returns a new Button with the provided style
type ButtonInteraction ¶ added in v0.4.0
type ButtonInteraction struct {
*ComponentInteraction
Data *ButtonInteractionData `json:"data,omitempty"`
}
ButtonInteraction is a specific Interaction when CLicked on Button(s)
func (*ButtonInteraction) Button ¶ added in v0.4.5
func (i *ButtonInteraction) Button() *Button
Button returns the Button which issued this ButtonInteraction. nil for ephemeral Message(s)
type ButtonInteractionData ¶ added in v0.4.0
type ButtonInteractionData struct {
*ComponentInteractionData
}
ButtonInteractionData is the Button data payload
type ButtonStyle ¶ added in v0.4.0
type ButtonStyle int
ButtonStyle defines how the Button looks like (https://discord.com/assets/7bb017ce52cfd6575e21c058feb3883b.png)
type Cache ¶
type Cache interface {
Disgo() Disgo
Close()
DoCleanup()
CacheFlags() CacheFlags
Command(commandID Snowflake) *Command
GuildCommandCache(guildID Snowflake) map[Snowflake]*Command
AllGuildCommandCache() map[Snowflake]map[Snowflake]*Command
GlobalCommandCache() map[Snowflake]*Command
CacheGlobalCommand(command *Command) *Command
CacheGuildCommand(command *Command) *Command
UncacheCommand(commandID Snowflake)
User(Snowflake) *User
UserByTag(string) *User
UsersByName(string, bool) []*User
Users() []*User
UserCache() map[Snowflake]*User
CacheUser(*User) *User
UncacheUser(Snowflake)
FindUser(func(*User) bool) *User
FindUsers(func(*User) bool) []*User
Guild(Snowflake) *Guild
GuildsByName(string, bool) []*Guild
Guilds() []*Guild
GuildCache() map[Snowflake]*Guild
CacheGuild(*Guild) *Guild
UncacheGuild(Snowflake)
Message(channelID Snowflake, messageID Snowflake) *Message
Messages(channelID Snowflake) []*Message
MessageCache(channelID Snowflake) map[Snowflake]*Message
AllMessageCache() map[Snowflake]map[Snowflake]*Message
CacheMessage(message *Message) *Message
UncacheMessage(channelID Snowflake, messageID Snowflake)
Member(Snowflake, Snowflake) *Member
MemberByTag(Snowflake, string) *Member
MembersByName(Snowflake, string, bool) []*Member
Members(Snowflake) []*Member
AllMembers() []*Member
MemberCache(Snowflake) map[Snowflake]*Member
AllMemberCache() map[Snowflake]map[Snowflake]*Member
CacheMember(member *Member) *Member
UncacheMember(Snowflake, Snowflake)
FindMember(Snowflake, func(*Member) bool) *Member
FindMembers(Snowflake, func(*Member) bool) []*Member
VoiceState(guildID Snowflake, userID Snowflake) *VoiceState
VoiceStates(guildID Snowflake) []*VoiceState
VoiceStateCache(guildID Snowflake) map[Snowflake]*VoiceState
CacheVoiceState(voiceState *VoiceState) *VoiceState
UncacheVoiceState(guildID Snowflake, userID Snowflake)
Role(roleID Snowflake) *Role
RolesByName(Snowflake, string, bool) []*Role
Roles(Snowflake) []*Role
AllRoles() []*Role
RoleCache(Snowflake) map[Snowflake]*Role
AllRoleCache() map[Snowflake]map[Snowflake]*Role
CacheRole(*Role) *Role
UncacheRole(Snowflake, Snowflake)
FindRole(Snowflake, func(*Role) bool) *Role
FindRoles(Snowflake, func(*Role) bool) []*Role
DMChannel(Snowflake) *DMChannel
DMChannels() []*DMChannel
DMChannelCache() map[Snowflake]*DMChannel
CacheDMChannel(*DMChannel) *DMChannel
UncacheDMChannel(dmChannelID Snowflake)
FindDMChannel(func(*DMChannel) bool) *DMChannel
FindDMChannels(func(*DMChannel) bool) []*DMChannel
Channel(Snowflake) *Channel
MessageChannel(Snowflake) *MessageChannel
GuildChannel(Snowflake) *GuildChannel
TextChannel(Snowflake) *TextChannel
TextChannelsByName(Snowflake, string, bool) []*TextChannel
TextChannels(Snowflake) []*TextChannel
TextChannelCache(Snowflake) map[Snowflake]*TextChannel
CacheTextChannel(*TextChannel) *TextChannel
UncacheTextChannel(Snowflake, Snowflake)
FindTextChannel(Snowflake, func(*TextChannel) bool) *TextChannel
FindTextChannels(Snowflake, func(*TextChannel) bool) []*TextChannel
StoreChannel(Snowflake) *StoreChannel
StoreChannelsByName(Snowflake, string, bool) []*StoreChannel
StoreChannels(Snowflake) []*StoreChannel
StoreChannelCache(Snowflake) map[Snowflake]*StoreChannel
CacheStoreChannel(*StoreChannel) *StoreChannel
UncacheStoreChannel(Snowflake, Snowflake)
FindStoreChannel(Snowflake, func(*StoreChannel) bool) *StoreChannel
FindStoreChannels(Snowflake, func(*StoreChannel) bool) []*StoreChannel
VoiceChannel(Snowflake) *VoiceChannel
VoiceChannelsByName(Snowflake, string, bool) []*VoiceChannel
VoiceChannels(Snowflake) []*VoiceChannel
VoiceChannelCache(Snowflake) map[Snowflake]*VoiceChannel
CacheVoiceChannel(*VoiceChannel) *VoiceChannel
UncacheVoiceChannel(Snowflake, Snowflake)
FindVoiceChannel(Snowflake, func(*VoiceChannel) bool) *VoiceChannel
FindVoiceChannels(Snowflake, func(*VoiceChannel) bool) []*VoiceChannel
Category(Snowflake) *Category
CategoriesByName(Snowflake, string, bool) []*Category
Categories(Snowflake) []*Category
AllCategories() []*Category
CategoryCache(Snowflake) map[Snowflake]*Category
AllCategoryCache() map[Snowflake]map[Snowflake]*Category
CacheCategory(*Category) *Category
UncacheCategory(Snowflake, Snowflake)
FindCategory(Snowflake, func(*Category) bool) *Category
FindCategories(Snowflake, func(*Category) bool) []*Category
Emote(emoteID Snowflake) *Emoji
EmotesByName(guildID Snowflake, name string, ignoreCase bool) []*Emoji
Emotes(guildID Snowflake) []*Emoji
EmoteCache(guildID Snowflake) map[Snowflake]*Emoji
AllEmoteCache() map[Snowflake]map[Snowflake]*Emoji
CacheEmote(*Emoji) *Emoji
UncacheEmote(guildID Snowflake, emoteID Snowflake)
}
Cache allows you to access the objects that are stored in-memory by Discord
type CacheFlags ¶ added in v0.2.0
type CacheFlags int
CacheFlags are used to enable/disable certain internal caches
const ( CacheFlagsNone CacheFlags = 0 CacheFlagDMChannels CacheFlags = 1 << iota CacheFlagCategories CacheFlagTextChannels CacheFlagVoiceChannels CacheFlagStoreChannels CacheFlagRoles CacheFlagRoleTags CacheFlagEmotes CacheFlagVoiceState CacheFlagCommands CacheFlagCommandPermissions CacheFlagsChannels = CacheFlagDMChannels | CacheFlagCategories | CacheFlagTextChannels | CacheFlagVoiceChannels | CacheFlagStoreChannels CacheFlagsDefault = CacheFlagsChannels | CacheFlagRoles | CacheFlagEmotes CacheFlagsFullRoles = CacheFlagRoles | CacheFlagRoleTags CacheFlagsFullCommands = CacheFlagCommands | CacheFlagCommandPermissions CacheFlagsAll = CacheFlagsChannels | CacheFlagsFullRoles | CacheFlagEmotes | CacheFlagVoiceState | CacheFlagsFullCommands )
values for CacheFlags
func (CacheFlags) Add ¶ added in v0.2.0
func (c CacheFlags) Add(bits ...CacheFlags) CacheFlags
Add allows you to add multiple bits together, producing a new bit
func (CacheFlags) Has ¶ added in v0.2.0
func (c CacheFlags) Has(bit CacheFlags) bool
Has will check whether the Bit contains another bit
func (CacheFlags) HasAll ¶ added in v0.2.0
func (c CacheFlags) HasAll(bits ...CacheFlags) bool
HasAll will ensure that the bit includes all of the bits entered
func (CacheFlags) Missing ¶ added in v0.2.0
func (c CacheFlags) Missing(bit CacheFlags) bool
Missing will do the inverse of Bit.Has
func (CacheFlags) MissingAny ¶ added in v0.2.0
func (c CacheFlags) MissingAny(bits ...CacheFlags) bool
MissingAny will check whether the bit is missing any one of the bits
func (CacheFlags) Remove ¶ added in v0.2.0
func (c CacheFlags) Remove(bits ...CacheFlags) CacheFlags
Remove allows you to subtract multiple bits from the first, producing a new bit
type CacheStrategy ¶ added in v0.2.0
CacheStrategy is used to determine whether something should be cached when making an api request. When using the gateway, you'll receive the event shortly afterwards if you have the correct GatewayIntents.
var ( CacheStrategyYes CacheStrategy = func(disgo Disgo) bool { return true } CacheStrategyNo CacheStrategy = func(disgo Disgo) bool { return true } CacheStrategyNoWs CacheStrategy = func(disgo Disgo) bool { return disgo.HasGateway() } )
Default cache strategy choices
type Category ¶
type Category struct {
GuildChannel
}
Category groups text & voice channels in servers together
type Channel ¶
type Channel struct {
Disgo Disgo `json:"-"`
ID Snowflake `json:"id"`
Name *string `json:"name,omitempty"`
Type ChannelType `json:"type"`
LastMessageID *Snowflake `json:"last_message_id,omitempty"`
GuildID *Snowflake `json:"guild_id,omitempty"`
Position *int `json:"position,omitempty"`
Topic *string `json:"topic,omitempty"`
NSFW *bool `json:"nsfw,omitempty"`
Bitrate *int `json:"bitrate,omitempty"`
UserLimit *int `json:"user_limit,omitempty"`
RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"`
Recipients []*User `json:"recipients,omitempty"`
Icon *string `json:"icon,omitempty"`
OwnerID *Snowflake `json:"owner_id,omitempty"`
ApplicationID *Snowflake `json:"application_id,omitempty"`
ParentID *Snowflake `json:"parent_id,omitempty"`
Permissions *Permissions `json:"permissions,omitempty"`
}
Channel is a generic discord channel object
type ChannelType ¶
type ChannelType int
ChannelType for interacting with discord's channels
const ( ChannelTypeText ChannelType = iota ChannelTypeDM ChannelTypeVoice ChannelTypeGroupDM ChannelTypeCategory ChannelTypeNews ChannelTypeStore )
Channel constants
type Command ¶ added in v0.2.0
type Command struct {
Disgo Disgo `json:"-"`
GuildPermissions map[Snowflake]*GuildCommandPermissions `json:"-"`
GuildID *Snowflake `json:"guild_id"`
ID Snowflake `json:"id,omitempty"`
ApplicationID Snowflake `json:"application_id,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
DefaultPermission bool `json:"default_permission,omitempty"`
Options []CommandOption `json:"options,omitempty"`
}
Command is the base "command" model that belongs to an application.
func (*Command) FetchPermissions ¶ added in v0.2.0
func (c *Command) FetchPermissions(guildID Snowflake) (*GuildCommandPermissions, error)
FetchPermissions fetched the GuildCommandPermissions for a specific Guild from discord
func (Command) FromGuild ¶ added in v0.2.0
FromGuild returns true if this is a guild Command else false
func (Command) GetPermissions ¶ added in v0.2.0
func (c Command) GetPermissions(guildID Snowflake) *GuildCommandPermissions
GetPermissions returns the GuildCommandPermissions for the specific Guild from the Cache
func (Command) Guild ¶ added in v0.2.0
Guild returns the Guild the Command is from from the Cache or nil if it is a global Command
func (*Command) SetPermissions ¶ added in v0.2.0
func (c *Command) SetPermissions(guildID Snowflake, permissions ...CommandPermission) error
SetPermissions sets the GuildCommandPermissions for a specific Guild. this overrides all existing CommandPermission(s). thx discord for that
func (*Command) ToCreate ¶ added in v0.4.2
func (c *Command) ToCreate() CommandCreate
ToCreate return the CommandCreate for this Command
func (*Command) Update ¶ added in v0.2.0
func (c *Command) Update(command CommandUpdate) error
Update updates the current Command with the given fields
type CommandCreate ¶ added in v0.3.0
type CommandCreate struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DefaultPermission bool `json:"default_permission,omitempty"`
Options []CommandOption `json:"options,omitempty"`
}
CommandCreate is used to create a Command. all fields are optional
type CommandInteraction ¶ added in v0.4.0
type CommandInteraction struct {
*Interaction
Data *CommandInteractionData `json:"data,omitempty"`
}
CommandInteraction is a specific Interaction when using Command(s)
func (*CommandInteraction) CommandID ¶ added in v0.5.2
func (i *CommandInteraction) CommandID() Snowflake
CommandID returns the ID of the api.Command which got used
func (*CommandInteraction) CommandName ¶ added in v0.5.2
func (i *CommandInteraction) CommandName() string
CommandName the name of the api.Command which got used
func (*CommandInteraction) CommandPath ¶ added in v0.5.2
func (i *CommandInteraction) CommandPath() string
CommandPath returns the api.Command path
func (*CommandInteraction) Options ¶ added in v0.5.2
func (i *CommandInteraction) Options() []Option
Options returns the parsed Option which the Command got used with
func (*CommandInteraction) SubCommandGroupName ¶ added in v0.5.2
func (i *CommandInteraction) SubCommandGroupName() *string
SubCommandGroupName the subcommand group name of the api.Command which got used. May be nil
func (*CommandInteraction) SubCommandName ¶ added in v0.5.2
func (i *CommandInteraction) SubCommandName() *string
SubCommandName the subcommand name of the api.Command which got used. May be nil
type CommandInteractionData ¶ added in v0.4.0
type CommandInteractionData struct {
ID Snowflake `json:"id"`
CommandName string `json:"name"`
SubCommandName *string `json:"-"`
SubCommandGroupName *string `json:"-"`
Resolved *Resolved `json:"resolved,omitempty"`
RawOptions []RawOption `json:"options,omitempty"`
Options []Option `json:"-"`
}
CommandInteractionData is the command data payload
type CommandOption ¶
type CommandOption struct {
Type CommandOptionType `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required,omitempty"`
Choices []OptionChoice `json:"choices,omitempty"`
Options []CommandOption `json:"options,omitempty"`
}
CommandOption are the arguments used in Command.Options
func NewBooleanOption ¶ added in v0.4.2
func NewBooleanOption(name string, description string, options ...CommandOption) CommandOption
NewBooleanOption creates a new CommandOption with CommandOptionTypeSubCommand
func NewChannelOption ¶ added in v0.4.2
func NewChannelOption(name string, description string, options ...CommandOption) CommandOption
NewChannelOption creates a new CommandOption with CommandOptionTypeSubCommand
func NewCommandOption ¶ added in v0.4.2
func NewCommandOption(optionType CommandOptionType, name string, description string, options ...CommandOption) CommandOption
NewCommandOption creates a new CommandOption with the provided params
func NewIntegerOption ¶ added in v0.4.2
func NewIntegerOption(name string, description string, options ...CommandOption) CommandOption
NewIntegerOption creates a new CommandOption with CommandOptionTypeSubCommand
func NewMentionableOption ¶ added in v0.4.2
func NewMentionableOption(name string, description string, options ...CommandOption) CommandOption
NewMentionableOption creates a new CommandOption with CommandOptionTypeUser or CommandOptionTypeRole
func NewNumberOption ¶ added in v0.5.11
func NewNumberOption(name string, description string, options ...CommandOption) CommandOption
NewNumberOption creates a new CommandOption with CommandOptionTypeNumber
func NewRoleOption ¶ added in v0.4.3
func NewRoleOption(name string, description string, options ...CommandOption) CommandOption
NewRoleOption creates a new CommandOption with CommandOptionTypeRole
func NewStringOption ¶ added in v0.4.2
func NewStringOption(name string, description string, options ...CommandOption) CommandOption
NewStringOption creates a new CommandOption with CommandOptionTypeSubCommand
func NewSubCommand ¶ added in v0.4.2
func NewSubCommand(name string, description string, options ...CommandOption) CommandOption
NewSubCommand creates a new CommandOption with CommandOptionTypeSubCommand
func NewSubCommandGroup ¶ added in v0.4.2
func NewSubCommandGroup(name string, description string, options ...CommandOption) CommandOption
NewSubCommandGroup creates a new CommandOption with CommandOptionTypeSubCommandGroup
func NewUserOption ¶ added in v0.4.2
func NewUserOption(name string, description string, options ...CommandOption) CommandOption
NewUserOption creates a new CommandOption with CommandOptionTypeSubCommand
func (CommandOption) AddChoice ¶ added in v0.4.2
func (o CommandOption) AddChoice(name string, value interface{}) CommandOption
AddChoice adds a new choice to the CommandOption. Value can either be a string, int or float
func (CommandOption) AddChoices ¶ added in v0.5.11
func (o CommandOption) AddChoices(choices map[string]interface{}) CommandOption
AddChoices adds multiple choices to the CommandOption. Value can either be a string, int or float
func (CommandOption) AddOptions ¶ added in v0.4.2
func (o CommandOption) AddOptions(options ...CommandOption) CommandOption
AddOptions adds multiple choices to the the CommandOption
func (CommandOption) SetRequired ¶ added in v0.4.2
func (o CommandOption) SetRequired(required bool) CommandOption
SetRequired sets if the CommandOption is required
type CommandOptionType ¶ added in v0.2.0
type CommandOptionType int
CommandOptionType specifies the type of the arguments used in Command.Options
const ( CommandOptionTypeSubCommand CommandOptionType = iota + 1 CommandOptionTypeSubCommandGroup CommandOptionTypeString CommandOptionTypeInteger CommandOptionTypeBoolean CommandOptionTypeUser CommandOptionTypeChannel CommandOptionTypeRole CommandOptionTypeMentionable CommandOptionTypeNumber )
Constants for each slash command option type
type CommandPermission ¶ added in v0.2.0
type CommandPermission struct {
ID Snowflake `json:"id"`
Type CommandPermissionType `json:"type"`
Permission bool `json:"permission"`
}
CommandPermission holds a User or Role and if they are allowed to use the Command
type CommandPermissionType ¶ added in v0.2.0
type CommandPermissionType int
CommandPermissionType is the type of the CommandPermission
type CommandUpdate ¶ added in v0.3.0
type CommandUpdate struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
DefaultPermission *bool `json:"default_permission,omitempty"`
Options []CommandOption `json:"options,omitempty"`
}
CommandUpdate is used to update an existing Command. all fields are optional
type Component ¶ added in v0.4.0
type Component interface {
Type() ComponentType
}
Component is a general interface each Component needs to implement
type ComponentImpl ¶ added in v0.4.0
type ComponentImpl struct {
ComponentType ComponentType `json:"type"`
}
ComponentImpl is used to embed in each different ComponentType
func (ComponentImpl) Type ¶ added in v0.4.0
func (t ComponentImpl) Type() ComponentType
Type returns the ComponentType of this Component
type ComponentInteraction ¶ added in v0.4.5
type ComponentInteraction struct {
*Interaction
Message *Message `json:"message,omitempty"`
Data *ComponentInteractionData `json:"data,omitempty"`
}
ComponentInteraction is a specific Interaction when using Component(s)
func (*ComponentInteraction) Component ¶ added in v0.4.5
func (i *ComponentInteraction) Component() Component
Component returns the Component which issued this ComponentInteraction. nil for ephemeral Message(s)
func (*ComponentInteraction) ComponentType ¶ added in v0.5.2
func (i *ComponentInteraction) ComponentType() ComponentType
ComponentType returns the ComponentType of a Component
func (*ComponentInteraction) CustomID ¶ added in v0.5.2
func (i *ComponentInteraction) CustomID() string
CustomID returns the Custom ID of the ComponentInteraction
func (*ComponentInteraction) DeferEdit ¶ added in v0.4.5
func (i *ComponentInteraction) DeferEdit() error
DeferEdit replies to the api.ComponentInteraction with api.InteractionResponseTypeDeferredUpdateMessage and cancels the loading state
func (*ComponentInteraction) Edit ¶ added in v0.4.5
func (i *ComponentInteraction) Edit(messageUpdate MessageUpdate) error
Edit replies to the api.ComponentInteraction with api.InteractionResponseTypeUpdateMessage & api.MessageUpdate which edits the original api.Message
type ComponentInteractionData ¶ added in v0.4.5
type ComponentInteractionData struct {
CustomID string `json:"custom_id"`
ComponentType ComponentType `json:"component_type"`
}
ComponentInteractionData is the Component data payload
type ComponentType ¶ added in v0.4.0
type ComponentType int
ComponentType defines different Component(s)
type CreateDMChannel ¶ added in v0.4.5
type CreateDMChannel struct {
RecipientID Snowflake `json:"recipient_id"`
}
CreateDMChannel is the payload used to create a DMChannel
type CreateGuild ¶ added in v0.4.5
type CreateGuild struct {
Name string `json:"name"`
Region string `json:"region,omitempty"`
Icon string `json:"icon,omitempty"`
VerificationLevel VerificationLevel `json:"verification_level,omitempty"`
DefaultMessageNotificationLevel MessageNotifications `json:"default_message_notification_level"`
ExplicitContentFilterLevel ExplicitContentFilterLevel `json:"explicit_content_filter_level"`
Roles []CreateRole `json:"roles,omitempty"`
Channels []interface{} `json:"channels,omitempty"`
AFKChannelID Snowflake `json:"afk_channel_id,omitempty"`
AFKTimeout int `json:"afk_timeout,omitempty"`
SystemChannelID Snowflake `json:"system_channel_id,omitempty"`
SystemChannelFlags SystemChannelFlag `json:"system_channel_flags,omitempty"`
}
CreateGuild is the payload used to create a Guild
type CreateGuildFromTemplate ¶ added in v0.5.2
type CreateGuildFromTemplate struct {
Name string `json:"name"`
ImageData []byte `json:"icon,omitempty"`
}
CreateGuildFromTemplate is the data used to create a Guild from a GuildTemplate
type CreateGuildTemplate ¶ added in v0.5.2
type CreateGuildTemplate struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
CreateGuildTemplate is the data used to create a GuildTemplate
type CreateRole ¶ added in v0.4.5
type CreateRole struct {
Name string `json:"name,omitempty"`
Permissions Permissions `json:"permissions,omitempty"`
Color int `json:"color,omitempty"`
Hoist bool `json:"hoist,omitempty"`
Mentionable bool `json:"mentionable,omitempty"`
}
CreateRole is the payload to create a Role
type DMChannel ¶
type DMChannel struct {
MessageChannel
}
DMChannel is used for interacting in private Message(s) with users
type DeconstructedSnowflake ¶
type DeconstructedSnowflake struct {
Timestamp int64
WorkerID int64
ProcessID int64
Increment int64
Binary string
}
DeconstructedSnowflake contains the properties used by Discord for each ID
type Disgo ¶
type Disgo interface {
Logger() log.Logger
Connect() error
Start()
Close()
Token() string
Gateway() Gateway
RestClient() RestClient
WebhookServer() WebhookServer
Cache() Cache
GatewayIntents() GatewayIntents
RawGatewayEventsEnabled() bool
ApplicationID() Snowflake
ClientID() Snowflake
SelfUser() *SelfUser
EntityBuilder() EntityBuilder
EventManager() EventManager
VoiceDispatchInterceptor() VoiceDispatchInterceptor
SetVoiceDispatchInterceptor(voiceInterceptor VoiceDispatchInterceptor)
AudioController() AudioController
HeartbeatLatency() time.Duration
LargeThreshold() int
HasGateway() bool
GetCommand(commandID Snowflake) (*Command, restclient.RestError)
GetCommands() ([]*Command, restclient.RestError)
CreateCommand(command CommandCreate) (*Command, restclient.RestError)
EditCommand(commandID Snowflake, command CommandUpdate) (*Command, restclient.RestError)
DeleteCommand(commandID Snowflake) restclient.RestError
SetCommands(commands ...CommandCreate) ([]*Command, restclient.RestError)
GetGuildCommand(guildID Snowflake, commandID Snowflake) (*Command, restclient.RestError)
GetGuildCommands(guildID Snowflake) ([]*Command, restclient.RestError)
CreateGuildCommand(guildID Snowflake, commandCreate CommandCreate) (*Command, restclient.RestError)
EditGuildCommand(guildID Snowflake, commandID Snowflake, commandUpdate CommandUpdate) (*Command, restclient.RestError)
DeleteGuildCommand(guildID Snowflake, commandID Snowflake) restclient.RestError
SetGuildCommands(guildID Snowflake, commandCreates ...CommandCreate) ([]*Command, restclient.RestError)
GetGuildCommandsPermissions(guildID Snowflake) ([]*GuildCommandPermissions, restclient.RestError)
GetGuildCommandPermissions(guildID Snowflake, commandID Snowflake) (*GuildCommandPermissions, restclient.RestError)
SetGuildCommandsPermissions(guildID Snowflake, commandPermissions ...SetGuildCommandPermissions) ([]*GuildCommandPermissions, restclient.RestError)
SetGuildCommandPermissions(guildID Snowflake, commandID Snowflake, permissions SetGuildCommandPermissions) (*GuildCommandPermissions, restclient.RestError)
GetTemplate(code string) (*GuildTemplate, restclient.RestError)
CreateGuildFromTemplate(templateCode string, createGuildFromTemplate CreateGuildFromTemplate) (*Guild, restclient.RestError)
}
Disgo is the main discord interface
type DisgoBuilder ¶
type DisgoBuilder interface {
SetLogger(level log.Logger) DisgoBuilder
SetToken(token string) DisgoBuilder
SetHTTPClient(httpClient *http.Client) DisgoBuilder
SetGatewayIntents(GatewayIntents ...GatewayIntents) DisgoBuilder
SetRawGatewayEventsEnabled(enabled bool) DisgoBuilder
SetVoiceDispatchInterceptor(voiceDispatchInterceptor VoiceDispatchInterceptor) DisgoBuilder
SetEntityBuilder(entityBuilder EntityBuilder) DisgoBuilder
SetEventManager(eventManager EventManager) DisgoBuilder
AddEventListeners(eventsListeners ...EventListener) DisgoBuilder
SetWebhookServer(webhookServer WebhookServer) DisgoBuilder
SetWebhookServerProperties(listenURL string, listenPort int, publicKey string) DisgoBuilder
SetRestClient(restClient RestClient) DisgoBuilder
SetCache(cache Cache) DisgoBuilder
SetMemberCachePolicy(memberCachePolicy MemberCachePolicy) DisgoBuilder
SetMessageCachePolicy(messageCachePolicy MessageCachePolicy) DisgoBuilder
SetCacheFlags(cacheFlags ...CacheFlags) DisgoBuilder
EnableCacheFlags(cacheFlags ...CacheFlags) DisgoBuilder
DisableCacheFlags(cacheFlags ...CacheFlags) DisgoBuilder
SetGateway(gateway Gateway) DisgoBuilder
Build() (Disgo, error)
}
DisgoBuilder allows you to create a Disgo client through a series of methods
type Embed ¶
type Embed struct {
Title *string `json:"title,omitempty"`
Type *EmbedType `json:"type,omitempty"`
Description *string `json:"description,omitempty"`
URL *string `json:"url,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
Color *int `json:"color,omitempty"`
Image *EmbedResource `json:"image,omitempty"`
Thumbnail *EmbedResource `json:"thumbnail,omitempty"`
Video *EmbedResource `json:"video,omitempty"`
Provider *EmbedProvider `json:"provider,omitempty"`
Author *EmbedAuthor `json:"author,omitempty"`
Fields []*EmbedField `json:"fields,omitempty"`
}
Embed allows you to send embeds to discord
type EmbedAuthor ¶
type EmbedAuthor struct {
Name *string `json:"name,omitempty"`
URL *string `json:"url,omitempty"`
IconURL *string `json:"icon_url,omitempty"`
ProxyIconURL *string `json:"proxy_icon_url,omitempty"`
}
The EmbedAuthor of an Embed
type EmbedBuilder ¶
type EmbedBuilder struct {
Embed
}
EmbedBuilder allows you to create embeds and use methods to set values
func NewEmbedBuilder ¶
func NewEmbedBuilder() *EmbedBuilder
NewEmbedBuilder returns a new embed builder
func (*EmbedBuilder) AddField ¶
func (b *EmbedBuilder) AddField(name string, value string, inline bool) *EmbedBuilder
AddField adds a field to the EmbedBuilder by name and value
func (*EmbedBuilder) AddFields ¶
func (b *EmbedBuilder) AddFields(field *EmbedField, fields ...*EmbedField) *EmbedBuilder
AddFields adds multiple fields to the EmbedBuilder
func (*EmbedBuilder) ClearFields ¶
func (b *EmbedBuilder) ClearFields() *EmbedBuilder
ClearFields removes all of the fields from the EmbedBuilder
func (*EmbedBuilder) RemoveField ¶
func (b *EmbedBuilder) RemoveField(i int) *EmbedBuilder
RemoveField removes a field from the EmbedBuilder
func (*EmbedBuilder) SetAuthor ¶
func (b *EmbedBuilder) SetAuthor(name string, url string, iconURL string) *EmbedBuilder
SetAuthor sets the author of the EmbedBuilder without an Icon URL
func (*EmbedBuilder) SetAuthorIcon ¶ added in v0.3.0
func (b *EmbedBuilder) SetAuthorIcon(iconURL string) *EmbedBuilder
SetAuthorIcon sets the author of the EmbedBuilder with all properties
func (*EmbedBuilder) SetAuthorName ¶ added in v0.3.0
func (b *EmbedBuilder) SetAuthorName(name string) *EmbedBuilder
SetAuthorName sets the author of the EmbedBuilder
func (*EmbedBuilder) SetAuthorURL ¶ added in v0.3.0
func (b *EmbedBuilder) SetAuthorURL(url string) *EmbedBuilder
SetAuthorURL sets the author of the EmbedBuilder with an URL
func (*EmbedBuilder) SetColor ¶
func (b *EmbedBuilder) SetColor(color int) *EmbedBuilder
SetColor sets the color of the EmbedBuilder
func (*EmbedBuilder) SetDescription ¶
func (b *EmbedBuilder) SetDescription(description string) *EmbedBuilder
SetDescription sets the description of the EmbedBuilder
func (*EmbedBuilder) SetDescriptionf ¶
func (b *EmbedBuilder) SetDescriptionf(description string, a ...interface{}) *EmbedBuilder
SetDescriptionf sets the description of the EmbedBuilder with format
func (*EmbedBuilder) SetEmbedAuthor ¶ added in v0.2.0
func (b *EmbedBuilder) SetEmbedAuthor(author *EmbedAuthor) *EmbedBuilder
SetEmbedAuthor sets the author of the EmbedBuilder using an EmbedAuthor struct
func (*EmbedBuilder) SetEmbedFooter ¶ added in v0.3.0
func (b *EmbedBuilder) SetEmbedFooter(footer *EmbedFooter) *EmbedBuilder
SetEmbedFooter sets the footer of the EmbedBuilder
func (*EmbedBuilder) SetField ¶ added in v0.2.0
func (b *EmbedBuilder) SetField(i int, name string, value string, inline bool) *EmbedBuilder
SetField sets a field to the EmbedBuilder by name and value
func (*EmbedBuilder) SetFields ¶
func (b *EmbedBuilder) SetFields(fields ...*EmbedField) *EmbedBuilder
SetFields sets fields of the EmbedBuilder
func (*EmbedBuilder) SetFooter ¶
func (b *EmbedBuilder) SetFooter(text string, iconURL string) *EmbedBuilder
SetFooter sets the footer of the EmbedBuilder
func (*EmbedBuilder) SetFooterIcon ¶ added in v0.3.0
func (b *EmbedBuilder) SetFooterIcon(iconURL string) *EmbedBuilder
SetFooterIcon sets the footer of the EmbedBuilder by iconURL
func (*EmbedBuilder) SetFooterText ¶ added in v0.3.0
func (b *EmbedBuilder) SetFooterText(text string) *EmbedBuilder
SetFooterText sets the footer of the EmbedBuilder by text
func (*EmbedBuilder) SetImage ¶
func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder
SetImage sets the image of the EmbedBuilder
func (*EmbedBuilder) SetThumbnail ¶
func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder
SetThumbnail sets the thumbnail of the EmbedBuilder
func (*EmbedBuilder) SetTitle ¶
func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder
SetTitle sets the title of the EmbedBuilder
func (*EmbedBuilder) SetTitlef ¶ added in v0.3.0
func (b *EmbedBuilder) SetTitlef(title string, a ...interface{}) *EmbedBuilder
SetTitlef sets the title of the EmbedBuilder with format
func (*EmbedBuilder) SetURL ¶
func (b *EmbedBuilder) SetURL(url string) *EmbedBuilder
SetURL sets the URL of the EmbedBuilder
type EmbedField ¶
type EmbedField struct {
Name string `json:"name"`
Value string `json:"value"`
Inline *bool `json:"inline,omitempty"`
}
EmbedField (s) of an Embed
type EmbedProvider ¶
type EmbedProvider struct {
Name *string `json:"name,omitempty"`
URL *string `json:"url,omitempty"`
}
The EmbedProvider of an Embed
type EmbedResource ¶
type EmbedResource struct {
URL *string `json:"url,omitempty"`
ProxyURL *string `json:"proxy_url,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
}
The EmbedResource of an Embed.Image/Embed.Thumbnail/Embed.Video
type Emoji ¶ added in v0.4.3
type Emoji struct {
Disgo Disgo `json:"-"`
GuildID Snowflake `json:"guild_id,omitempty"`
Name string `json:"name,omitempty"`
ID Snowflake `json:"id,omitempty"`
Animated bool `json:"animated,omitempty"`
}
Emoji allows you to interact with emojis & emotes
type EntityBuilder ¶ added in v0.2.0
type EntityBuilder interface {
Disgo() Disgo
CreateInteraction(fullInteraction *FullInteraction, c chan InteractionResponse, updateCache CacheStrategy) *Interaction
CreateCommandInteraction(fullInteraction *FullInteraction, interaction *Interaction, updateCache CacheStrategy) *CommandInteraction
CreateComponentInteraction(fullInteraction *FullInteraction, interaction *Interaction, updateCache CacheStrategy) *ComponentInteraction
CreateButtonInteraction(fullInteraction *FullInteraction, componentInteraction *ComponentInteraction) *ButtonInteraction
CreateSelectMenuInteraction(fullInteraction *FullInteraction, componentInteraction *ComponentInteraction) *SelectMenuInteraction
CreateGlobalCommand(command *Command, updateCache CacheStrategy) *Command
CreateUser(user *User, updateCache CacheStrategy) *User
CreateMessage(message *Message, updateCache CacheStrategy) *Message
CreateGuildTemplate(guildTemplate *GuildTemplate, updateCache CacheStrategy) *GuildTemplate
CreateGuild(fullGuild *FullGuild, updateCache CacheStrategy) *Guild
CreateMember(guildID Snowflake, member *Member, updateCache CacheStrategy) *Member
CreateGuildCommand(guildID Snowflake, command *Command, updateCache CacheStrategy) *Command
CreateGuildCommandPermissions(guildCommandPermissions *GuildCommandPermissions, updateCache CacheStrategy) *GuildCommandPermissions
CreateRole(guildID Snowflake, role *Role, updateCache CacheStrategy) *Role
CreateVoiceState(guildID Snowflake, voiceState *VoiceState, updateCache CacheStrategy) *VoiceState
CreateAuditLog(guildID Snowflake, auditLogFilterOptions AuditLogFilterOptions, auditLog *AuditLog, updateCache CacheStrategy) *AuditLog
CreateIntegration(guildID Snowflake, integration *Integration, updateCache CacheStrategy) *Integration
CreateTextChannel(channel *Channel, updateCache CacheStrategy) *TextChannel
CreateVoiceChannel(channel *Channel, updateCache CacheStrategy) *VoiceChannel
CreateStoreChannel(channel *Channel, updateCache CacheStrategy) *StoreChannel
CreateCategory(channel *Channel, updateCache CacheStrategy) *Category
CreateDMChannel(channel *Channel, updateCache CacheStrategy) *DMChannel
CreateEmoji(guildID Snowflake, emoji *Emoji, updateCache CacheStrategy) *Emoji
}
EntityBuilder is used to create structs for disgo's cache
type ErrorResponse ¶
ErrorResponse contains custom errors from discord
type EventHandler ¶
type EventHandler interface {
Event() GatewayEventType
New() interface{}
}
EventHandler provides info about the EventHandler
type EventListener ¶
type EventListener interface {
OnEvent(event interface{})
}
EventListener is used to create new EventListener to listen to events
type EventManager ¶
type EventManager interface {
Disgo() Disgo
Close()
AddEventListeners(eventListeners ...EventListener)
Handle(eventType GatewayEventType, replyChannel chan InteractionResponse, sequenceNumber int, payload json.RawMessage)
Dispatch(event Event)
}
EventManager lets you listen for specific events triggered by raw gateway events
type ExpandedInvite ¶ added in v0.2.0
type ExpandedInvite struct {
*Invite
Uses int `json:"uses"`
MaxUses int `json:"max_uses"`
MaxAge int `json:"max_age"`
Temporary bool `json:"temporary"`
CreatedAt time.Time `json:"created_at"`
}
ExpandedInvite is a full Invite struct
type ExplicitContentFilterLevel ¶
type ExplicitContentFilterLevel int
The ExplicitContentFilterLevel of a Guild
const ( ExplicitContentFilterLevelDisabled ExplicitContentFilterLevel = iota ExplicitContentFilterLevelMembersWithoutRoles ExplicitContentFilterLevelAllMembers )
Constants for ExplicitContentFilterLevel
type FullGuild ¶ added in v0.2.0
type FullGuild struct {
*Guild
Roles []*Role `json:"roles"`
Emojis []*Emoji `json:"emojis"`
Members []*Member `json:"members"`
Channels []*Channel `json:"channels"`
VoiceStates []*VoiceState `json:"voice_states"`
}
FullGuild represents a Guild objects sent by discord with the GatewayEventGuildCreate
type FullInteraction ¶ added in v0.4.0
type FullInteraction struct {
ID Snowflake `json:"id"`
Type InteractionType `json:"type"`
GuildID *Snowflake `json:"guild_id,omitempty"`
ChannelID *Snowflake `json:"channel_id,omitempty"`
Message *Message `json:"message,omitempty"`
Member *Member `json:"member,omitempty"`
User *User `json:"User,omitempty"`
Token string `json:"token"`
Version int `json:"version"`
Data json.RawMessage `json:"data,omitempty"`
}
FullInteraction is used for easier unmarshalling of different Interaction(s)
type Gateway ¶
type Gateway interface {
Disgo() Disgo
Open() error
Status() GatewayStatus
Send(command GatewayCommand) error
Close()
Conn() *websocket.Conn
Latency() time.Duration
}
Gateway is what is used to connect to discord
type GatewayBotRs ¶
type GatewayBotRs struct {
URL string `json:"url"`
Shards int `json:"shards"`
SessionStartLimit struct {
Total int `json:"total"`
Remaining int `json:"remaining"`
ResetAfter int `json:"reset_after"`
MaxConcurrency int `json:"max_concurrency"`
} `json:"session_start_limit"`
}
GatewayBotRs contains the response for GET /gateway/bot
type GatewayCommand ¶
type GatewayCommand struct {
GatewayPacket
D interface{} `json:"d"`
}
GatewayCommand object is used when sending data to discord's websocket, it's recommended that you don't use these
func NewGatewayCommand ¶ added in v0.2.0
func NewGatewayCommand(op GatewayOp, d interface{}) GatewayCommand
NewGatewayCommand returns a new GatewayCommand struct with the given payload
type GatewayEventHandler ¶
type GatewayEventHandler interface {
EventHandler
HandleGatewayEvent(disgo Disgo, eventManager EventManager, sequenceNumber int, payload interface{})
}
GatewayEventHandler is used to handle raw gateway events
type GatewayEventType ¶ added in v0.2.0
type GatewayEventType string
GatewayEventType wraps all GatewayEventType types
const ( GatewayEventHello GatewayEventType = "HELLO" GatewayEventReady GatewayEventType = "READY" GatewayEventResumed GatewayEventType = "RESUMED" GatewayEventReconnect GatewayEventType = "RECONNECT" GatewayEventInvalidSession GatewayEventType = "INVALID_SESSION" GatewayEventCommandCreate GatewayEventType = "APPLICATION_COMMAND_CREATE" GatewayEventCommandUpdate GatewayEventType = "APPLICATION_COMMAND_UPDATE" GatewayEventCommandDelete GatewayEventType = "APPLICATION_COMMAND_DELETE" GatewayEventChannelCreate GatewayEventType = "CHANNEL_CREATE" GatewayEventChannelUpdate GatewayEventType = "CHANNEL_UPDATE" GatewayEventChannelDelete GatewayEventType = "CHANNEL_DELETE" GatewayEventChannelPinsUpdate GatewayEventType = "CHANNEL_PINS_UPDATE" GatewayEventGuildCreate GatewayEventType = "GUILD_CREATE" GatewayEventGuildUpdate GatewayEventType = "GUILD_UPDATE" GatewayEventGuildDelete GatewayEventType = "GUILD_DELETE" GatewayEventGuildBanAdd GatewayEventType = "GUILD_BAN_ADD" GatewayEventGuildBanRemove GatewayEventType = "GUILD_BAN_REMOVE" GatewayEventGuildEmojisUpdate GatewayEventType = "GUILD_EMOJIS_UPDATE" GatewayEventGuildIntegrationsUpdate GatewayEventType = "GUILD_INTEGRATIONS_UPDATE" GatewayEventGuildMemberAdd GatewayEventType = "GUILD_MEMBER_ADD" GatewayEventGuildMemberRemove GatewayEventType = "GUILD_MEMBER_REMOVE" GatewayEventGuildMemberUpdate GatewayEventType = "GUILD_MEMBER_UPDATE" GatewayEventGuildMembersChunk GatewayEventType = "GUILD_MEMBERS_CHUNK" GatewayEventGuildRoleCreate GatewayEventType = "GUILD_ROLE_CREATE" GatewayEventGuildRoleUpdate GatewayEventType = "GUILD_ROLE_UPDATE" GatewayEventGuildRoleDelete GatewayEventType = "GUILD_ROLE_DELETE" GatewayEventIntegrationCreate GatewayEventType = "INTEGRATION_CREATE" GatewayEventIntegrationUpdate GatewayEventType = "INTEGRATION_UPDATE" GatewayEventIntegrationDelete GatewayEventType = "INTEGRATION_DELETE" GatewayEventInteractionCreate GatewayEventType = "INTERACTION_CREATE" WebhookEventInteractionCreate GatewayEventType = "WEBHOOK_INTERACTION_CREATE" GatewayEventInviteCreate GatewayEventType = "INVITE_CREATE" GatewayEventInviteDelete GatewayEventType = "INVITE_DELETE" GatewayEventMessageCreate GatewayEventType = "MESSAGE_CREATE" GatewayEventMessageUpdate GatewayEventType = "MESSAGE_UPDATE" GatewayEventMessageDelete GatewayEventType = "MESSAGE_DELETE" GatewayEventMessageDeleteBulk GatewayEventType = "MESSAGE_DELETE_BULK" GatewayEventMessageReactionAdd GatewayEventType = "MESSAGE_REACTION_ADD" GatewayEventMessageReactionRemove GatewayEventType = "MESSAGE_REACTION_REMOVE" GatewayEventMessageReactionRemoveAll GatewayEventType = "MESSAGE_REACTION_REMOVE_ALL" GatewayEventMessageReactionRemoveAllEmoji GatewayEventType = "MESSAGE_REACTION_REMOVE_ALL_EMOJI" GatewayEventPresenceUpdate GatewayEventType = "PRESENCE_UPDATE" GatewayEventTypingStart GatewayEventType = "TYPING_START" GatewayEventUserUpdate GatewayEventType = "USER_UPDATE" GatewayEventVoiceStateUpdate GatewayEventType = "VOICE_STATE_UPDATE" GatewayEventVoiceServerUpdate GatewayEventType = "VOICE_SERVER_UPDATE" GatewayEventWebhooksUpdate GatewayEventType = "WEBHOOKS_UPDATE" )
Constants for the gateway events
type GatewayIntents ¶ added in v0.3.3
type GatewayIntents int64
GatewayIntents is an extension of the Bit structure used when identifying with discord
const ( GatewayIntentGuilds GatewayIntents = 1 << iota GatewayIntentGuildMembers GatewayIntentGuildBans GatewayIntentGuildEmojis GatewayIntentGuildIntegrations GatewayIntentGuildWebhooks GatewayIntentGuildInvites GatewayIntentGuildVoiceStates GatewayIntentGuildPresences GatewayIntentGuildMessages GatewayIntentGuildMessageReactions GatewayIntentGuildMessageTyping GatewayIntentDirectMessages GatewayIntentDirectMessageReactions GatewayIntentDirectMessageTyping GatewayIntentsNonPrivileged = GatewayIntentGuilds | GatewayIntentGuildBans | GatewayIntentGuildEmojis | GatewayIntentGuildIntegrations | GatewayIntentGuildWebhooks | GatewayIntentGuildInvites | GatewayIntentGuildVoiceStates | GatewayIntentGuildMessages | GatewayIntentGuildMessageReactions | GatewayIntentGuildMessageTyping | GatewayIntentDirectMessages | GatewayIntentDirectMessageReactions | GatewayIntentDirectMessageTyping GatewayIntentsPrivileged = GatewayIntentGuildMembers | GatewayIntentGuildPresences GatewayIntentsAll = GatewayIntentsNonPrivileged | GatewayIntentsPrivileged GatewayIntentsNone GatewayIntents = 0 )
Constants for the different bit offsets of GatewayIntents
func (GatewayIntents) Add ¶ added in v0.3.3
func (p GatewayIntents) Add(bits ...GatewayIntents) GatewayIntents
Add allows you to add multiple bits together, producing a new bit
func (GatewayIntents) Has ¶ added in v0.3.3
func (p GatewayIntents) Has(bit GatewayIntents) bool
Has will check whether the Bit contains another bit
func (GatewayIntents) HasAll ¶ added in v0.3.3
func (p GatewayIntents) HasAll(bits ...GatewayIntents) bool
HasAll will ensure that the bit includes all of the bits entered
func (GatewayIntents) Missing ¶ added in v0.3.3
func (p GatewayIntents) Missing(bit GatewayIntents) bool
Missing will do the inverse of Bit.Has
func (GatewayIntents) MissingAny ¶ added in v0.3.3
func (p GatewayIntents) MissingAny(bits ...GatewayIntents) bool
MissingAny will check whether the bit is missing any one of the bits
func (GatewayIntents) Remove ¶ added in v0.3.3
func (p GatewayIntents) Remove(bits ...GatewayIntents) GatewayIntents
Remove allows you to subtract multiple bits from the first, producing a new bit
type GatewayPacket ¶ added in v0.2.0
type GatewayPacket struct {
Op GatewayOp `json:"op"`
S *int `json:"s,omitempty"`
T *GatewayEventType `json:"t,omitempty"`
}
GatewayPacket raw GatewayEvent type
type GatewayRs ¶
type GatewayRs struct {
URL string `json:"url"`
}
GatewayRs contains the response for GET /gateway
type GatewayStatus ¶ added in v0.2.0
type GatewayStatus int
GatewayStatus is the state that the client is currently in
const ( GatewayStatusUnconnected GatewayStatus = iota GatewayStatusConnecting GatewayStatusReconnecting GatewayStatusIdentifying GatewayStatusWaitingForHello GatewayStatusWaitingForReady GatewayStatusWaitingForGuilds GatewayStatusReady GatewayStatusDisconnected GatewayStatusResuming )
Indicates how far along the client is to connecting
func (GatewayStatus) IsConnected ¶ added in v0.4.5
func (s GatewayStatus) IsConnected() bool
IsConnected returns weather you can send payloads to the Gateway
type Guild ¶
type Guild struct {
Disgo Disgo `json:"-"`
Ready bool `json:"-"`
ID Snowflake `json:"id"`
Name string `json:"name"`
Icon *string `json:"icon"`
Region string `json:"region"`
OwnerID Snowflake `json:"owner_id"`
JoinedAt *time.Time `json:"joined_at"`
DiscoverySplash *string `json:"discovery_splash"`
Splash *string `json:"splash"`
AfkChannelID *Snowflake `json:"afk_channel_id"`
AfkTimeout int `json:"afk_timeout"`
MemberCount *int `json:"member_count"`
VerificationLevel VerificationLevel `json:"verification_level"`
Large *bool `json:"large"`
DefaultMessageNotifications MessageNotifications `json:"default_message_notifications"`
MaxPresences *int `json:"max_presences"`
MaxMembers *int `json:"max_members"`
ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"`
Features []GuildFeature `json:"features"`
MfaLevel MFALevel `json:"mfa_level"`
ApplicationID Snowflake `json:"application_id"`
WidgetEnabled bool `json:"widget_enabled"`
WidgetChannelID Snowflake `json:"widget_channel_id"`
SystemChannelID Snowflake `json:"system_channel_id"`
SystemChannelFlags SystemChannelFlag `json:"system_channel_flags"`
RulesChannelID Snowflake `json:"rules_channel_id"`
VanityURLCode *string `json:"vanity_url_code"`
Description *string `json:"description"`
Banner *string `json:"banner"`
PremiumTier PremiumTier `json:"premium_tier"`
PremiumSubscriptionCount *int `json:"premium_subscription_count"`
PreferredLocale string `json:"preferred_locale"`
PublicUpdatesChannelID *Snowflake `json:"public_updates_channel_id"`
MaxVideoChannelUsers *int `json:"max_video_channel_users"`
ApproximateMemberCount *int `json:"approximate_member_count"`
ApproximatePresenceCount *int `json:"approximate_presence_count"`
WelcomeScreen *GuildWelcomeScreen `json:"welcome_screen"`
}
Guild represents a discord Guild
func (*Guild) BanMember ¶ added in v0.5.4
func (g *Guild) BanMember(userID Snowflake, reason string, deleteMessageDays int) restclient.RestError
BanMember bans a Member from the Guild
func (*Guild) CreateCommand ¶
func (g *Guild) CreateCommand(command CommandCreate) (*Command, restclient.RestError)
CreateCommand creates a new Command for this Guild
func (*Guild) CreateRole ¶
func (g *Guild) CreateRole(createRole CreateRole) (*Role, restclient.RestError)
CreateRole allows you to create a new Role
func (*Guild) CreateTemplate ¶ added in v0.5.2
func (g *Guild) CreateTemplate(createGuildTemplate CreateGuildTemplate) (*GuildTemplate, restclient.RestError)
CreateTemplate creates a new GuildTemplate
func (*Guild) Delete ¶ added in v0.4.5
func (g *Guild) Delete() restclient.RestError
Delete deletes the current Guild
func (*Guild) DeleteCommand ¶
func (g *Guild) DeleteCommand(commandID Snowflake) restclient.RestError
DeleteCommand creates a new Command for this Guild
func (*Guild) DeleteIntegration ¶ added in v0.5.6
func (g *Guild) DeleteIntegration(integrationID Snowflake) restclient.RestError
DeleteIntegration deletes a specific Integration from the Guild. Requires PermissionManageServer
func (*Guild) DeleteRole ¶ added in v0.4.5
func (g *Guild) DeleteRole(roleID Snowflake) restclient.RestError
DeleteRole allows you to delete a Role
func (*Guild) DeleteTemplate ¶ added in v0.5.2
func (g *Guild) DeleteTemplate(code string) (*GuildTemplate, restclient.RestError)
DeleteTemplate deletes a specific GuildTemplate
func (*Guild) Disconnect ¶ added in v0.2.0
Disconnect sends an api.GatewayCommand to disconnect from this Guild
func (*Guild) EditCommand ¶
func (g *Guild) EditCommand(commandID Snowflake, command CommandUpdate) (*Command, restclient.RestError)
EditCommand edits a specific Guild Command
func (*Guild) GetAuditLogs ¶ added in v0.5.6
func (g *Guild) GetAuditLogs(userID Snowflake, actionType AuditLogEvent, before Snowflake, limit int) (*AuditLog, restclient.RestError)
GetAuditLogs gets AuditLog(s) for this Guild
func (*Guild) GetBan ¶ added in v0.5.4
func (g *Guild) GetBan(userID Snowflake) (*Ban, restclient.RestError)
GetBan fetches a ban for a User for this Guild
func (*Guild) GetBans ¶ added in v0.5.4
func (g *Guild) GetBans() ([]Ban, restclient.RestError)
GetBans fetches all bans for this Guild
func (*Guild) GetCommand ¶
func (g *Guild) GetCommand(commandID Snowflake) (*Command, restclient.RestError)
GetCommand fetches a specific Guild Command
func (*Guild) GetCommandPermissions ¶ added in v0.2.0
func (g *Guild) GetCommandPermissions(commandID Snowflake) (*GuildCommandPermissions, restclient.RestError)
GetCommandPermissions returns the GuildCommandPermissions for a specific Command in a Guild
func (*Guild) GetCommands ¶
func (g *Guild) GetCommands() ([]*Command, restclient.RestError)
GetCommands fetches all Guild Command(s)
func (*Guild) GetCommandsPermissions ¶ added in v0.2.0
func (g *Guild) GetCommandsPermissions() ([]*GuildCommandPermissions, restclient.RestError)
GetCommandsPermissions returns the GuildCommandPermissions for a all Command(s) in a Guild
func (*Guild) GetIntegrations ¶ added in v0.5.6
func (g *Guild) GetIntegrations() ([]*Integration, restclient.RestError)
GetIntegrations gets all Integration(s) from the Guild. Requires PermissionManageServer
func (*Guild) GetMember ¶ added in v0.4.5
GetMember returns the Member for the current logged in User for this Guild
func (*Guild) GetTemplates ¶ added in v0.5.2
func (g *Guild) GetTemplates() ([]*GuildTemplate, restclient.RestError)
GetTemplates gets a specific GuildTemplate
func (*Guild) KickMember ¶ added in v0.4.5
func (g *Guild) KickMember(userID Snowflake, reason string) restclient.RestError
KickMember kicks an existing member from the Guild
func (*Guild) Leave ¶ added in v0.4.5
func (g *Guild) Leave() restclient.RestError
Leave leaves the Guild
func (*Guild) PublicRole ¶ added in v0.4.5
PublicRole returns the @everyone Role
func (*Guild) SelfMember ¶ added in v0.4.5
SelfMember returns the Member for the current logged-in User for this Guild
func (*Guild) SetCommandPermissions ¶ added in v0.2.0
func (g *Guild) SetCommandPermissions(commandID Snowflake, permissions SetGuildCommandPermissions) (*GuildCommandPermissions, error)
SetCommandPermissions sets the GuildCommandPermissions for a specific Command
func (*Guild) SetCommands ¶
func (g *Guild) SetCommands(commands ...CommandCreate) ([]*Command, restclient.RestError)
SetCommands overrides all Command(s) for this Guild
func (*Guild) SetCommandsPermissions ¶ added in v0.2.0
func (g *Guild) SetCommandsPermissions(commandPermissions ...SetGuildCommandPermissions) ([]*GuildCommandPermissions, error)
SetCommandsPermissions sets the GuildCommandPermissions for a all Command(s)
func (*Guild) SyncTemplate ¶ added in v0.5.2
func (g *Guild) SyncTemplate(code string) (*GuildTemplate, restclient.RestError)
SyncTemplate syncs the current Guild status to an existing GuildTemplate
func (*Guild) UnbanMember ¶ added in v0.5.4
func (g *Guild) UnbanMember(userID Snowflake) restclient.RestError
UnbanMember unbans a Member from the Guild
func (*Guild) Update ¶ added in v0.4.5
func (g *Guild) Update(updateGuild UpdateGuild) (*Guild, restclient.RestError)
Update updates the current Guild
func (*Guild) UpdateMember ¶ added in v0.4.5
func (g *Guild) UpdateMember(userID Snowflake, updateMember UpdateMember) (*Member, restclient.RestError)
UpdateMember updates an existing member of the Guild
func (*Guild) UpdateRole ¶ added in v0.4.5
func (g *Guild) UpdateRole(roleID Snowflake, role UpdateRole) (*Role, restclient.RestError)
UpdateRole allows you to update a Role
func (*Guild) UpdateTemplate ¶ added in v0.5.2
func (g *Guild) UpdateTemplate(code string, updateGuildTemplate UpdateGuildTemplate) (*GuildTemplate, restclient.RestError)
UpdateTemplate updates a specific GuildTemplate
type GuildChannel ¶
type GuildChannel struct {
Channel
}
GuildChannel is a generic type for all server channels
type GuildCommandPermissions ¶ added in v0.2.0
type GuildCommandPermissions struct {
Disgo Disgo `json:"-"`
ID Snowflake `json:"id"`
ApplicationID Snowflake `json:"application_id"`
GuildID Snowflake `json:"guild_id"`
Permissions []CommandPermission `json:"permissions"`
}
GuildCommandPermissions holds all permissions for a Command
type GuildFeature ¶
type GuildFeature string
The GuildFeature (s) that a Guild contains
const ( GuildFeatureInviteSplash GuildFeature = "INVITE_SPLASH" GuildFeatureVipRegions GuildFeature = "VIP_REGIONS" GuildFeatureVanityURL GuildFeature = "VANITY_URL" GuildFeatureVERIFIED GuildFeature = "VERIFIED" GuildFeaturePARTNERED GuildFeature = "PARTNERED" GuildFeatureCOMMUNITY GuildFeature = "COMMUNITY" GuildFeatureCOMMERCE GuildFeature = "COMMERCE" GuildFeatureNews GuildFeature = "NEWS" GuildFeatureDiscoverable GuildFeature = "DISCOVERABLE" GuildFeatureFeaturable GuildFeature = "FEATURABLE" GuildFeatureAnimatedIcon GuildFeature = "ANIMATED_ICON" GuildFeatureBANNER GuildFeature = "BANNER" GuildFeatureWelcomeScreenEnabled GuildFeature = "WELCOME_SCREEN_ENABLED" GuildFeatureMemberVerificationGateEnabled GuildFeature = "MEMBER_VERIFICATION_GATE_ENABLED" GuildFeaturePreviewEnabled GuildFeature = "PREVIEW_ENABLED" )
Constants for GuildFeature
type GuildPreview ¶ added in v0.2.0
type GuildPreview struct {
ID Snowflake `json:"id"`
Name string `json:"name"`
Icon *string `json:"icon"`
DiscoverySplash *string `json:"discovery_splash"`
Splash *string `json:"splash"`
Features []GuildFeature `json:"features"`
Description *string `json:"description"`
ApproximateMemberCount *int `json:"approximate_member_count"`
ApproximatePresenceCount *int `json:"approximate_presence_count"`
Emojis []*Emoji `json:"emojis"`
}
GuildPreview is used for previewing public Guild(s) before joining them
type GuildTemplate ¶ added in v0.5.2
type GuildTemplate struct {
Disgo Disgo `json:"-"`
Code string `json:"code"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
UsageCount int `json:"usage_count"`
CreatorID Snowflake `json:"creator_id"`
Creator *User `json:"creator"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
GuildID Snowflake `json:"source_guild_id"`
PartialGuild PartialGuild `json:"serialized_source_guild"`
IsDirty bool `json:"is_dirty,omitempty"`
}
GuildTemplate is a template used for copying guilds https://discord.com/developers/docs/resources/guild-template
func (*GuildTemplate) Delete ¶ added in v0.5.2
func (t *GuildTemplate) Delete() (*GuildTemplate, restclient.RestError)
Delete deletes the GuildTemplate
func (*GuildTemplate) Guild ¶ added in v0.5.2
func (t *GuildTemplate) Guild() *Guild
Guild returns the full Guild of the GuildTemplate if in cache
func (*GuildTemplate) Update ¶ added in v0.5.2
func (t *GuildTemplate) Update(updateGuildTemplate UpdateGuildTemplate) (*GuildTemplate, restclient.RestError)
Update updates the GuildTemplate with the provided UpdateGuildTemplate
type GuildWelcomeChannel ¶ added in v0.2.0
type GuildWelcomeChannel struct {
ChannelID Snowflake `json:"channel_id"`
Description string `json:"description"`
EmojiID *Snowflake `json:"emoji_id,omitempty"`
EmojiName *string `json:"emoji_name,omitempty"`
}
GuildWelcomeChannel is one of the channels in a GuildWelcomeScreen
type GuildWelcomeScreen ¶ added in v0.2.0
type GuildWelcomeScreen struct {
Description *string `json:"description,omitempty"`
WelcomeChannels []*GuildWelcomeChannel `json:"welcome_channels"`
}
GuildWelcomeScreen is the Welcome Screen of a Guild
type HeartbeatCommand ¶
type HeartbeatCommand struct {
D *int `json:"d"`
}
HeartbeatCommand is used to ensure the websocket connection remains open, and disconnect if not.
type HelloGatewayEventData ¶ added in v0.2.0
HelloGatewayEventData is sent when we connect to the gateway
type IdentifyCommand ¶
type IdentifyCommand struct {
Token string `json:"token"`
Properties IdentifyCommandDataProperties `json:"properties"`
Compress bool `json:"compress,omitempty"`
LargeThreshold int `json:"large_threshold,omitempty"`
GatewayIntents GatewayIntents `json:"intents"`
}
IdentifyCommand is the data used in IdentifyCommand
type IdentifyCommandDataProperties ¶
type IdentifyCommandDataProperties struct {
OS string `json:"$os"` // user OS
Browser string `json:"$browser"` // library name
Device string `json:"$device"` // library name
}
IdentifyCommandDataProperties is used for specifying to discord which library and OS the bot is using, is automatically handled by the library and should rarely be used.
type Integration ¶ added in v0.5.3
type Integration struct {
Disgo Disgo `json:"-"`
GuildID Snowflake `json:"-"`
ID Snowflake `json:"id"`
Name string `json:"name"`
Type IntegrationType `json:"type"`
Enabled bool `json:"enabled"`
Syncing *bool `json:"syncing"`
RoleID *Snowflake `json:"role_id"`
EnableEmoticons *bool `json:"enable_emoticons"`
ExpireBehavior *int `json:"expire_behavior"`
ExpireGracePeriod *int `json:"expire_grace_period"`
User *User `json:"user"`
Account IntegrationAccount `json:"account"`
SyncedAt *string `json:"synced_at"`
SubscriberCount *int `json:"subscriber_account"`
Revoked *bool `json:"revoked"`
Application *IntegrationApplication `json:"application"`
}
Integration (https://discord.com/developers/docs/resources/guild#integration-object)
func (*Integration) Delete ¶ added in v0.5.6
func (i *Integration) Delete() restclient.RestError
Delete deletes the Integration from the Guild
func (*Integration) Guild ¶ added in v0.5.6
func (i *Integration) Guild() *Guild
Guild returns the Guild the Integration belongs to
func (*Integration) Member ¶ added in v0.5.6
func (i *Integration) Member() *Member
Member returns the Member the Integration uses
func (*Integration) Role ¶ added in v0.5.6
func (i *Integration) Role() *Role
Role returns the Subscriber Role the Integration uses
type IntegrationAccount ¶ added in v0.5.3
IntegrationAccount (https://discord.com/developers/docs/resources/guild#integration-account-object)
type IntegrationApplication ¶ added in v0.5.3
type IntegrationApplication struct {
ID Snowflake `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
Description string `json:"description"`
Summary string `json:"summary"`
Bot *User `json:"bot"`
}
IntegrationApplication (https://discord.com/developers/docs/resources/guild#integration-application-object)
type IntegrationType ¶ added in v0.5.6
type IntegrationType string
IntegrationType the type of Integration
const ( IntegrationTypeTwitch IntegrationType = "twitch" IntegrationTypeYouTube IntegrationType = "youtube" IntegrationTypeDiscord IntegrationType = "discord" )
all IntegrationType(s)
type Interaction ¶
type Interaction struct {
Disgo Disgo `json:"-"`
ResponseChannel chan InteractionResponse `json:"-"`
Replied bool `json:"-"`
ID Snowflake `json:"id"`
Type InteractionType `json:"type"`
GuildID *Snowflake `json:"guild_id,omitempty"`
ChannelID *Snowflake `json:"channel_id,omitempty"`
Member *Member `json:"member,omitempty"`
User *User `json:"User,omitempty"`
Token string `json:"token"`
Version int `json:"version"`
}
Interaction holds the general parameters of each Interaction
func (*Interaction) DMChannel ¶ added in v0.3.3
func (i *Interaction) DMChannel() *DMChannel
DMChannel returns the api.DMChannel from the api.Cache
func (*Interaction) DeferReply ¶ added in v0.4.3
func (i *Interaction) DeferReply(ephemeral bool) restclient.RestError
DeferReply replies to the api.Interaction with api.InteractionResponseTypeDeferredChannelMessageWithSource and shows a loading state
func (*Interaction) DeleteFollowup ¶ added in v0.3.3
func (i *Interaction) DeleteFollowup(messageID Snowflake) restclient.RestError
DeleteFollowup used to delete an api.Message from an api.Interaction
func (*Interaction) DeleteOriginal ¶ added in v0.3.3
func (i *Interaction) DeleteOriginal() restclient.RestError
DeleteOriginal deletes the original api.InteractionResponse
func (*Interaction) EditFollowup ¶ added in v0.3.3
func (i *Interaction) EditFollowup(messageID Snowflake, messageUpdate MessageUpdate) (*Message, restclient.RestError)
EditFollowup used to edit an api.Message from an api.Interaction
func (*Interaction) EditOriginal ¶ added in v0.3.3
func (i *Interaction) EditOriginal(messageUpdate MessageUpdate) (*Message, restclient.RestError)
EditOriginal edits the original api.InteractionResponse
func (*Interaction) FromWebhook ¶ added in v0.4.0
func (i *Interaction) FromWebhook() bool
FromWebhook returns is the Interaction was made via http
func (*Interaction) Guild ¶ added in v0.3.3
func (i *Interaction) Guild() *Guild
Guild returns the api.Guild from the api.Cache
func (*Interaction) GuildChannel ¶ added in v0.3.3
func (i *Interaction) GuildChannel() *GuildChannel
GuildChannel returns the api.GuildChannel from the api.Cache
func (*Interaction) MessageChannel ¶ added in v0.3.3
func (i *Interaction) MessageChannel() *MessageChannel
MessageChannel returns the api.MessageChannel from the api.Cache
func (*Interaction) Reply ¶ added in v0.4.0
func (i *Interaction) Reply(messageCreate MessageCreate) restclient.RestError
Reply replies to the api.Interaction with api.InteractionResponseTypeDeferredChannelMessageWithSource & api.MessageCreate
func (*Interaction) Respond ¶ added in v0.4.3
func (i *Interaction) Respond(responseType InteractionResponseType, data interface{}) restclient.RestError
Respond responds to the api.Interaction with the provided api.InteractionResponse
func (*Interaction) SendFollowup ¶ added in v0.3.3
func (i *Interaction) SendFollowup(messageCreate MessageCreate) (*Message, restclient.RestError)
SendFollowup used to send an api.MessageCreate to an api.Interaction
func (*Interaction) TextChannel ¶ added in v0.3.3
func (i *Interaction) TextChannel() *TextChannel
TextChannel returns the api.TextChannel from the api.Cache
type InteractionResponse ¶
type InteractionResponse struct {
Type InteractionResponseType `json:"type"`
Data interface{} `json:"data,omitempty"`
}
InteractionResponse is how you answer interactions. If an answer is not sent within 3 seconds of receiving it, the interaction is failed, and you will be unable to respond to it.
func (InteractionResponse) ToBody ¶ added in v0.4.3
func (r InteractionResponse) ToBody() (interface{}, error)
ToBody returns the InteractionResponse ready for body
type InteractionResponseType ¶
type InteractionResponseType int
InteractionResponseType indicates the type of slash command response, whether it's responding immediately or deferring to edit your response later
const ( InteractionResponseTypePong InteractionResponseType = iota + 1 InteractionResponseTypeChannelMessageWithSource InteractionResponseTypeDeferredChannelMessageWithSource InteractionResponseTypeDeferredUpdateMessage InteractionResponseTypeUpdateMessage )
Constants for the InteractionResponseType(s)
type InteractionType ¶
type InteractionType int
InteractionType is the type of Interaction
const ( InteractionTypePing InteractionType = iota + 1 InteractionTypeCommand InteractionTypeComponent )
Supported InteractionType(s)
type Invite ¶ added in v0.2.0
type Invite struct {
Disgo Disgo `json:"-"`
Code string `json:"code"`
Guild *InviteGuild `json:"guild"`
Channel InviteChannel `json:"channel"`
Inviter *User `json:"inviter"`
TargetUser *InviteUser `json:"target_user"`
TargetType *TargetType `json:"target_user_type"`
ApproximatePresenceCount *int `json:"approximate_presence_count"`
ApproximateMemberCount *int `json:"approximate_member_count"`
}
Invite is a partial invite struct
func (*Invite) URL ¶ added in v0.2.0
URL returns the invite URL in format like https://discord.gg/{code}
type InviteChannel ¶ added in v0.2.0
type InviteChannel struct {
ID string `json:"id"`
Name string `json:"name"`
Type ChannelType `json:"type"`
}
InviteChannel is the Channel of an invite
type InviteGuild ¶ added in v0.2.0
type InviteGuild struct {
ID Snowflake `json:"id"`
Name string `json:"name"`
Splash *string `json:"splash"`
Banner *string `json:"banner"`
Description *string `json:"description"`
Icon *string `json:"icon"`
Features []GuildFeature `json:"features"`
VerificationLevel VerificationLevel `json:"verification_level"`
VanityURLCode *string `json:"vanity_url_code"`
}
An InviteGuild is the Guild of an Invite
type InviteUser ¶ added in v0.2.0
type InviteUser struct {
ID string `json:"id"`
Username string `json:"username"`
Avatar string `json:"avatar"`
Discriminator string `json:"discriminator"`
}
InviteUser is the user who created an invite
type Member ¶
type Member struct {
Disgo Disgo
GuildID Snowflake `json:"guild_id"`
User *User `json:"user"`
Nick *string `json:"nick"`
RoleIDs []Snowflake `json:"roles,omitempty"`
JoinedAt time.Time `json:"joined_at"`
PremiumSince *time.Time `json:"premium_since,omitempty"`
Deaf bool `json:"deaf,omitempty"`
Mute bool `json:"mute,omitempty"`
Pending bool `json:"pending"`
InteractionPermissions *Permissions `json:"permissions,omitempty"`
}
Member is a discord GuildMember
func (*Member) AddRole ¶
func (m *Member) AddRole(roleID Snowflake) restclient.RestError
AddRole adds a specific role the member
func (*Member) Ban ¶ added in v0.5.4
func (m *Member) Ban(reason string, deleteMessageDays int) restclient.RestError
Ban bans the Member from the Guild
func (*Member) EffectiveName ¶ added in v0.3.0
EffectiveName returns either the nickname or username depending on if the user has a nickname
func (*Member) IsOwner ¶
IsOwner returns whether the member is the owner of the guild_events that it belongs to
func (*Member) Kick ¶ added in v0.4.5
func (m *Member) Kick(reason string) restclient.RestError
Kick kicks the Member from the Guild
func (*Member) Move ¶
func (m *Member) Move(channelID *Snowflake) (*Member, restclient.RestError)
Move moves/kicks the member to/from a voice channel
func (*Member) Permissions ¶
func (m *Member) Permissions() Permissions
Permissions returns the Permissions the Member has in the Guild
func (*Member) RemoveRole ¶
func (m *Member) RemoveRole(roleID Snowflake) restclient.RestError
RemoveRole removes a specific role the member
func (*Member) Unban ¶ added in v0.5.4
func (m *Member) Unban() restclient.RestError
Unban unbans the Member from the Guild
func (*Member) Update ¶
func (m *Member) Update(updateGuildMember UpdateMember) (*Member, restclient.RestError)
Update updates the Member
func (*Member) VoiceState ¶ added in v0.3.0
func (m *Member) VoiceState() *VoiceState
VoiceState returns the VoiceState for this Member from the Cache(requires CacheFlagVoiceState and GatewayIntentsGuildVoiceStates)
type MemberCachePolicy ¶
MemberCachePolicy can be used to define your own policy for caching members
var ( MemberCachePolicyNone MemberCachePolicy = func(_ *Member) bool { return false } MemberCachePolicyAll MemberCachePolicy = func(_ *Member) bool { return true } MemberCachePolicyOwner MemberCachePolicy = func(member *Member) bool { return member.IsOwner() } MemberCachePolicyOnline MemberCachePolicy = func(_ *Member) bool { return false } MemberCachePolicyVoice MemberCachePolicy = func(member *Member) bool { return false } MemberCachePolicyPending MemberCachePolicy = func(member *Member) bool { return member.Pending } MemberCachePolicyDefault = MemberCachePolicyOwner.Or(MemberCachePolicyVoice) )
Default member cache policies
func MemberCachePolicyAllOf ¶
func MemberCachePolicyAllOf(policy MemberCachePolicy, policies ...MemberCachePolicy) MemberCachePolicy
MemberCachePolicyAllOf is a shorthand for MemberCachePolicy.And(MemberCachePolicy).And(MemberCachePolicy) etc.
func MemberCachePolicyAnyOf ¶
func MemberCachePolicyAnyOf(policy MemberCachePolicy, policies ...MemberCachePolicy) MemberCachePolicy
MemberCachePolicyAnyOf is a shorthand for MemberCachePolicy.Or(MemberCachePolicy).Or(MemberCachePolicy) etc.
func (MemberCachePolicy) And ¶
func (p MemberCachePolicy) And(policy MemberCachePolicy) MemberCachePolicy
And allows you to require both policies to be true for the member to be cached
func (MemberCachePolicy) Or ¶
func (p MemberCachePolicy) Or(policy MemberCachePolicy) MemberCachePolicy
Or allows you to combine that policy with another, meaning either needs to be true
type Mentionable ¶
type Mentionable interface {
Mention() string
}
Mentionable is a struct for Mention parsing and AllowedMentions
type Message ¶
type Message struct {
Disgo Disgo `json:"-"`
ID Snowflake `json:"id"`
GuildID *Snowflake `json:"guild_id"`
Reactions []MessageReaction `json:"reactions"`
Attachments []Attachment `json:"attachments"`
TTS bool `json:"tts"`
Embeds []Embed `json:"embeds,omitempty"`
Components []Component `json:"-"`
CreatedAt time.Time `json:"timestamp"`
Mentions []interface{} `json:"mentions"`
MentionEveryone bool `json:"mention_everyone"`
MentionRoles []*Role `json:"mention_roles"`
MentionChannels []*Channel `json:"mention_channels"`
Pinned bool `json:"pinned"`
EditedTimestamp *time.Time `json:"edited_timestamp"`
Author *User `json:"author"`
Member *Member `json:"member"`
Content *string `json:"content,omitempty"`
ChannelID Snowflake `json:"channel_id"`
Type MessageType `json:"type"`
Flags MessageFlags `json:"flags"`
MessageReference *MessageReference `json:"message_reference,omitempty"`
Interaction *MessageInteraction `json:"interaction,omitempty"`
WebhookID *Snowflake `json:"webhook_id,omitempty"`
Activity *MessageActivity `json:"activity,omitempty"`
Application *MessageApplication `json:"application,omitempty"`
Stickers []*MessageSticker `json:"stickers,omitempty"`
ReferencedMessage *Message `json:"referenced_message,omitempty"`
LastUpdated *time.Time `json:"last_updated,omitempty"`
}
Message is a struct for messages sent in discord text-based channels
func (*Message) ActionRows ¶ added in v0.4.5
ActionRows returns all ActionRow(s) from this Message
func (*Message) AddReaction ¶
func (m *Message) AddReaction(emoji string) restclient.RestError
AddReaction allows you to add a reaction to a message_events from a string, for example a custom emoji ID, or a native emoji
func (*Message) AddReactionByEmote ¶
func (m *Message) AddReactionByEmote(emote Emoji) restclient.RestError
AddReactionByEmote allows you to add an Emoji to a message_events via reaction
func (*Message) ButtonByID ¶ added in v0.4.5
ButtonByID returns a Button with the specific customID from this Message
func (*Message) Channel ¶
func (m *Message) Channel() *MessageChannel
Channel gets the channel the message_events was sent in
func (*Message) ComponentByID ¶ added in v0.4.5
ComponentByID returns the first Component with the specific customID
func (*Message) Crosspost ¶ added in v0.2.0
func (m *Message) Crosspost() (*Message, restclient.RestError)
Crosspost crossposts an existing message
func (*Message) Delete ¶ added in v0.2.0
func (m *Message) Delete() restclient.RestError
Delete allows you to edit an existing Message sent by you
func (*Message) IsEphemeral ¶ added in v0.5.2
IsEphemeral returns true if the Message has MessageFlagEphemeral
func (*Message) Reply ¶
func (m *Message) Reply(message MessageCreate) (*Message, restclient.RestError)
Reply allows you to reply to an existing Message
func (*Message) SelectMenuByID ¶ added in v0.4.5
func (m *Message) SelectMenuByID(customID string) *SelectMenu
SelectMenuByID returns a SelectMenu with the specific customID from this Message
func (*Message) SelectMenus ¶ added in v0.4.5
func (m *Message) SelectMenus() []SelectMenu
SelectMenus returns all SelectMenu(s) from this Message
func (*Message) Unmarshal ¶ added in v0.4.5
Unmarshal is used to unmarshal a Message we received from discord
func (*Message) Update ¶ added in v0.4.5
func (m *Message) Update(message MessageUpdate) (*Message, restclient.RestError)
Update allows you to edit an existing Message sent by you
type MessageActivity ¶ added in v0.2.0
type MessageActivity struct {
Type MessageActivityType `json:"type"`
PartyID *string `json:"party_id,omitempty"`
}
MessageActivity is used for rich presence-related chat embeds in a Message
type MessageActivityType ¶ added in v0.2.0
type MessageActivityType int
MessageActivityType is the type of MessageActivity
const ( MessageActivityTypeJoin MessageActivityType = iota + 1 MessageActivityTypeSpectate MessageActivityTypeListen MessageActivityTypeJoinRequest )
Constants for MessageActivityType
type MessageApplication ¶ added in v0.2.0
type MessageApplication struct {
ID Snowflake `json:"id"`
CoverImage *string `json:"cover_image,omitempty"`
Description string `json:"description"`
Icon *string `json:"icon,omitempty"`
Name string `json:"name"`
}
MessageApplication is used for rich presence-related chat embeds in a Message
type MessageBulkDelete ¶ added in v0.2.0
type MessageBulkDelete struct {
Messages []Snowflake `json:"messages"`
}
MessageBulkDelete is used to bulk delete Message(s)
type MessageCachePolicy ¶
MessageCachePolicy can be used to define your own policy for caching messages
var ( MessageCachePolicyNone MessageCachePolicy = func(_ *Message) bool { return false } MessageCachePolicyDefault = MessageCachePolicyNone )
Default member cache policies
func MessageCachePolicyAll ¶
func MessageCachePolicyAll(policy MessageCachePolicy, policies ...MessageCachePolicy) MessageCachePolicy
MessageCachePolicyAll is a shorthand for MessageCachePolicy.And(MessageCachePolicy).And(MessageCachePolicy) etc.
func MessageCachePolicyAny ¶
func MessageCachePolicyAny(policy MessageCachePolicy, policies ...MessageCachePolicy) MessageCachePolicy
MessageCachePolicyAny is a shorthand for MessageCachePolicy.Or(MessageCachePolicy).Or(MessageCachePolicy) etc.
func MessageCachePolicyDuration ¶
func MessageCachePolicyDuration(duration time.Duration) MessageCachePolicy
MessageCachePolicyDuration creates a new MessageCachePolicy which caches messages for the give duration
func (MessageCachePolicy) And ¶
func (p MessageCachePolicy) And(policy MessageCachePolicy) MessageCachePolicy
And allows you to require both policies to be true for the member to be cached
func (MessageCachePolicy) Or ¶
func (p MessageCachePolicy) Or(policy MessageCachePolicy) MessageCachePolicy
Or allows you to combine that policy with another, meaning either needs to be true
type MessageChannel ¶
type MessageChannel struct {
Channel
}
MessageChannel is used for sending Message(s) to User(s)
func (MessageChannel) BulkDeleteMessages ¶ added in v0.2.0
func (c MessageChannel) BulkDeleteMessages(messageIDs ...Snowflake) restclient.RestError
BulkDeleteMessages allows you bulk delete Message(s)
func (MessageChannel) CrosspostMessage ¶ added in v0.2.0
func (c MessageChannel) CrosspostMessage(messageID Snowflake) (*Message, restclient.RestError)
CrosspostMessage crossposts an existing Message
func (MessageChannel) DeleteMessage ¶ added in v0.2.0
func (c MessageChannel) DeleteMessage(messageID Snowflake) restclient.RestError
DeleteMessage allows you to edit an existing Message sent by you
func (MessageChannel) EditMessage ¶ added in v0.2.0
func (c MessageChannel) EditMessage(messageID Snowflake, message MessageUpdate) (*Message, restclient.RestError)
EditMessage edits a Message in this TextChannel
func (MessageChannel) SendMessage ¶
func (c MessageChannel) SendMessage(message MessageCreate) (*Message, restclient.RestError)
SendMessage sends a Message to a TextChannel
type MessageCreate ¶
type MessageCreate struct {
Nonce string `json:"nonce,omitempty"`
Content string `json:"content,omitempty"`
TTS bool `json:"tts,omitempty"`
Embeds []Embed `json:"embeds,omitempty"`
Components []Component `json:"components,omitempty"`
Files []restclient.File `json:"-"`
AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
MessageReference *MessageReference `json:"message_reference,omitempty"`
Flags MessageFlags `json:"flags,omitempty"`
}
MessageCreate is the struct to create a new Message with
func (MessageCreate) ToBody ¶ added in v0.4.3
func (m MessageCreate) ToBody() (interface{}, error)
ToBody returns the MessageCreate ready for body
type MessageCreateBuilder ¶ added in v0.4.3
type MessageCreateBuilder struct {
MessageCreate
}
MessageCreateBuilder helper to build Message(s) easier
func NewMessageCreateBuilder ¶ added in v0.4.3
func NewMessageCreateBuilder() *MessageCreateBuilder
NewMessageCreateBuilder creates a new MessageCreateBuilder to be built later
func NewMessageCreateBuilderByMessage ¶ added in v0.5.2
func NewMessageCreateBuilderByMessage(message *Message) *MessageCreateBuilder
NewMessageCreateBuilderByMessage returns a new MessageCreateBuilder and takes an existing Message
func (*MessageCreateBuilder) AddActionRow ¶ added in v0.5.2
func (b *MessageCreateBuilder) AddActionRow(components ...Component) *MessageCreateBuilder
AddActionRow adds a new ActionRow with the provided Component(s) to the Message
func (*MessageCreateBuilder) AddActionRows ¶ added in v0.5.2
func (b *MessageCreateBuilder) AddActionRows(actionRows ...ActionRow) *MessageCreateBuilder
AddActionRows adds the ActionRow(s) to the Message
func (*MessageCreateBuilder) AddEmbeds ¶ added in v0.4.3
func (b *MessageCreateBuilder) AddEmbeds(embeds ...Embed) *MessageCreateBuilder
AddEmbeds adds multiple embeds to the Message
func (*MessageCreateBuilder) AddFile ¶ added in v0.4.3
func (b *MessageCreateBuilder) AddFile(name string, reader io.Reader, flags ...restclient.FileFlags) *MessageCreateBuilder
AddFile adds a restclient.File to the MessageCreate
func (*MessageCreateBuilder) AddFiles ¶ added in v0.4.3
func (b *MessageCreateBuilder) AddFiles(files ...restclient.File) *MessageCreateBuilder
AddFiles adds the restclient.File(s) to the MessageCreate
func (*MessageCreateBuilder) AddFlags ¶ added in v0.4.5
func (b *MessageCreateBuilder) AddFlags(flags ...MessageFlags) *MessageCreateBuilder
AddFlags adds the MessageFlags of the Message
func (*MessageCreateBuilder) Build ¶ added in v0.4.3
func (b *MessageCreateBuilder) Build() MessageCreate
Build builds the MessageCreateBuilder to a MessageCreate struct
func (*MessageCreateBuilder) ClearActionRows ¶ added in v0.5.2
func (b *MessageCreateBuilder) ClearActionRows() *MessageCreateBuilder
ClearActionRows removes all of the ActionRow(s) of the Message
func (*MessageCreateBuilder) ClearAllowedMentions ¶ added in v0.4.3
func (b *MessageCreateBuilder) ClearAllowedMentions() *MessageCreateBuilder
ClearAllowedMentions clears the allowed mentions of the Message
func (*MessageCreateBuilder) ClearContent ¶ added in v0.4.5
func (b *MessageCreateBuilder) ClearContent() *MessageCreateBuilder
ClearContent removes content of the Message
func (*MessageCreateBuilder) ClearEmbeds ¶ added in v0.4.3
func (b *MessageCreateBuilder) ClearEmbeds() *MessageCreateBuilder
ClearEmbeds removes all of the embeds from the Message
func (*MessageCreateBuilder) ClearFiles ¶ added in v0.4.3
func (b *MessageCreateBuilder) ClearFiles() *MessageCreateBuilder
ClearFiles removes all files of this MessageCreate
func (*MessageCreateBuilder) ClearFlags ¶ added in v0.4.5
func (b *MessageCreateBuilder) ClearFlags() *MessageCreateBuilder
ClearFlags clears the MessageFlags of the Message
func (*MessageCreateBuilder) RemoveActionRow ¶ added in v0.5.2
func (b *MessageCreateBuilder) RemoveActionRow(i int) *MessageCreateBuilder
RemoveActionRow removes a ActionRow from the Message
func (*MessageCreateBuilder) RemoveEmbed ¶ added in v0.4.3
func (b *MessageCreateBuilder) RemoveEmbed(i int) *MessageCreateBuilder
RemoveEmbed removes an embed from the Message
func (*MessageCreateBuilder) RemoveFiles ¶ added in v0.4.3
func (b *MessageCreateBuilder) RemoveFiles(i int) *MessageCreateBuilder
RemoveFiles removes the file at this index
func (*MessageCreateBuilder) RemoveFlags ¶ added in v0.4.5
func (b *MessageCreateBuilder) RemoveFlags(flags ...MessageFlags) *MessageCreateBuilder
RemoveFlags removes the MessageFlags of the Message
func (*MessageCreateBuilder) SetActionRow ¶ added in v0.5.2
func (b *MessageCreateBuilder) SetActionRow(i int, actionRow ActionRow) *MessageCreateBuilder
SetActionRow sets the provided ActionRow at the index of Component(s)
func (*MessageCreateBuilder) SetActionRows ¶ added in v0.5.2
func (b *MessageCreateBuilder) SetActionRows(actionRows ...ActionRow) *MessageCreateBuilder
SetActionRows sets the ActionRow(s) of the Message
func (*MessageCreateBuilder) SetAllowedMentions ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *MessageCreateBuilder
SetAllowedMentions sets the AllowedMentions of the Message
func (*MessageCreateBuilder) SetContent ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetContent(content string) *MessageCreateBuilder
SetContent sets content of the Message
func (*MessageCreateBuilder) SetContentf ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetContentf(content string, a ...interface{}) *MessageCreateBuilder
SetContentf sets content of the Message
func (*MessageCreateBuilder) SetEmbed ¶ added in v0.5.2
func (b *MessageCreateBuilder) SetEmbed(i int, embed Embed) *MessageCreateBuilder
SetEmbed sets the provided Embed at the index of the Message
func (*MessageCreateBuilder) SetEmbeds ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetEmbeds(embeds ...Embed) *MessageCreateBuilder
SetEmbeds sets the Embed(s) of the Message
func (*MessageCreateBuilder) SetEphemeral ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetEphemeral(ephemeral bool) *MessageCreateBuilder
SetEphemeral adds/removes MessageFlagEphemeral to the Message flags
func (*MessageCreateBuilder) SetFile ¶ added in v0.5.2
func (b *MessageCreateBuilder) SetFile(i int, file restclient.File) *MessageCreateBuilder
SetFile sets the restclient.File at the index for this MessageCreate
func (*MessageCreateBuilder) SetFiles ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetFiles(files ...restclient.File) *MessageCreateBuilder
SetFiles sets the restclient.File(s) for this MessageCreate
func (*MessageCreateBuilder) SetFlags ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetFlags(flags MessageFlags) *MessageCreateBuilder
SetFlags sets the message flags of the Message
func (*MessageCreateBuilder) SetMessageReference ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetMessageReference(messageReference *MessageReference) *MessageCreateBuilder
SetMessageReference allows you to specify a MessageReference to reply to
func (*MessageCreateBuilder) SetMessageReferenceByID ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetMessageReferenceByID(messageID Snowflake) *MessageCreateBuilder
SetMessageReferenceByID allows you to specify a Message ID to reply to
func (*MessageCreateBuilder) SetTTS ¶ added in v0.4.3
func (b *MessageCreateBuilder) SetTTS(tts bool) *MessageCreateBuilder
SetTTS sets the text to speech of the Message
type MessageFlags ¶
type MessageFlags int64
The MessageFlags of a Message
const ( MessageFlagCrossposted MessageFlags = 1 << iota MessageFlagIsCrosspost MessageFlagSuppressEmbeds MessageFlagSourceMessageDeleted MessageFlagUrgent MessageFlagEphemeral MessageFlagLoading // Message is an interaction of type 5, awaiting further response MessageFlagNone MessageFlags = 0 )
Constants for MessageFlags
func (MessageFlags) Add ¶
func (f MessageFlags) Add(bits ...MessageFlags) MessageFlags
Add allows you to add multiple bits together, producing a new bit
func (MessageFlags) Has ¶
func (f MessageFlags) Has(bit MessageFlags) bool
Has will check whether the Bit contains another bit
func (MessageFlags) HasAll ¶
func (f MessageFlags) HasAll(bits ...MessageFlags) bool
HasAll will ensure that the bit includes all of the bits entered
func (MessageFlags) Missing ¶
func (f MessageFlags) Missing(bit MessageFlags) bool
Missing will do the inverse of Bit.Has
func (MessageFlags) MissingAny ¶
func (f MessageFlags) MissingAny(bits ...MessageFlags) bool
MissingAny will check whether the bit is missing any one of the bits
func (MessageFlags) Remove ¶
func (f MessageFlags) Remove(bits ...MessageFlags) MessageFlags
Remove allows you to subtract multiple bits from the first, producing a new bit
type MessageInteraction ¶
type MessageInteraction struct {
ID Snowflake `json:"id"`
Type InteractionType `json:"type"`
Name string `json:"name"`
User User `json:"user"`
}
MessageInteraction is sent on the Message object when the message_events is a response to an interaction
type MessageNotifications ¶
type MessageNotifications int
MessageNotifications indicates whether users receive @ mentions on a new message
const ( MessageNotificationsAllMessages MessageNotifications = iota MessageNotificationsOnlyMentions )
Constants for MessageNotifications
type MessageReaction ¶ added in v0.2.0
type MessageReaction struct {
Count int `json:"count"`
Me bool `json:"me"`
Emoji Emoji `json:"emoji"`
}
MessageReaction contains information about the reactions of a message_events
type MessageReference ¶
type MessageReference struct {
MessageID *Snowflake `json:"message_id"`
ChannelID *Snowflake `json:"channel_id,omitempty"`
GuildID *Snowflake `json:"guild_id,omitempty"`
FailIfNotExists *bool `json:"fail_if_not_exists,omitempty"`
}
MessageReference is a reference to another message
type MessageSticker ¶ added in v0.2.0
type MessageSticker struct {
ID Snowflake `json:"id"`
PackID Snowflake `json:"pack_id"`
Name string `json:"name"`
Description string `json:"description"`
Tags *string `json:"tags"`
FormatType MessageStickerFormatType `json:"format_type"`
}
MessageSticker is a sticker sent with a Message
type MessageStickerFormatType ¶ added in v0.2.0
type MessageStickerFormatType int
MessageStickerFormatType is the Format type of MessageSticker
const ( MessageStickerFormatPNG MessageStickerFormatType = iota + 1 MessageStickerFormatAPNG MessageStickerFormatLottie )
Constants for MessageStickerFormatType
type MessageType ¶
type MessageType int
The MessageType indicates the Message type
const ( MessageTypeDefault MessageType = iota MessageTypeRecipientAdd MessageTypeRecipientRemove MessageTypeCall MessageTypeChannelNameChange MessageTypeChannelIconChange ChannelPinnedMessage MessageTypeGuildMemberJoin MessageTypeUserPremiumGuildSubscription MessageTypeUserPremiumGuildSubscriptionTier1 MMessageTypeUserPremiumGuildSubscriptionTier2 MessageTypeUserPremiumGuildSubscriptionTier3 MessageTypeChannelFollowAdd MessageTypeGuildDiscoveryDisqualified MessageTypeGuildDiscoveryRequalified MessageTypeGuildDiscoveryInitialWarning MessageTypeGuildDiscoveryFinalWarning MessageTypeReply MessageTypeCommand )
Constants for the MessageType
type MessageUpdate ¶ added in v0.2.0
type MessageUpdate struct {
Content *string `json:"content,omitempty"`
Embeds []Embed `json:"embeds,omitempty"`
Components []Component `json:"components,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
Files []restclient.File `json:"-"`
AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
Flags *MessageFlags `json:"flags,omitempty"`
}
MessageUpdate is used to edit a Message
func (MessageUpdate) ToBody ¶ added in v0.4.3
func (m MessageUpdate) ToBody() (interface{}, error)
ToBody returns the MessageUpdate ready for body
type MessageUpdateBuilder ¶ added in v0.4.3
type MessageUpdateBuilder struct {
MessageUpdate
}
MessageUpdateBuilder helper to build MessageUpdate easier
func NewMessageUpdateBuilder ¶ added in v0.4.3
func NewMessageUpdateBuilder() *MessageUpdateBuilder
NewMessageUpdateBuilder creates a new MessageUpdateBuilder to be built later
func (*MessageUpdateBuilder) AddActionRow ¶ added in v0.5.2
func (b *MessageUpdateBuilder) AddActionRow(components ...Component) *MessageUpdateBuilder
AddActionRow adds a new ActionRow with the provided Component(s) to the Message
func (*MessageUpdateBuilder) AddActionRows ¶ added in v0.5.2
func (b *MessageUpdateBuilder) AddActionRows(actionRows ...ActionRow) *MessageUpdateBuilder
AddActionRows adds the ActionRow(s) to the Message
func (*MessageUpdateBuilder) AddEmbeds ¶ added in v0.4.3
func (b *MessageUpdateBuilder) AddEmbeds(embeds ...Embed) *MessageUpdateBuilder
AddEmbeds adds multiple embeds to the Message
func (*MessageUpdateBuilder) AddFile ¶ added in v0.4.3
func (b *MessageUpdateBuilder) AddFile(name string, reader io.Reader, flags ...restclient.FileFlags) *MessageUpdateBuilder
AddFile adds a restclient.File to the MessageCreate
func (*MessageUpdateBuilder) AddFiles ¶ added in v0.4.3
func (b *MessageUpdateBuilder) AddFiles(files ...restclient.File) *MessageUpdateBuilder
AddFiles adds the restclient.File(s) to the MessageCreate
func (*MessageUpdateBuilder) AddFlags ¶ added in v0.4.5
func (b *MessageUpdateBuilder) AddFlags(flags ...MessageFlags) *MessageUpdateBuilder
AddFlags adds the MessageFlags of the Message
func (*MessageUpdateBuilder) Build ¶ added in v0.4.3
func (b *MessageUpdateBuilder) Build() MessageUpdate
Build builds the MessageUpdateBuilder to a MessageUpdate struct
func (*MessageUpdateBuilder) ClearActionRows ¶ added in v0.5.2
func (b *MessageUpdateBuilder) ClearActionRows() *MessageUpdateBuilder
ClearActionRows removes all of the ActionRow(s) of the Message
func (*MessageUpdateBuilder) ClearAllowedMentions ¶ added in v0.4.3
func (b *MessageUpdateBuilder) ClearAllowedMentions() *MessageUpdateBuilder
ClearAllowedMentions clears the allowed mentions of the Message
func (*MessageUpdateBuilder) ClearContent ¶ added in v0.4.5
func (b *MessageUpdateBuilder) ClearContent() *MessageUpdateBuilder
ClearContent removes content of the Message
func (*MessageUpdateBuilder) ClearEmbeds ¶ added in v0.4.3
func (b *MessageUpdateBuilder) ClearEmbeds() *MessageUpdateBuilder
ClearEmbeds removes all of the embeds from the Message
func (*MessageUpdateBuilder) ClearFiles ¶ added in v0.4.3
func (b *MessageUpdateBuilder) ClearFiles() *MessageUpdateBuilder
ClearFiles removes all files of this MessageCreate
func (*MessageUpdateBuilder) ClearFlags ¶ added in v0.4.5
func (b *MessageUpdateBuilder) ClearFlags() *MessageUpdateBuilder
ClearFlags clears the MessageFlags of the Message
func (*MessageUpdateBuilder) RemoveActionRow ¶ added in v0.5.2
func (b *MessageUpdateBuilder) RemoveActionRow(i int) *MessageUpdateBuilder
RemoveActionRow removes a ActionRow from the Message
func (*MessageUpdateBuilder) RemoveEmbed ¶ added in v0.4.3
func (b *MessageUpdateBuilder) RemoveEmbed(i int) *MessageUpdateBuilder
RemoveEmbed removes an embed from the Message
func (*MessageUpdateBuilder) RemoveFiles ¶ added in v0.4.3
func (b *MessageUpdateBuilder) RemoveFiles(i int) *MessageUpdateBuilder
RemoveFiles removes the file at this index
func (*MessageUpdateBuilder) RemoveFlags ¶ added in v0.4.5
func (b *MessageUpdateBuilder) RemoveFlags(flags ...MessageFlags) *MessageUpdateBuilder
RemoveFlags removes the MessageFlags of the Message
func (*MessageUpdateBuilder) RetainAttachments ¶ added in v0.4.3
func (b *MessageUpdateBuilder) RetainAttachments(attachments ...Attachment) *MessageUpdateBuilder
RetainAttachments removes all Attachment(s) from this Message except the ones provided
func (*MessageUpdateBuilder) RetainAttachmentsByID ¶ added in v0.4.3
func (b *MessageUpdateBuilder) RetainAttachmentsByID(attachmentIDs ...Snowflake) *MessageUpdateBuilder
RetainAttachmentsByID removes all Attachment(s) from this Message except the ones provided
func (*MessageUpdateBuilder) SetActionRow ¶ added in v0.5.2
func (b *MessageUpdateBuilder) SetActionRow(i int, actionRow ActionRow) *MessageUpdateBuilder
SetActionRow sets the provided ActionRow at the index of Component(s)
func (*MessageUpdateBuilder) SetActionRows ¶ added in v0.5.2
func (b *MessageUpdateBuilder) SetActionRows(actionRows ...ActionRow) *MessageUpdateBuilder
SetActionRows sets the ActionRow(s) of the Message
func (*MessageUpdateBuilder) SetAllowedMentions ¶ added in v0.4.3
func (b *MessageUpdateBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *MessageUpdateBuilder
SetAllowedMentions sets the AllowedMentions of the Message
func (*MessageUpdateBuilder) SetContent ¶ added in v0.4.3
func (b *MessageUpdateBuilder) SetContent(content string) *MessageUpdateBuilder
SetContent sets content of the Message
func (*MessageUpdateBuilder) SetContentf ¶ added in v0.4.3
func (b *MessageUpdateBuilder) SetContentf(content string, a ...interface{}) *MessageUpdateBuilder
SetContentf sets content of the Message
func (*MessageUpdateBuilder) SetEmbed ¶ added in v0.5.2
func (b *MessageUpdateBuilder) SetEmbed(i int, embed Embed) *MessageUpdateBuilder
SetEmbed sets the provided Embed at the index of the Message
func (*MessageUpdateBuilder) SetEmbeds ¶ added in v0.4.3
func (b *MessageUpdateBuilder) SetEmbeds(embeds ...Embed) *MessageUpdateBuilder
SetEmbeds sets the Embed(s) of the Message
func (*MessageUpdateBuilder) SetFile ¶ added in v0.5.2
func (b *MessageUpdateBuilder) SetFile(i int, file restclient.File) *MessageUpdateBuilder
SetFile sets the restclient.File at the index for this MessageCreate
func (*MessageUpdateBuilder) SetFiles ¶ added in v0.4.3
func (b *MessageUpdateBuilder) SetFiles(files ...restclient.File) *MessageUpdateBuilder
SetFiles sets the restclient.File(s) for this MessageCreate
func (*MessageUpdateBuilder) SetFlags ¶ added in v0.4.3
func (b *MessageUpdateBuilder) SetFlags(flags MessageFlags) *MessageUpdateBuilder
SetFlags sets the message flags of the Message
type MoveMember ¶ added in v0.4.5
type MoveMember struct {
ChannelID *Snowflake `json:"channel_id,omitempty"`
}
MoveMember is used to move a member
type Option ¶ added in v0.2.0
type Option struct {
Resolved *Resolved
Name string
Type CommandOptionType
Value interface{}
}
Option holds info about an Option.Value
func (Option) GuildChannel ¶ added in v0.2.0
func (o Option) GuildChannel() *GuildChannel
GuildChannel returns the Option.Value as GuildChannel
func (Option) MessageChannel ¶ added in v0.2.0
func (o Option) MessageChannel() *MessageChannel
MessageChannel returns the Option.Value as MessageChannel
func (Option) StoreChannel ¶ added in v0.2.0
func (o Option) StoreChannel() *StoreChannel
StoreChannel returns the Option.Value as StoreChannel
func (Option) TextChannel ¶ added in v0.2.0
func (o Option) TextChannel() *TextChannel
TextChannel returns the Option.Value as TextChannel
func (Option) VoiceChannel ¶ added in v0.2.0
func (o Option) VoiceChannel() *VoiceChannel
VoiceChannel returns the Option.Value as VoiceChannel
type OptionChoice ¶
type OptionChoice struct {
Name string `json:"name"`
Value interface{} `json:"value"`
}
OptionChoice contains the data for a user using your command. Value can either be a string, int or float
type OptionalAuditLogEntryInfo ¶ added in v0.5.3
type OptionalAuditLogEntryInfo struct {
DeleteMemberDays *string `json:"delete_member_days"`
MembersRemoved *string `json:"members_removed"`
ChannelID *Snowflake `json:"channel_id"`
MessageID *Snowflake `json:"message_id"`
Count *string `json:"count"`
ID *string `json:"id"`
Type *string `json:"type"`
RoleName *string `json:"role_name"`
}
OptionalAuditLogEntryInfo (https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info)
type Options ¶
type Options struct {
Logger log.Logger
GatewayIntents GatewayIntents
RestTimeout int
EnableWebhookInteractions bool
ListenPort int
ListenURL string
PublicKey string
LargeThreshold int
RawGatewayEventsEnabled bool
HTTPClient *http.Client
}
Options is the configuration used when creating the client
type PartialChannel ¶ added in v0.5.6
type PartialChannel struct {
ID Snowflake `json:"id"`
Type ChannelType `json:"type"`
Name *string `json:"name,omitempty"`
}
PartialChannel contains basic info about a Channel
type PartialGuild ¶ added in v0.4.5
type PartialGuild struct {
ID Snowflake `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
Owner bool `json:"owner"`
Permissions Permissions `json:"permissions"`
Features []GuildFeature `json:"features"`
}
PartialGuild is returned on the restclient.GetGuilds route
type PartialRole ¶ added in v0.5.11
PartialRole holds basic info about a Role
type PermissionOverwrite ¶ added in v0.2.0
type PermissionOverwrite struct {
ID Snowflake `json:"id"`
Type PermissionOverwriteType `json:"type"`
Allow Permissions `json:"allow,string"`
Deny Permissions `json:"deny,string"`
}
PermissionOverwrite is used to determine who can perform particular actions in a GuildChannel
type PermissionOverwriteType ¶ added in v0.2.0
type PermissionOverwriteType int
PermissionOverwriteType is the type of PermissionOverwrite
const ( PermissionOverwriteTypeRole PermissionOverwriteType = iota PermissionOverwriteTypeMember )
Constants for PermissionOverwriteType
type Permissions ¶
type Permissions int64
Permissions extends the Bit structure, and is used within roles and channels
const ( PermissionSendMessages Permissions = 1 << (iota + 11) PermissionSendTTSMessages PermissionManageMessages PermissionEmbedLinks PermissionAttachFiles PermissionReadMessageHistory PermissionMentionEveryone PermissionUseExternalEmojis )
Constants for the different bit offsets of text channel permissions
const ( PermissionVoiceConnect Permissions = 1 << (iota + 20) PermissionVoiceSpeak PermissionVoiceMuteMembers PermissionVoiceDeafenMembers PermissionVoiceMoveMembers PermissionVoiceUseVAD PermissionVoicePrioritySpeaker Permissions = 1 << (iota + 2) )
Constants for the different bit offsets of voice permissions
const ( PermissionChangeNickname Permissions = 1 << (iota + 26) PermissionManageNicknames PermissionManageRoles PermissionManageWebhooks PermissionManageEmojis PermissionUseCommands )
Constants for general management.
const ( PermissionCreateInstantInvite Permissions = 1 << iota PermissionKickMembers PermissionBanMembers PermissionAdministrator PermissionManageChannels PermissionManageServer PermissionAddReactions PermissionViewAuditLogs PermissionViewChannel Permissions = 1 << (iota + 2) PermissionsAllText = PermissionViewChannel | PermissionSendMessages | PermissionSendTTSMessages | PermissionManageMessages | PermissionEmbedLinks | PermissionAttachFiles | PermissionReadMessageHistory | PermissionMentionEveryone PermissionsAllVoice = PermissionViewChannel | PermissionVoiceConnect | PermissionVoiceSpeak | PermissionVoiceMuteMembers | PermissionVoiceDeafenMembers | PermissionVoiceMoveMembers | PermissionVoiceUseVAD | PermissionVoicePrioritySpeaker PermissionsAllChannel = PermissionsAllText | PermissionsAllVoice | PermissionCreateInstantInvite | PermissionManageRoles | PermissionManageChannels | PermissionAddReactions | PermissionViewAuditLogs PermissionsAll = PermissionsAllChannel | PermissionKickMembers | PermissionBanMembers | PermissionManageServer | PermissionAdministrator | PermissionManageWebhooks | PermissionManageEmojis PermissionsNone Permissions = 0 )
Constants for the different bit offsets of general permissions
func GetMemberPermissions ¶ added in v0.4.5
func GetMemberPermissions(member *Member) Permissions
GetMemberPermissions returns all Permissions from the provided Member
func (Permissions) Add ¶
func (p Permissions) Add(bits ...Permissions) Permissions
Add allows you to add multiple bits together, producing a new bit
func (Permissions) Has ¶
func (p Permissions) Has(bit Permissions) bool
Has will check whether the Bit contains another bit
func (Permissions) HasAll ¶
func (p Permissions) HasAll(bits ...Permissions) bool
HasAll will ensure that the bit includes all of the bits entered
func (Permissions) MarshalJSON ¶
func (p Permissions) MarshalJSON() ([]byte, error)
MarshalJSON marshals permissions into a string
func (Permissions) Missing ¶
func (p Permissions) Missing(bit Permissions) bool
Missing will do the inverse of Bit.Has
func (Permissions) MissingAny ¶
func (p Permissions) MissingAny(bits ...Permissions) bool
MissingAny will check whether the bit is missing any one of the bits
func (Permissions) Remove ¶
func (p Permissions) Remove(bits ...Permissions) Permissions
Remove allows you to subtract multiple bits from the first, producing a new bit
func (*Permissions) UnmarshalJSON ¶
func (p *Permissions) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshalls permissions into an int64
type PremiumTier ¶
type PremiumTier int
PremiumTier tells you the boost level of a Guild
const ( PremiumTierNone PremiumTier = iota PremiumTier1 PremiumTier2 PremiumTier3 )
Constants for PremiumTier
type RawGatewayEvent ¶ added in v0.2.0
type RawGatewayEvent struct {
GatewayPacket
D json.RawMessage `json:"d"`
}
RawGatewayEvent specifies the data for the GatewayCommand payload that is being sent
type RawOption ¶ added in v0.5.4
type RawOption struct {
Name string `json:"name"`
Type CommandOptionType `json:"type"`
Value interface{} `json:"value,omitempty"`
Options []RawOption `json:"options,omitempty"`
}
RawOption is used for unmarshalling Option
type ReadyGatewayEvent ¶
type ReadyGatewayEvent struct {
Version int `json:"v"`
SelfUser User `json:"user"`
Guilds []*Guild `json:"guilds"`
SessionID string `json:"session_id"`
Shard *[2]int `json:"shard,omitempty"`
}
ReadyGatewayEvent is the event sent by discord when you successfully Identify
type RequestGuildMembersCommand ¶
type RequestGuildMembersCommand struct {
GuildID Snowflake `json:"guild_id"`
Query string `json:"query"` //If specified, user_ids must not be entered
Limit int `json:"limit"` //Must be >=1 if query/user_ids is used, otherwise 0
Presences bool `json:"presences,omitempty"`
UserIDs []Snowflake `json:"user_ids"` //If specified, query must not be entered
Nonce string `json:"nonce,omitempty"` //All responses are hashed with this nonce, optional
}
RequestGuildMembersCommand is used for fetching all of the members of a guild_events. It is recommended you have a strict member caching policy when using this.
type Resolved ¶
type Resolved struct {
Users map[Snowflake]*User `json:"users,omitempty"`
Members map[Snowflake]*Member `json:"members,omitempty"`
Roles map[Snowflake]*Role `json:"roles,omitempty"`
Channels map[Snowflake]*Channel `json:"channels,omitempty"`
}
Resolved contains resolved mention data
type RestClient ¶
type RestClient interface {
restclient.RestClient
Close()
Disgo() Disgo
GetUser(userID Snowflake) (*User, restclient.RestError)
GetSelfUser() (*SelfUser, restclient.RestError)
UpdateSelfUser(updateSelfUser UpdateSelfUser) (*SelfUser, restclient.RestError)
GetGuilds(before int, after int, limit int) ([]*PartialGuild, restclient.RestError)
LeaveGuild(guildID Snowflake) restclient.RestError
GetDMChannels() ([]*DMChannel, restclient.RestError)
CreateDMChannel(userID Snowflake) (*DMChannel, restclient.RestError)
GetMessage(channelID Snowflake, messageID Snowflake) (*Message, restclient.RestError)
CreateMessage(channelID Snowflake, message MessageCreate) (*Message, restclient.RestError)
UpdateMessage(channelID Snowflake, messageID Snowflake, messageUpdate MessageUpdate) (*Message, restclient.RestError)
DeleteMessage(channelID Snowflake, messageID Snowflake) restclient.RestError
BulkDeleteMessages(channelID Snowflake, messageIDs ...Snowflake) restclient.RestError
CrosspostMessage(channelID Snowflake, messageID Snowflake) (*Message, restclient.RestError)
GetGuild(guildID Snowflake, withCounts bool) (*Guild, restclient.RestError)
GetGuildPreview(guildID Snowflake) (*GuildPreview, restclient.RestError)
CreateGuild(createGuild CreateGuild) (*Guild, restclient.RestError)
UpdateGuild(guildID Snowflake, updateGuild UpdateGuild) (*Guild, restclient.RestError)
DeleteGuild(guildID Snowflake) restclient.RestError
GetMember(guildID Snowflake, userID Snowflake) (*Member, restclient.RestError)
GetMembers(guildID Snowflake) ([]*Member, restclient.RestError)
SearchMembers(guildID Snowflake, query string, limit int) ([]*Member, restclient.RestError)
AddMember(guildID Snowflake, userID Snowflake, addMember AddMember) (*Member, restclient.RestError)
RemoveMember(guildID Snowflake, userID Snowflake, reason string) restclient.RestError
UpdateMember(guildID Snowflake, userID Snowflake, updateMember UpdateMember) (*Member, restclient.RestError)
UpdateSelfNick(guildID Snowflake, nick string) (*string, restclient.RestError)
MoveMember(guildID Snowflake, userID Snowflake, channelID *Snowflake) (*Member, restclient.RestError)
AddMemberRole(guildID Snowflake, userID Snowflake, roleID Snowflake) restclient.RestError
RemoveMemberRole(guildID Snowflake, userID Snowflake, roleID Snowflake) restclient.RestError
GetAuditLog(guildID Snowflake, userID Snowflake, actionType AuditLogEvent, before Snowflake, limit int) (*AuditLog, restclient.RestError)
GetIntegrations(guildID Snowflake) ([]*Integration, restclient.RestError)
DeleteIntegration(guildID Snowflake, integrationID Snowflake) restclient.RestError
GetBans(guildID Snowflake) ([]Ban, restclient.RestError)
GetBan(guildID Snowflake, userID Snowflake) (*Ban, restclient.RestError)
AddBan(guildID Snowflake, userID Snowflake, reason string, deleteMessageDays int) restclient.RestError
DeleteBan(guildID Snowflake, userID Snowflake) restclient.RestError
GetRoles(guildID Snowflake) ([]*Role, restclient.RestError)
CreateRole(guildID Snowflake, createRole CreateRole) (*Role, restclient.RestError)
UpdateRole(guildID Snowflake, roleID Snowflake, updateRole UpdateRole) (*Role, restclient.RestError)
UpdateRolePositions(guildID Snowflake, roleUpdates ...UpdateRolePosition) ([]*Role, restclient.RestError)
DeleteRole(guildID Snowflake, roleID Snowflake) restclient.RestError
AddReaction(channelID Snowflake, messageID Snowflake, emoji string) restclient.RestError
RemoveOwnReaction(channelID Snowflake, messageID Snowflake, emoji string) restclient.RestError
RemoveUserReaction(channelID Snowflake, messageID Snowflake, emoji string, userID Snowflake) restclient.RestError
GetGlobalCommands(applicationID Snowflake) ([]*Command, restclient.RestError)
GetGlobalCommand(applicationID Snowflake, commandID Snowflake) (*Command, restclient.RestError)
CreateGlobalCommand(applicationID Snowflake, command CommandCreate) (*Command, restclient.RestError)
SetGlobalCommands(applicationID Snowflake, commands ...CommandCreate) ([]*Command, restclient.RestError)
UpdateGlobalCommand(applicationID Snowflake, commandID Snowflake, command CommandUpdate) (*Command, restclient.RestError)
DeleteGlobalCommand(applicationID Snowflake, commandID Snowflake) restclient.RestError
GetGuildCommands(applicationID Snowflake, guildID Snowflake) ([]*Command, restclient.RestError)
GetGuildCommand(applicationID Snowflake, guildID Snowflake, commandID Snowflake) (*Command, restclient.RestError)
CreateGuildCommand(applicationID Snowflake, guildID Snowflake, command CommandCreate) (*Command, restclient.RestError)
SetGuildCommands(applicationID Snowflake, guildID Snowflake, commands ...CommandCreate) ([]*Command, restclient.RestError)
UpdateGuildCommand(applicationID Snowflake, guildID Snowflake, commandID Snowflake, command CommandUpdate) (*Command, restclient.RestError)
DeleteGuildCommand(applicationID Snowflake, guildID Snowflake, commandID Snowflake) restclient.RestError
GetGuildCommandsPermissions(applicationID Snowflake, guildID Snowflake) ([]*GuildCommandPermissions, restclient.RestError)
GetGuildCommandPermissions(applicationID Snowflake, guildID Snowflake, commandID Snowflake) (*GuildCommandPermissions, restclient.RestError)
SetGuildCommandsPermissions(applicationID Snowflake, guildID Snowflake, commandPermissions ...SetGuildCommandPermissions) ([]*GuildCommandPermissions, restclient.RestError)
SetGuildCommandPermissions(applicationID Snowflake, guildID Snowflake, commandID Snowflake, commandPermissions SetGuildCommandPermissions) (*GuildCommandPermissions, restclient.RestError)
SendInteractionResponse(interactionID Snowflake, interactionToken string, interactionResponse InteractionResponse) restclient.RestError
UpdateInteractionResponse(applicationID Snowflake, interactionToken string, messageUpdate MessageUpdate) (*Message, restclient.RestError)
DeleteInteractionResponse(applicationID Snowflake, interactionToken string) restclient.RestError
SendFollowupMessage(applicationID Snowflake, interactionToken string, messageCreate MessageCreate) (*Message, restclient.RestError)
UpdateFollowupMessage(applicationID Snowflake, interactionToken string, messageID Snowflake, messageUpdate MessageUpdate) (*Message, restclient.RestError)
DeleteFollowupMessage(applicationID Snowflake, interactionToken string, followupMessageID Snowflake) restclient.RestError
GetGuildTemplate(templateCode string) (*GuildTemplate, restclient.RestError)
GetGuildTemplates(guildID Snowflake) ([]*GuildTemplate, restclient.RestError)
CreateGuildTemplate(guildID Snowflake, createGuildTemplate CreateGuildTemplate) (*GuildTemplate, restclient.RestError)
CreateGuildFromTemplate(templateCode string, createGuildFromTemplate CreateGuildFromTemplate) (*Guild, restclient.RestError)
SyncGuildTemplate(guildID Snowflake, templateCode string) (*GuildTemplate, restclient.RestError)
UpdateGuildTemplate(guildID Snowflake, templateCode string, updateGuildTemplate UpdateGuildTemplate) (*GuildTemplate, restclient.RestError)
DeleteGuildTemplate(guildID Snowflake, templateCode string) (*GuildTemplate, restclient.RestError)
}
RestClient is a manager for all of disgo's HTTP requests
type ResumeCommand ¶
type ResumeCommand struct {
Token string `json:"token"`
SessionID string `json:"session_id"`
Seq int `json:"seq"`
}
ResumeCommand is used to resume a connection to discord in the case that you are disconnected. Is automatically handled by the library and should rarely be used.
type Role ¶
type Role struct {
Disgo Disgo `json:"-"`
GuildID Snowflake `json:"-"`
ID Snowflake `json:"id"`
Name string `json:"name"`
Color int `json:"color"`
Hoist bool `json:"hoist"`
Position int `json:"position"`
Permissions Permissions `json:"permissions"`
Managed bool `json:"managed"`
Mentionable bool `json:"mentionable"`
Tags *RoleTag `json:"tags,omitempty"`
}
Role is a Guild Role object
func (*Role) SetPosition ¶
func (r *Role) SetPosition(rolePositionUpdate UpdateRolePosition) ([]*Role, restclient.RestError)
SetPosition sets the position of the Role
func (*Role) Update ¶
func (r *Role) Update(roleUpdate UpdateRole) (*Role, restclient.RestError)
Update updates the Role with specific values
type RoleTag ¶
type RoleTag struct {
BotID *Snowflake `json:"bot_id,omitempty"`
IntegrationID *Snowflake `json:"integration_id,omitempty"`
PremiumSubscriber bool `json:"premium_subscriber"`
}
RoleTag are tags a Role has
type SelectMenu ¶ added in v0.4.5
type SelectMenu struct {
ComponentImpl
CustomID string `json:"custom_id"`
Placeholder string `json:"placeholder"`
MinValues int `json:"min_values,omitempty"`
MaxValues int `json:"max_values,omitempty"`
Options []SelectOption `json:"options"`
}
SelectMenu is a Component which lets the User select from various options
func NewSelectMenu ¶ added in v0.4.5
func NewSelectMenu(customID string, placeholder string, minValues int, maxValues int, options ...SelectOption) SelectMenu
NewSelectMenu builds a new SelectMenu from the provided values
func (SelectMenu) AddOptions ¶ added in v0.4.5
func (m SelectMenu) AddOptions(options ...SelectOption) SelectMenu
AddOptions returns a new SelectMenu with the provided SelectOption(s) added
func (SelectMenu) RemoveOption ¶ added in v0.4.5
func (m SelectMenu) RemoveOption(index int) SelectMenu
RemoveOption returns a new SelectMenu with the provided SelectOption at the index removed
func (SelectMenu) SetOption ¶ added in v0.4.5
func (m SelectMenu) SetOption(value string, option SelectOption) SelectMenu
SetOption returns a new SelectMenu with the SelectOption which has the value replaced
func (SelectMenu) SetOptions ¶ added in v0.4.5
func (m SelectMenu) SetOptions(options ...SelectOption) SelectMenu
SetOptions returns a new SelectMenu with the provided SelectOption(s)
func (SelectMenu) WithCustomID ¶ added in v0.4.5
func (m SelectMenu) WithCustomID(customID string) SelectMenu
WithCustomID returns a new SelectMenu with the provided customID
func (SelectMenu) WithMaxValues ¶ added in v0.4.5
func (m SelectMenu) WithMaxValues(maxValue int) SelectMenu
WithMaxValues returns a new SelectMenu with the provided maxValue
func (SelectMenu) WithMinValues ¶ added in v0.4.5
func (m SelectMenu) WithMinValues(minValue int) SelectMenu
WithMinValues returns a new SelectMenu with the provided minValue
func (SelectMenu) WithPlaceholder ¶ added in v0.4.5
func (m SelectMenu) WithPlaceholder(placeholder string) SelectMenu
WithPlaceholder returns a new SelectMenu with the provided placeholder
type SelectMenuInteraction ¶ added in v0.4.5
type SelectMenuInteraction struct {
*ComponentInteraction
Data *SelectMenuInteractionData `json:"data,omitempty"`
}
SelectMenuInteraction is a specific Interaction when CLicked on SelectMenu(s)
func (*SelectMenuInteraction) SelectMenu ¶ added in v0.4.5
func (i *SelectMenuInteraction) SelectMenu() *SelectMenu
SelectMenu returns the SelectMenu which issued this SelectMenuInteraction. nil for ephemeral Message(s)
func (*SelectMenuInteraction) SelectedOptions ¶ added in v0.5.2
func (i *SelectMenuInteraction) SelectedOptions() []SelectOption
SelectedOptions returns the selected SelectedOption(s)
func (*SelectMenuInteraction) Values ¶ added in v0.5.2
func (i *SelectMenuInteraction) Values() []string
Values returns the selected values
type SelectMenuInteractionData ¶ added in v0.4.5
type SelectMenuInteractionData struct {
*ComponentInteractionData
Values []string `json:"values"`
}
SelectMenuInteractionData is the SelectMenu data payload
type SelectOption ¶ added in v0.4.5
type SelectOption struct {
Label string `json:"label"`
Value string `json:"value"`
Description string `json:"description,omitempty"`
Default bool `json:"default,omitempty"`
Emoji *Emoji `json:"emoji,omitempty"`
}
SelectOption represents an option in a SelectMenu
func NewSelectOption ¶ added in v0.4.5
func NewSelectOption(label string, value string) SelectOption
NewSelectOption builds a new SelectOption
func (SelectOption) WithDefault ¶ added in v0.4.5
func (o SelectOption) WithDefault(defaultOption bool) SelectOption
WithDefault returns a new SelectOption as default/non-default
func (SelectOption) WithDescription ¶ added in v0.4.5
func (o SelectOption) WithDescription(description string) SelectOption
WithDescription returns a new SelectOption with the provided description
func (SelectOption) WithEmoji ¶ added in v0.4.5
func (o SelectOption) WithEmoji(emoji *Emoji) SelectOption
WithEmoji returns a new SelectOption with the provided Emoji
func (SelectOption) WithLabel ¶ added in v0.4.5
func (o SelectOption) WithLabel(label string) SelectOption
WithLabel returns a new SelectOption with the provided label
func (SelectOption) WithValue ¶ added in v0.4.5
func (o SelectOption) WithValue(value string) SelectOption
WithValue returns a new SelectOption with the provided value
type SelfUser ¶ added in v0.4.3
type SelfUser struct {
*User
MfaEnabled *bool `json:"mfa_enabled"`
Locale *string `json:"locale"`
Verified *bool `json:"verified"`
Email *string `json:"email"`
Flags *int `json:"flags"`
PremiumType *int `json:"premium_type"`
}
SelfUser represents the current logged in User
func (*SelfUser) OpenDMChannel ¶ added in v0.4.3
func (u *SelfUser) OpenDMChannel() (*DMChannel, restclient.RestError)
OpenDMChannel creates a DMChannel between the user and the Disgo client
func (*SelfUser) Update ¶ added in v0.4.5
func (u *SelfUser) Update(updateSelfUser UpdateSelfUser) (*SelfUser, restclient.RestError)
Update updates the SelfUser with the given payload
type SetGuildCommandPermissions ¶ added in v0.2.0
type SetGuildCommandPermissions struct {
ID Snowflake `json:"id,omitempty"`
Permissions []CommandPermission `json:"permissions"`
}
SetGuildCommandPermissions is used to update CommandPermission ID should be omitted fro bulk update
type SetGuildCommandsPermissions ¶ added in v0.2.0
type SetGuildCommandsPermissions []SetGuildCommandPermissions
SetGuildCommandsPermissions holds a slice of SetGuildCommandPermissions
type Snowflake ¶
type Snowflake string
Snowflake is a general utility class around discord's IDs
func (Snowflake) Deconstruct ¶
func (s Snowflake) Deconstruct() DeconstructedSnowflake
Deconstruct returns DeconstructedSnowflake
type StoreChannel ¶
type StoreChannel struct {
GuildChannel
}
StoreChannel allows you to interact with discord's store channels
type SystemChannelFlag ¶
type SystemChannelFlag int
SystemChannelFlag contains the settings for the Guild(s) system channel
const ( SystemChannelFlagSuppressJoinNotifications SystemChannelFlag = 1 << iota SystemChannelFlagSuppressPremiumSubscriptions )
Constants for SystemChannelFlag
type TargetType ¶ added in v0.2.0
type TargetType int
TargetType is type of target an Invite uses
const ( TargetTypeStream TargetType = iota + 1 TargetTypeEmbeddedApplication )
Constants for TargetType
type TextChannel ¶
type TextChannel struct {
GuildChannel
MessageChannel
}
TextChannel allows you to interact with discord's text channels
type Timestamp ¶ added in v0.4.5
type Timestamp struct {
time.Time
TimestampFlag TimestampFlag
}
Timestamp represents a timestamp markdown object https://discord.com/developers/docs/reference#message-formatting
func NewTimestamp ¶ added in v0.4.5
NewTimestamp returns a new Timestamp with TimestampFlagShortDateTime & the given time.Time
func NewTimestampF ¶ added in v0.4.5
func NewTimestampF(flag TimestampFlag, time time.Time) Timestamp
NewTimestampF returns a new Timestamp with the given TimestampFlag & time.Time
func ParseTimestamp ¶ added in v0.4.5
ParseTimestamp parses the first Timestamp found in the provided string
func ParseTimestamps ¶ added in v0.4.5
ParseTimestamps parses all Timestamp(s) found in the provided string
func (Timestamp) FormatWith ¶ added in v0.4.5
func (t Timestamp) FormatWith(format TimestampFlag) string
FormatWith returns the Timestamp as markdown with the given TimestampFlag
type TimestampFlag ¶ added in v0.4.5
type TimestampFlag string
TimestampFlag is used to determine how to display the Timestamp for the User in the client
const ( // TimestampFlagShortTime formats time as 16:20 TimestampFlagShortTime TimestampFlag = "t" // TimestampFlagLongTime formats time as 16:20:30 TimestampFlagLongTime TimestampFlag = "T" // TimestampFlagShortDate formats time as 20/04/2021 TimestampFlagShortDate TimestampFlag = "d" // TimestampFlagLongDate formats time as 20 April 2021 TimestampFlagLongDate TimestampFlag = "D" // TimestampFlagShortDateTime formats time as 20 April 2021 16:20 TimestampFlagShortDateTime TimestampFlag = "f" // TimestampFlagLongDateTime formats time as Tuesday, 20 April 2021 16:20 TimestampFlagLongDateTime TimestampFlag = "F" // TimestampFlagRelative formats time as 2 months ago TimestampFlagRelative TimestampFlag = "R" )
func (TimestampFlag) Format ¶ added in v0.4.5
func (f TimestampFlag) Format(seconds int64) string
Format returns the seconds formatted as markdown string
func (TimestampFlag) FormatTime ¶ added in v0.4.5
func (f TimestampFlag) FormatTime(time time.Time) string
FormatTime returns the time.Time formatted as markdown string
type UnmarshalComponent ¶ added in v0.4.0
type UnmarshalComponent struct {
ComponentType ComponentType `json:"type"`
// Button && SelectMenu
CustomID string `json:"custom_id"`
// Button
Style ButtonStyle `json:"style"`
Label string `json:"label"`
Emoji *Emoji `json:"emoji"`
URL string `json:"url"`
Disabled bool `json:"disabled"`
// ActionRow
Components []UnmarshalComponent `json:"components"`
// SelectMenu
Placeholder string `json:"placeholder"`
MinValues int `json:"min_values,omitempty"`
MaxValues int `json:"max_values,omitempty"`
Options []SelectOption `json:"options"`
}
UnmarshalComponent is used for easier unmarshalling of different Component(s)
type UpdateGuild ¶ added in v0.4.5
type UpdateGuild struct {
Name *string `json:"name,omitempty"`
Region *string `json:"region,omitempty"`
VerificationLevel *VerificationLevel `json:"verification_level,omitempty"`
DefaultMessageNotificationLevel *MessageNotifications `json:"default_message_notification_level,omitempty"`
ExplicitContentFilterLevel *ExplicitContentFilterLevel `json:"explicit_content_filter_level,omitempty"`
AFKChannelID *Snowflake `json:"afk_channel_id,omitempty"`
AFKTimeout *int `json:"afk_timeout,omitempty"`
Icon *string `json:"icon,omitempty"`
OwnerID *Snowflake `json:"owner_id,omitempty"`
Splash []byte `json:"splash,omitempty"`
DiscoverySplash []byte `json:"discovery_splash,omitempty"`
Banner []byte `json:"banner,omitempty"`
SystemChannelID *Snowflake `json:"system_channel_id,omitempty"`
SystemChannelFlags *SystemChannelFlag `json:"system_channel_flags,omitempty"`
RulesChannelID *Snowflake `json:"rules_channel_id,omitempty"`
PublicUpdatesChannelID *Snowflake `json:"public_updates_channel_id,omitempty"`
PreferredLocale *string `json:"preferred_locale,omitempty"`
Features *[]GuildFeature `json:"features,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdateGuild is the payload used to update a Guild
type UpdateGuildTemplate ¶ added in v0.5.2
type UpdateGuildTemplate struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdateGuildTemplate is the data used to update a GuildTemplate
type UpdateMember ¶ added in v0.4.5
type UpdateMember struct {
*MoveMember
Nick *string `json:"nick,omitempty"`
Roles []Snowflake `json:"roles,omitempty"`
Mute *bool `json:"mute,omitempty"`
Deaf *bool `json:"deaf,omitempty"`
}
UpdateMember is used to modify
type UpdateRole ¶
type UpdateRole struct {
Name *string `json:"name"`
Permissions *Permissions `json:"permissions"`
Color *int `json:"color"`
Hoist *bool `json:"hoist"`
Mentionable *bool `json:"mentionable"`
}
UpdateRole is the payload to update a Role
type UpdateRolePosition ¶
UpdateRolePosition is the payload to update a Role(s) position
type UpdateSelfNick ¶
type UpdateSelfNick struct {
Nick string `json:"nick"`
}
UpdateSelfNick is used to update your own nick
type UpdateSelfUser ¶ added in v0.4.5
type UpdateSelfUser struct {
Username string `json:"username"`
Avatar interface{}
}
UpdateSelfUser is the payload used to update the SelfUser
type UpdateStatusCommand ¶
type UpdateStatusCommand struct {
Since *int `json:"since"`
Activities []Activity `json:"activities"`
Status bool `json:"status"`
AFK bool `json:"afk"`
}
UpdateStatusCommand is used for updating Disgo's presence
type UpdateVoiceStateCommand ¶
type UpdateVoiceStateCommand struct {
GuildID Snowflake `json:"guild_id"`
ChannelID *Snowflake `json:"channel_id"`
SelfMute bool `json:"self_mute"`
SelfDeaf bool `json:"self_deaf"`
}
UpdateVoiceStateCommand is used for updating the bots voice state in a guild_events
type User ¶
type User struct {
Disgo Disgo `json:"-"`
ID Snowflake `json:"id"`
Username string `json:"username"`
Discriminator string `json:"discriminator"`
Avatar *string `json:"avatar"`
IsBot bool `json:"bot"`
System bool `json:"system"`
PublicFlags UserFlags `json:"public_flags"`
}
User is a struct for interacting with discord's users
func (*User) OpenDMChannel ¶
func (u *User) OpenDMChannel() (*DMChannel, restclient.RestError)
OpenDMChannel creates a DMChannel between the user and the Disgo client
type UserFlags ¶ added in v0.5.2
type UserFlags int
UserFlags defines certain flags/badges a user can have (https://discord.com/developers/docs/resources/user#user-object-user-flags)
const ( UserFlagDiscordEmployee UserFlags = 1 << iota UserFlagPartneredServerOwner UserFlagHypeSquadEvents UserFlagBugHunterLevel1 UserFlagHouseBravery UserFlagHouseBrilliance UserFlagHouseBalance UserFlagEarlySupporter UserFlagTeamUser UserFlagBugHunterLevel2 UserFlagVerifiedBot UserFlagEarlyVerifiedBotDeveloper UserFlagDiscordCertifiedModerator UserFlagNone UserFlags = 0 )
All UserFlags
func (UserFlags) Add ¶ added in v0.5.2
Add allows you to add multiple bits together, producing a new bit
func (UserFlags) HasAll ¶ added in v0.5.2
HasAll will ensure that the bit includes all of the bits entered
func (UserFlags) MissingAny ¶ added in v0.5.2
MissingAny will check whether the bit is missing any one of the bits
type VerificationLevel ¶
type VerificationLevel int
The VerificationLevel of a Guild that members must be to send messages
const ( VerificationLevelNone VerificationLevel = iota VerificationLevelLow VerificationLevelMedium VerificationLevelHigh VerificationLevelVeryHigh )
Constants for VerificationLevel
type VoiceChannel ¶
type VoiceChannel struct {
GuildChannel
}
VoiceChannel adds methods specifically for interacting with discord's voice
func (*VoiceChannel) Connect ¶ added in v0.2.0
func (c *VoiceChannel) Connect() error
Connect sends an api.GatewayCommand to connect to this VoiceChannel
type VoiceDispatchInterceptor ¶ added in v0.2.0
type VoiceDispatchInterceptor interface {
OnVoiceServerUpdate(voiceServerUpdateEvent *VoiceServerUpdateEvent)
OnVoiceStateUpdate(voiceStateUpdateEvent *VoiceStateUpdateEvent)
}
VoiceDispatchInterceptor lets you listen to VoiceServerUpdate & VoiceStateUpdate
type VoiceServerUpdate ¶ added in v0.2.0
type VoiceServerUpdate struct {
Token string `json:"token"`
GuildID Snowflake `json:"guild_id"`
Endpoint *string `json:"endpoint"`
}
VoiceServerUpdate from Discord
type VoiceServerUpdateEvent ¶ added in v0.2.0
type VoiceServerUpdateEvent struct {
*VoiceServerUpdate
Disgo Disgo
}
VoiceServerUpdateEvent sent when a guilds voice server is updated
func (*VoiceServerUpdateEvent) Guild ¶ added in v0.2.0
func (u *VoiceServerUpdateEvent) Guild() *Guild
Guild returns the Guild for this VoiceServerUpdate from the Cache
type VoiceState ¶
type VoiceState struct {
Disgo Disgo `json:"-"`
GuildID Snowflake `json:"guild_id"`
ChannelID *Snowflake `json:"channel_id"`
UserID Snowflake `json:"user_id"`
SessionID string `json:"session_id"`
GuildDeafened bool `json:"deaf"`
GuildMuted bool `json:"mute"`
SelfDeafened bool `json:"self_deaf"`
SelfMuted bool `json:"self_mute"`
Stream bool `json:"self_stream"`
Video bool `json:"self_video"`
Suppressed bool `json:"suppress"`
}
VoiceState from Discord
func (*VoiceState) Deafened ¶ added in v0.2.0
func (s *VoiceState) Deafened() bool
Deafened returns if the Member is deafened
func (*VoiceState) Guild ¶ added in v0.2.0
func (s *VoiceState) Guild() *Guild
Guild returns the Guild of this VoiceState from the Cache
func (*VoiceState) Member ¶
func (s *VoiceState) Member() *Member
Member returns the Member of this VoiceState from the Cache
func (*VoiceState) Muted ¶ added in v0.2.0
func (s *VoiceState) Muted() bool
Muted returns if the Member is muted
func (*VoiceState) User ¶ added in v0.2.0
func (s *VoiceState) User() *User
User returns the User of this VoiceState from the Cache
func (*VoiceState) VoiceChannel ¶ added in v0.2.0
func (s *VoiceState) VoiceChannel() *VoiceChannel
VoiceChannel returns the VoiceChannel of this VoiceState from the Cache
type VoiceStateUpdateEvent ¶ added in v0.2.0
type VoiceStateUpdateEvent struct {
*VoiceState
Member *Member `json:"member"`
}
VoiceStateUpdateEvent sent when someone joins/leaves/moves voice channels
func (*VoiceStateUpdateEvent) Guild ¶ added in v0.2.0
func (u *VoiceStateUpdateEvent) Guild() *Guild
Guild returns the Guild for this VoiceStateUpdate from the Cache
func (*VoiceStateUpdateEvent) VoiceChannel ¶ added in v0.2.0
func (u *VoiceStateUpdateEvent) VoiceChannel() *VoiceChannel
VoiceChannel returns the VoiceChannel for this VoiceStateUpdate from the Cache
type Webhook ¶ added in v0.5.3
type Webhook struct {
ID Snowflake `json:"id"`
Type WebhookType `json:"type"`
Username Snowflake `json:"username"`
GuildID *Snowflake `json:"guild_id"`
ChannelID Snowflake `json:"channel_id"`
User *User `json:"user"`
Name string `json:"name"`
Avatar string `json:"avatar"`
Token *string `json:"token"`
ApplicationID *Snowflake `json:"application_id"`
SourceGuild *PartialGuild `json:"source_guild"`
SourceChannel *PartialChannel `json:"source_channel"`
URL *string `json:"url"`
}
Webhook (https://discord.com/developers/docs/resources/webhook) is a way to post messages to Discord using the Discord API which do not require bot authentication or use.
type WebhookEventHandler ¶
type WebhookEventHandler interface {
EventHandler
HandleWebhookEvent(disgo Disgo, eventManager EventManager, replyChannel chan InteractionResponse, payload interface{})
}
WebhookEventHandler is used to handle raw webhook events
type WebhookServer ¶
type WebhookServer interface {
Disgo() Disgo
PublicKey() ed25519.PublicKey
ListenURL() string
Router() *mux.Router
Start()
Close()
}
WebhookServer is used for receiving an Interaction over http
type WebhookType ¶ added in v0.5.3
type WebhookType int
WebhookType (https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types)
const ( Incoming WebhookType = iota + 1 ChannelFollower Application )
Incoming
Source Files
¶
- action_row.go
- activity.go
- allowed_mentions.go
- audio_controller.go
- audit_log.go
- ban.go
- button.go
- button_interaction.go
- cache.go
- cache_flags.go
- channels.go
- command.go
- command_interaction.go
- command_option.go
- command_permission.go
- component.go
- component_interaction.go
- disgo.go
- disgo_builder.go
- embed.go
- embed_builder.go
- emoji.go
- entity_builder.go
- event_manager.go
- gateway.go
- gateway_commands.go
- gateway_events.go
- gateway_intents.go
- guild.go
- guild_template.go
- info.go
- integration.go
- interaction.go
- invite.go
- member.go
- member_cache_policy.go
- mention.go
- message.go
- message_cache_policy.go
- message_create.go
- message_update.go
- options.go
- permissions.go
- restclient.go
- role.go
- select_menu.go
- select_menu_interaction.go
- self_user.go
- snowflake.go
- timestamp.go
- user.go
- voice_dispatch_interceptor.go
- voice_state.go
- webhook.go
- webhook_server.go