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 (PrivateChannel, GuildTextChannel, VoiceTextChannel, and their subclasses) share the Textable mixin: messages, createMessage, editMessage, deleteMessage, getMessage(s), getPins, pin/unpin, reactions, sendTyping. Guild text-based channels add the GuildTextable mixin: deleteMessages (bulk delete) and remove-all-reactions, which Discord rejects in DMs. channel.mention returns <#id>.

Obfuscated channels

From 2026-11-16, Discord still sends every channel in a guild over the gateway, including ones your bot cannot view, but hides their details. Such a channel has its name replaced with ___hidden___, most other metadata nulled, and a single synthetic overwrite denying VIEW_CHANNEL to @everyone. Athena exposes this as channel.obfuscated (the CHANNEL_OBFUSCATED channel flag). Always check the flag, never the name.

const visible = guild.channels.filter((c) => !c.obfuscated);
 
if (channel.obfuscated) {
  // only channel.id, channel.type, channel.position, and channel.parentID are real
}

What this means in practice:

  • Only id, type, position, and parentID are real. Do not show the name, topic, or overwrites of an obfuscated channel to users.
  • permissionsOf is only meaningful for your bot itself. The real overwrites are hidden, so computing another member's permissions there gives a wrong answer. For other members, use getMemberPermissions on a channel the bot can view.
  • REST omits them. GET /guilds/{id}/channels (getRESTGuildChannels) does not return obfuscated channels at all, so a REST channel list can be shorter than guild.channels.
  • Interactions always have the real channel. Interaction payloads are never obfuscated. A user can still run a command in a channel your bot cannot view, and interaction.channel then gives a fresh channel built from the interaction's own data rather than the obfuscated cached copy.
  • Access can come back. When the bot regains view access, Discord sends a channelUpdate with the full data and the flag clears. See Events for how logging bots should handle that.

To test your bot before the cutover, opt in with the temporary gateway capability:

import { Client, Constants } from 'athena';
 
new Client(token, { capabilities: Constants.GatewayCapabilityBits.ChannelObfuscation });

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 GuildCommandInteraction

ComponentInteraction 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

StructureHighlights
Guildmembers, channels, roles, threads, voiceStates, permissionsOf(member), plus a large REST mirror. Async fetchMember(id), getMemberPermissions(userID), getRolePermissions(roleID).
GuildChannelobfuscated, permissionsOf(member), getMemberPermissions(userID, { implicit? }) and getRolePermissions(roleID, { implicit? }) (computed by Discord, no cache needed), createInvite
MemberaddRole, removeRole, ban, kick, edit, permissions, highestRole, displayColor, displayName()
UserdisplayName(), avatarURL, dynamicAvatarURL(), bannerURL, mention, getDMChannel
Messageedit, delete, pin, addReaction, crosspost, channelMentions, cleanContent, jumpLink, poll, messageSnapshots
Roledelete, edit, editPosition, comparePosition, iconURL, mention

Newer API fields

Fields added for Discord's 2025-2026 API wave:

StructureFieldNotes
Rolecolors{ primaryColor, secondaryColor, tertiaryColor }; secondaryColor makes the role a gradient, tertiaryColor makes it holographic. role.color is deprecated by Discord but still mirrors colors.primaryColor.
UserprimaryGuildThe user's server tag ({ identityGuildID, identityEnabled, tag, badge }).
UseravatarDecorationData{ asset, skuID } for the equipped avatar decoration.
UsercollectiblesEquipped collectibles (nameplates), raw as delivered by the API.
MemberguildBannerPer-guild banner hash; member.banner prefers it and falls back to the user banner.
SubscriptionrenewalSKUIDsSKU IDs the subscription will renew to.
GuildScheduledEventrecurrenceRuleThe event's recurrence rule, if recurring.
GuildincidentsData / safetyAlertsChannelIDRaw incident actions (see editGuildIncidentActions) and the channel receiving safety alerts.
InteractionattachmentSizeLimitThe actual per-attachment upload limit (bytes) for the invoking context.
CommandInteraction / ComponentInteraction / ModalSubmitInteractionchannelAppPermissionsMap of channel ID to PermissionBitfield: what your bot can do in each channel the interaction resolved. Needs no cached permission overwrites, so it works on bots that disable overwrite caching. Empty when your bot user is not in the guild, so treat a miss as "unknown" rather than "denied". See Slash commands.
GuildAuditLogEntrystatusThe new voice channel status, on voice channel status entries (action types 192 and 193).
GuildAuditLogEntrycountOn channel and role position updates (action types 16 and 33), the number of position changes. Discord merges rapid repeats into one entry.
GuildChannelobfuscatedtrue when the bot cannot view the channel and Discord sent placeholder data. See Obfuscated channels.
ThreadChannelappliedTagsThe tag IDs applied to a forum or media post (4.8.0). Other threads read an empty array.
Clientapplication.flagsNewThe application's flags as a bigint. The older 32-bit application.flags cannot hold flag bits above bit 30, so prefer flagsNew when checking flags.

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(...).