Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/disgoorg/disgo/llms.txt

Use this file to discover all available pages before exploring further.

The discord package contains all the data types and structures representing Discord entities like guilds, channels, users, messages, and more.

Core entities

Guild

Represents a Discord guild (server).
type Guild struct {
    ID                          snowflake.ID
    Name                        string
    Icon                        *string
    OwnerID                     snowflake.ID
    Roles                       []Role
    Channels                    []GuildChannel
    Members                     []Member
    VerificationLevel           VerificationLevel
    DefaultMessageNotifications MessageNotificationsLevel
    ExplicitContentFilter       ExplicitContentFilterLevel
    Features                    []GuildFeature
    MFALevel                    MFALevel
    SystemChannelID             *snowflake.ID
    PremiumTier                 PremiumTier
    PremiumSubscriptionCount    int
    // ... additional fields
}
ID
snowflake.ID
Unique identifier for the guild
Name
string
Name of the guild
OwnerID
snowflake.ID
ID of the guild owner
Features
[]GuildFeature
List of guild features (e.g., “COMMUNITY”, “VERIFIED”)
PremiumTier
PremiumTier
Server boost level (0-3)

User

Represents a Discord user.
type User struct {
    ID            snowflake.ID
    Username      string
    Discriminator string
    GlobalName    *string
    Avatar        *string
    Banner        *string
    Bot           bool
    System        bool
    PublicFlags   UserFlags
}
ID
snowflake.ID
Unique identifier for the user
Username
string
The user’s username
GlobalName
*string
The user’s display name (can be nil)
Bot
bool
Whether the user is a bot
Methods:
func (u User) Tag() string
Returns a formatted string of “Username#Discriminator”, falling back to username if discriminator is “0”.
func (u User) EffectiveName() string
Returns the global (display) name if set, falling back to the username.
func (u User) EffectiveAvatarURL(opts ...CDNOpt) string
Returns the avatar URL if set, falling back to the default avatar URL.

Message

Represents a message sent in a Discord channel.
type Message struct {
    ID                snowflake.ID
    GuildID           *snowflake.ID
    ChannelID         snowflake.ID
    Author            User
    Content           string
    Timestamp         time.Time
    EditedTimestamp   *time.Time
    TTS               bool
    MentionEveryone   bool
    Mentions          []User
    MentionRoles      []snowflake.ID
    Attachments       []Attachment
    Embeds            []Embed
    Components        []LayoutComponent
    Reactions         []MessageReaction
    Pinned            bool
    Type              MessageType
    Flags             MessageFlags
    ReferencedMessage *Message
}
ID
snowflake.ID
Unique identifier for the message
ChannelID
snowflake.ID
ID of the channel the message was sent in
Author
User
The user who sent the message
Content
string
The message content
Embeds
[]Embed
Embedded rich content
Components
[]LayoutComponent
Interactive message components (buttons, select menus)
Methods:
func (m Message) JumpURL() string
Returns a URL that can be used to jump to the message in the Discord client.

Channel

Base interface for all channel types.
type Channel interface {
    Type() ChannelType
    ID() snowflake.ID
    Name() string
    CreatedAt() time.Time
}

Channel types

const (
    ChannelTypeGuildText ChannelType = iota
    ChannelTypeDM
    ChannelTypeGuildVoice
    ChannelTypeGroupDM
    ChannelTypeGuildCategory
    ChannelTypeGuildNews
    ChannelTypeGuildNewsThread
    ChannelTypeGuildPublicThread
    ChannelTypeGuildPrivateThread
    ChannelTypeGuildStageVoice
    ChannelTypeGuildDirectory
    ChannelTypeGuildForum
    ChannelTypeGuildMedia
)

GuildChannel

Interface for guild-specific channels.
type GuildChannel interface {
    Channel
    GuildID() snowflake.ID
    Position() int
    ParentID() *snowflake.ID
    PermissionOverwrites() PermissionOverwrites
}

