Structures
Every Discord object is a class. They share a small base and form deep hierarchies for channels and interactions.
Every Discord object is a class. They share a small base and form deep hierarchies for channels and interactions.
Class tree (abridged)
Base
BaseChannel
PartialChannel
PrivateChannel
GuildChannel
CategoryChannel
ForumChannel
MediaChannel
GuildTextChannel
NewsChannel
ThreadChannel -> NewsThreadChannel
GuildVoiceChannel
StageChannel
VoiceTextChannel
Interaction
CommandInteraction
ComponentInteraction
ModalSubmitInteraction
AutocompleteInteraction
PingInteraction
User (extends PartialUser)
Member
Guild
Message
Role
Invite, PermissionOverwrite, StageInstance, ThreadMember, VoiceState
Entitlement, SKU, Subscription
AutoModerationRule, GuildScheduledEvent
GuildAuditLogEntry, GuildIntegration, GuildPreview, UnavailableGuild
Base gives every object an id, a createdAt getter (derived from the snowflake), and toJSON().
Cached vs partial
Athena caches what the gateway has shown it. When you access something it has not seen (a reaction on an old message, for example) you get a partial: PartialChannel, PartialUser, or an uncached-message shape. Guard with instanceof or the partial flag.
client.on('messageDelete', (message) => {
if (message instanceof Message) {
// full data
} else {
// only id, channel, guildID
}
});Channels
BaseChannel has type guards that narrow the union:
if (channel.isTextBased()) { /* has a messages cache + send helpers */ }
if (channel.isVoiceBased()) { /* GuildVoiceChannel | StageChannel | VoiceTextChannel */ }
if (channel.isThread()) { /* ThreadChannel | NewsThreadChannel */ }
if (channel.inGuild()) { /* any GuildChannel */ }Text-based channels expose messages, createMessage, editMessage, deleteMessage, getMessage(s), getPins, reactions, sendTyping. channel.mention returns <#id>.
Interactions
Common methods on Interaction: defer, createMessage, createFollowup, editOriginalMessage, deleteOriginalMessage, getOriginalMessage, createModal, plus the isCommand/isComponent/isModal/isAutocomplete/isPing guards. createMessage now resolves with the created Message, so no getOriginalMessage round trip is needed. Apps with Activities also get launchActivity() (resolves with the activity instance ID).
CommandInteraction adds typed option getters:
interaction.getString('name'); // string | null
interaction.getRequiredString('name'); // string, throws if missing
interaction.getInteger('count');
interaction.getNumber('amount');
interaction.getBoolean('flag');
interaction.getUser('user'); // and getMember
interaction.getChannel('channel');
interaction.getRole('role');
interaction.getMentionable('target');
interaction.getAttachment('file');
interaction.inGuild(); // narrows to GuildCommandInteractionComponentInteraction adds isButton, isStringSelect, isChannelSelect, isRoleSelect, isUserSelect, isMentionableSelect, the selected values, deferUpdate, and editParent (which now resolves with the updated Message). ModalSubmitInteraction exposes fields and getField.
Useful members
| Structure | Highlights |
|---|---|
Guild | members, channels, roles, threads, voiceStates, permissionsOf(member), plus a large REST mirror. Async fetchMember(id). |
Member | addRole, removeRole, ban, kick, edit, permissions, highestRole, displayColor, displayName() |
User | displayName(), avatarURL, dynamicAvatarURL(), bannerURL, mention, getDMChannel |
Message | edit, delete, pin, addReaction, crosspost, channelMentions, cleanContent, jumpLink, poll, messageSnapshots |
Role | delete, edit, editPosition, comparePosition, iconURL, mention |
Newer API fields
Fields added for Discord's 2025-2026 API wave:
| Structure | Field | Notes |
|---|---|---|
Role | colors | { primaryColor, secondaryColor, tertiaryColor }; secondaryColor makes the role a gradient, tertiaryColor makes it holographic. role.color is deprecated by Discord but still mirrors colors.primaryColor. |
User | primaryGuild | The user's server tag ({ identityGuildID, identityEnabled, tag, badge }). |
User | avatarDecorationData | { asset, skuID } for the equipped avatar decoration. |
User | collectibles | Equipped collectibles (nameplates), raw as delivered by the API. |
Member | guildBanner | Per-guild banner hash; member.banner prefers it and falls back to the user banner. |
Subscription | renewalSKUIDs | SKU IDs the subscription will renew to. |
GuildScheduledEvent | recurrenceRule | The event's recurrence rule, if recurring. |
Guild | incidentsData / safetyAlertsChannelID | Raw incident actions (see editGuildIncidentActions) and the channel receiving safety alerts. |
Interaction | attachmentSizeLimit | The actual per-attachment upload limit (bytes) for the invoking context. |
Collections
Collection<Value> extends Map and is used for every cache (guild.members, client.users, channel.messages, ...). It adds add, update, remove, find, filter, map, every, some, reduce, random. For very large bots you can swap the underlying store; see Caching and memory.
Bitfields
PermissionBitfield, GatewayIntentsBitfield, MessageFlagBitfield, ChannelFlagBitfield, SKUFlagBitfield. All support has, add, remove, and json. PermissionBitfield adds isAdmin() and missing(...).