MessageChannel

Interface for channels that support messages.
type MessageChannel interface {
    Channel
    LastMessageID() *snowflake.ID
    LastPinTimestamp() *time.Time
}

GuildTextChannel

Represents a text channel in a guild.
type GuildTextChannel struct {
    // Implements Channel, GuildChannel, MessageChannel
}
Additional methods:
func (c GuildTextChannel) Topic() *string
Returns the channel topic.
func (c GuildTextChannel) NSFW() bool
Returns whether the channel is marked as NSFW.
func (c GuildTextChannel) RateLimitPerUser() int
Returns the rate limit per user in seconds.

Enums and flags

MessageFlags

Bit flags for message properties.
const (
    MessageFlagCrossposted MessageFlags = 1 << iota
    MessageFlagIsCrosspost
    MessageFlagSuppressEmbeds
    MessageFlagSourceMessageDeleted
    MessageFlagUrgent
    MessageFlagHasThread
    MessageFlagEphemeral
    MessageFlagLoading
    MessageFlagFailedToMentionSomeRolesInThread
    MessageFlagSuppressNotifications
    MessageFlagIsVoiceMessage
)
Methods:
func (f MessageFlags) Add(bits ...MessageFlags) MessageFlags
func (f MessageFlags) Remove(bits ...MessageFlags) MessageFlags
func (f MessageFlags) Has(bits ...MessageFlags) bool
func (f MessageFlags) Missing(bits ...MessageFlags) bool

UserFlags

Public flags/badges a user can have.
const (
    UserFlagDiscordEmployee UserFlags = 1 << iota
    UserFlagPartneredServerOwner
    UserFlagHypeSquadEvents
    UserFlagBugHunterLevel1
    UserFlagHouseBravery
    UserFlagHouseBrilliance
    UserFlagHouseBalance
    UserFlagEarlySupporter
    UserFlagTeamUser
    UserFlagBugHunterLevel2
    UserFlagVerifiedBot
    UserFlagEarlyVerifiedBotDeveloper
    UserFlagDiscordCertifiedModerator
    UserFlagBotHTTPInteractions
)

SystemChannelFlags

Settings for the guild’s system channel.
const (
    SystemChannelFlagSuppressJoinNotifications SystemChannelFlags = 1 << iota
    SystemChannelFlagSuppressPremiumSubscriptions
    SystemChannelFlagSuppressGuildReminderNotifications
    SystemChannelFlagSuppressJoinNotificationReplies
    SystemChannelFlagSuppressRoleSubscriptionPurchaseNotifications
    SystemChannelFlagSuppressRoleSubscriptionPurchaseNotificationReplies
)

Guild features

const (
    GuildFeatureAnimatedBanner        GuildFeature = "ANIMATED_BANNER"
    GuildFeatureAnimatedIcon          GuildFeature = "ANIMATED_ICON"
    GuildFeatureAutoModeration        GuildFeature = "AUTO_MODERATION"
    GuildFeatureBanner                GuildFeature = "BANNER"
    GuildFeatureCommunity             GuildFeature = "COMMUNITY"
    GuildFeatureDiscoverable          GuildFeature = "DISCOVERABLE"
    GuildFeaturePartnered             GuildFeature = "PARTNERED"
    GuildFeatureVerified              GuildFeature = "VERIFIED"
    GuildFeatureVanityURL             GuildFeature = "VANITY_URL"
    GuildFeatureWelcomeScreenEnabled  GuildFeature = "WELCOME_SCREEN_ENABLED"
    // ... and more
)

Verification levels

const (
    VerificationLevelNone VerificationLevel = iota
    VerificationLevelLow
    VerificationLevelMedium
    VerificationLevelHigh
    VerificationLevelVeryHigh
)

Premium tiers

const (
    PremiumTierNone PremiumTier = iota
    PremiumTier1
    PremiumTier2
    PremiumTier3
)

Build docs developers (and LLMs) love