detritus

Structuresnamespace

Typed, cached objects built from Discord's payloads, like Message, Guild and User, with helpers for the endpoints that act on them.

On this page
import { Structures } from 'detritus-client';
153 classes · 10 interfaces · 11 type aliases · 7 variables · 4 functions

Classes

Classes you create or receive from the library.

classApplication Application Structure, used for channels, guilds, presences, etc.. 67 properties · 19 methods classApplicationActivityInstance Application Activity Instance Structure 5 properties · 1 method classApplicationActivityLocation Application Activity Location Structure 6 properties classApplicationCommand Application Command Structure 19 properties · 3 methods classApplicationCommandOption Application Command Option Structure 17 properties · 2 methods classApplicationCommandOptionChoice Application Command Option Choice Structure 5 properties · 1 method classApplicationCommandPermission Application Command Permission Structure 8 properties · 3 methods classApplicationCommandPermissions Application Command Permissions Structure 5 properties · 5 methods classApplicationInstallParams Basic Structure class with an added ShardClient attached to it 3 properties · 1 method classApplicationIntegrationTypeConfiguration Basic Structure class with an added ShardClient attached to it 2 properties · 1 method classApplicationNews Application News Structure 12 properties · 1 method classApplicationRoleConnectionMetadata Application Role Metadata Structure 6 properties · 1 method classApplicationThirdPartySku Basic Structure class with an added ShardClient attached to it 7 properties · 1 method classAttachment Attachment Structure, used in [Message] or [Interaction] objects 30 properties · 2 methods classAttachmentDeferred Attachment Deferred Structure, used to upload attachments to [Message] or [Interaction] objects 3 properties · 3 methods classAuditLog Guild Audit Log 13 properties · 1 method classAuditLogChange Guild Audit Log Change, used in [[AuditLog]] 4 properties · 1 method classAuditLogOptions Guild Audit Log Options, used in [[AuditLog]] 14 properties · 1 method classAutoModerationRule Auto Moderation Rule Structure 15 properties · 3 methods classAutoModerationRuleAction Auto Moderation Rule Action Structure, used for [AutoModerationRule] Structures 3 properties · 1 method classAutoModerationRuleActionMetadata Auto Moderation Rule Action Metadata Structure, used for [AutoModerationRuleAction] Structures 4 properties · 1 method classAutoModerationRuleTriggerMetadata Auto Moderation Rule Action Structure, used for [AutoModerationRule] Structures 7 properties · 1 method classBaseGuild Base Guild Structure 24 properties · 85 methods classBaseStructure Basic Structure class with an added ShardClient attached to it 3 properties · 1 method classChannelAvailableTag Channel Available Tag (As seen in [[ChannelGuildForum]]) 6 properties · 1 method classChannelBase Basic Channel Structure 109 properties · 56 methods classChannelDefaultReactionEmoji Channel Default Reaction Emoji (As seen in [[ChannelGuildForum]]) 2 properties · 1 method classChannelDM Single DM Channel 7 properties · 2 methods classChannelDMGroup Group DM Channel 6 properties · 3 methods classChannelGuildBase Basic Guild Channel 32 properties · 3 methods classChannelGuildCategory Guild Category Channel 1 property classChannelGuildDirectory Guild Directory Channel 1 property classChannelGuildForum Guild Forum Channel 3 properties · 1 method classChannelGuildMedia Guild Media Channel 1 property classChannelGuildStageVoice Guild Stage Voice Channel 2 properties · 1 method classChannelGuildStore Guild Store Channel 3 properties · 1 method classChannelGuildText Guild Text Channel, it can also be a news channel. 5 properties · 1 method classChannelGuildThread Guild Thread Channel 7 properties · 2 methods classChannelGuildVoice Guild Voice Channel 12 properties · 1 method classComponentActionRow Component Action Row Structure 3 properties · 1 method classComponentButton Component Button Structure 9 properties · 1 method classComponentCheckbox Component Checkbox Structure, received from modal submits 4 properties · 1 method classComponentCheckboxGroup Component Checkbox Group Structure, received from modal submits 4 properties · 1 method classComponentContainer Component Container Structure 5 properties · 1 method classComponentFile Component File Structure 4 properties · 1 method classComponentFileUpload Component File Upload Structure, received from modal submits (the values are attachment ids, found in the resolved data) 4 properties · 1 method classComponentInputText Component Input Text Structure 4 properties · 1 method classComponentLabel Component Label Structure, received from modal submits 3 properties · 1 method classComponentMediaGallery Component Media Gallery Structure 3 properties · 1 method classComponentMediaGalleryItem Component Media Gallery Item Structure 4 properties · 1 method classComponentRadioGroup Component Radio Group Structure, received from modal submits 4 properties · 1 method classComponentSection Component Section Structure 4 properties · 1 method classComponentSelectMenu Component Select Menu Structure 11 properties · 1 method classComponentSelectMenuDefaultValue Component Select Menu Default Value Structure 4 properties · 1 method classComponentSelectMenuOption Component Select Menu Option Structure 6 properties · 1 method classComponentSeparator Component Separator Structure 4 properties · 1 method classComponentTextDisplay Component Text Display Structure 3 properties · 1 method classComponentThumbnail Component Thumbnail Structure 5 properties · 1 method classComponentUnfurledMedia Component Unfurled Media Structure 11 properties · 1 method classComponentUnknown Component Unknown Structure 2 properties · 1 method classConnectedAccount Connected Account If from a user profile, it'll be partial 12 properties · 1 method classEmoji Emoji Structure 15 properties · 9 methods classEntitlement Entitlement Structure 18 properties · 4 methods classGift Discord Nitro Gift Structure 13 properties · 3 methods classGuild Guild Structure 83 properties · 10 methods classGuildBan Guild Ban Structure 4 properties · 2 methods classGuildMe Guild Me Structure 5 properties · 2 methods classGuildPartial Partial Guild Structure 10 properties · 3 methods classGuildScheduledEvent Guild Scheduled Event Structure 23 properties · 4 methods classGuildScheduledEventRecurrenceRule Guild Scheduled Event Recurrence Rule Structure 12 properties classGuildScheduledEventUser Guild Scheduled Event User Structure 4 properties · 1 method classGuildWelcomeScreen Guild Welcome Screen, used in [[Guild]] 2 properties · 1 method classGuildWelcomeScreenChannel Guild Welcome Screen Channel, used in [[GuildWelcomeScreen]] 5 properties · 1 method classIntegration Guild Integration Structure 19 properties · 1 method classIntegrationAccount Guild Integration Account Structure, used in [[Integration]] 3 properties · 1 method classInteraction Interaction Structure 38 properties · 12 methods classInteractionCallback Interaction Callback Structure 6 properties classInteractionCallbackResource Interaction Callback Resource Structure 3 properties · 1 method classInteractionCallbackResponse Interaction Callback Response Structure returned when responding to an interaction with withResponse 2 properties · 1 method classInteractionDataApplicationCommand Interaction Data Application Command Structure 13 properties · 2 methods classInteractionDataApplicationCommandOption Interaction Data Application Command Option Structure 9 properties · 1 method classInteractionDataApplicationCommandResolved Interaction Data Application Command Resolved Structure 8 properties · 2 methods classInteractionDataComponent Interaction Data Component Structure 5 properties · 1 method classInteractionDataModal Interaction Data Modal Structure 4 properties · 1 method classInvite Instant Invite Structure 29 properties · 8 methods classMember Guild Member Structure 57 properties · 21 methods classMessage Channel Message Structure 76 properties · 21 methods classMessageActivity Channel Message Activity Structure, used for inviting people to listen/join 7 properties · 1 method classMessageCall Channel Message Call Structure, used to define the call properties in the DM it's from Used to format the content 6 properties · 1 method classMessageEmbed Embed Structure, used for [Message] Structures 26 properties · 2 methods classMessageEmbedAuthor Embed Author Structure, used for [MessageEmbed] Structures 4 properties · 1 method classMessageEmbedField Embed Field Structure, used for [MessageEmbed] Structures 3 properties · 1 method classMessageEmbedFooter Embed Footer Structure, used for [ApplicationNews] and [MessageEmbed] Structures 3 properties · 1 method classMessageEmbedImage Embed Image Structure, used for [MessageEmbed] Structures 10 properties · 1 method classMessageEmbedProvider Embed Provider Structure, used for [MessageEmbed] Structures 2 properties · 1 method classMessageEmbedThumbnail Embed Thumbnail Structure, used for [ApplicationNews] and [MessageEmbed] Structures classMessageEmbedVideo Embed Video Structure, used for [MessageEmbed] Structures classMessageInteraction Channel Message Interaction Structure 6 properties · 1 method classMessageInteractionMetadata Channel Message Interaction Metadata Structure 12 properties · 1 method classMessagePoll Channel Message Poll Structure 12 properties · 2 methods classMessagePollAnswer Channel Message Poll Media Structure 5 properties · 2 methods classMessagePollMedia Channel Message Poll Media Structure 3 properties · 1 method classMessagePollResults Channel Message Poll Results Structure 4 properties · 2 methods classMessageReference Channel Message Reference Structure, used to tell the client that this is from a server webhook, a reply, or a forward Used for crossposts 8 properties · 1 method classMessageResolvedData Channel Message Resolved Data Structure 8 properties · 1 method classMessageRoleSubscriptionData Channel Message Role Subscription Data Structure 5 properties · 1 method classMessageSnapshot Channel Message Snapshot Structure 2 properties · 1 method classOverwrite Channel Overwrite Structure, used in [ChannelGuildBase] Structures 12 properties · 5 methods classPremiumSubscription Premium Subscription Structure, details a user's nitro boost on the server ATM, only non-bots will ever see these 8 properties · 1 method classPresence Presence Structure, used to detail a user's presence in a guild (or general if you have them added (non-bots only)) 14 properties · 4 methods classPresenceActivity Presence Activity Structure, used in [Presence] 51 properties · 7 methods classPresenceActivityAssets Presence Activity Assets Structure, used in [PresenceActivity] 8 properties · 4 methods classPresenceActivityTimestamps Presence Activity Timestamp Structure used to describe when they started doing an activity and if they ended it or not 5 properties · 1 method classProfile User Profile Structure only non-bots will ever see these 8 properties · 1 method classReaction Reaction Structure, used in [Message] we don't store the userIds since we only get them on reaction adds 15 properties · 6 methods classRelationship Relationship Structure Used to describe a relationship with a user (only non-bots) 9 properties · 1 method classRole Guild Role Structure, used in [Guild] 27 properties · 11 methods classRoleTags Guild Role Tags Structure, used in [Guild] 6 properties · 3 methods classSession Discord Session Structure (Users Only) 11 properties · 1 method classSessionClientInfo Session Client Info Structure, used in [Session] 4 properties · 2 methods classSku Sku Structure for Applications 24 properties · 2 methods classSoundboardSound Soundboard Sound Structure default sounds have no guildId 14 properties · 4 methods classStageInstance Stage Instance Structure 17 properties · 4 methods classSticker Sticker Structure 15 properties · 4 methods classStickerItem Sticker Item Structure 7 properties · 3 methods classStoreApplicationAsset Basic Structure class with an added ShardClient attached to it 8 properties · 3 methods classStoreListing Store Listing Structure Used for Store Channels ([ChannelGuildStore]) 16 properties · 1 method classStoreListingAsset Store Listing Asset Structure, used in [StoreListing] 6 properties · 1 method classStructure The most basic Structure class, every structure extends this 9 methods classSubscription Subscription Structure 17 properties · 1 method classSubscriptionPlan Subscription Plan, used in [[Gift]] 8 properties · 1 method classTeam Team Structure an application's team 9 properties · 10 methods classTeamMember Team Member Structure an application's team member 6 properties · 5 methods classTemplate Guild Template Structure 16 properties · 3 methods classThreadMember Thread Member Structure 8 properties · 3 methods classThreadMetadata Thread Metadata Structure 11 properties · 2 methods classTyping Channel Typing Structure used to tell you when someone starts typing in a channel 12 properties · 2 methods classUser Basic User Structure 46 properties · 16 methods classUserAvatarDecorationData User Avatar Decoration Data Structure 3 properties · 3 methods classUserClan User Clan Structure 4 properties · 1 method classUserCollectibles User Collectibles Structure 1 property · 1 method classUserCollectiblesNameplate User Collectibles Nameplate Structure 4 properties · 1 method classUserDisplayNameStyles User Display Name Styles Structure 3 properties · 1 method classUserExtended User Extended Structure received from /users/@me calls with an oauth2 token with correct permissions 9 properties · 2 methods classUserMe User Me Structure the current user, it has all their details 2 properties · 1 method classUserMixin User Mixin Structure Used to extend to receive all of [User]'s properties 47 properties · 15 methods classUserWithBanner Basic User Structure 4 properties · 2 methods classUserWithFlags User with Flags Structure used to describe someone's badges, you get them from me/profile/team owner 2 properties · 2 methods classUserWithToken User with Token Structure e.g. when you edit your user 1 property · 1 method classVoiceCall VoiceCall Structure a DM Channel's call (non-bots only) 10 properties · 7 methods classVoiceRegion Voice Region Structure 6 properties · 2 methods classVoiceState Voice State Structure 21 properties · 8 methods classWebhook Webhook Structure 21 properties · 10 methods

Interfaces

Object shapes for options, payloads and events.

Functions

Standalone helpers.

Type aliases

Named types used across the API.

Variables

Exported values.

EmbeddableRegexes

variable const src/structures/attachment.ts:15
const EmbeddableRegexes: Readonly<{ audio: RegExp; image: RegExp; video: RegExp }>
export const EmbeddableRegexes = Object.freeze({
  audio: /^(?:mp3|ogg|wav|flac)$/i,
  image: /^(?:png|jpe?g|webp|gif)$/i,
  video: /^(?:mp4|webm|mov)$/i,
});

ImageSizes

variable const src/structures/presence.ts:39
const ImageSizes: Readonly<{ LARGE: 160; SMALL: 64 }>
export const ImageSizes = Object.freeze({
  SMALL: 64,
  LARGE: 160,
});

keysStoreApplicationAsset

variable const src/structures/store.ts:202
const keysStoreApplicationAsset: BaseSet<string>
export const keysStoreApplicationAsset = new BaseSet<string>([
  DiscordKeys.APPLICATION_ID,
  DiscordKeys.FILENAME,
  DiscordKeys.HEIGHT,
  DiscordKeys.ID,
  DiscordKeys.MIME_TYPE,
  DiscordKeys.SIZE,
  DiscordKeys.WIDTH,
]);

MimeClassTypes

variable const src/structures/attachment.ts:21
const MimeClassTypes: { classType: string; regex: RegExp; type: string }[]
export const MimeClassTypes: Array<{
  classType: string,
  regex: RegExp,
  type: string,
}> = [
  {
    type: 'name',
    classType: 'acrobat',
    regex: /\.pdf$/i,
  },
  {
    type: 'name',
    classType: 'ae',
    regex: /\.ae/i,
  },
  {
    type: 'name',
    classType: 'ai',
    regex: /\.ai$/i,
  },
  {
    type: 'name',
    classType: 'archive',
    regex: /\.(?:rar|zip|7z|tar|tar\.gz)$/i,
  },
  {
    type: 'name',
    classType: 'audio',
    regex: /\.(?:mp3|ogg|wav|flac)$/i,
  },
  {
    type: 'name',
    classType: 'code',
    regex: /\.(?:c\+\+|cpp|cc|c|h|hpp|mm|m|json|js|rb|rake|py|asm|fs|pyc|dtd|cgi|bat|rss|java|graphml|idb|lua|o|gml|prl|sls|conf|cmake|make|sln|vbe|cxx|wbf|vbs|r|wml|php|bash|applescript|fcgi|yaml|ex|exs|sh|ml|actionscript)$/i,
  },
  {
    type: 'name',
    classType: 'document',
    regex: /\.(?:txt|rtf|doc|docx|md|pages|ppt|pptx|pptm|key|log)$/i,
  },
  {
    // before `image` since it's an `image/` mimetype too
    type: 'mime',
    classType: 'photoshop',
    regex: /^image\/vnd.adobe.photoshop/,
  },
  {
    type: 'mime',
    classType: 'image',
    regex: /^image\//,
  },
  {
    type: 'name',
    classType: 'sketch',
    regex: /\.sketch$/i,
  },
  {
    type: 'name',
    classType: 'spreadsheet',
    regex: /\.(?:xls|xlsx|numbers|csv)$/i,
  },
  {
    type: 'mime',
    classType: 'video',
    regex: /^video\//,
  },
  {
    type: 'name',
    classType: 'webcode',
    regex: /\.(?:html|xhtml|htm|js|xml|xls|xsd|css|styl)$/i,
  },
];

SpecialApplications

variable const src/structures/presence.ts:31
const SpecialApplications: Readonly<{ XBOX: "438122941302046720" }>
export const SpecialApplications = Object.freeze({
  XBOX: '438122941302046720',
});

SpecialPrefixes

variable const src/structures/presence.ts:35
const SpecialPrefixes: Readonly<{ SPOTIFY: "spotify:" }>
export const SpecialPrefixes = Object.freeze({
  SPOTIFY: 'spotify:',
});

SpecialThirdPartySkus

variable const src/structures/application.ts:41
const SpecialThirdPartySkus: { [key: string]: string }
export const SpecialThirdPartySkus: {[key: string]: string} = Object.freeze({
  'Call of Duty Black Ops 4': 'call-of-duty',
  'Call of Duty Modern Warfare': 'call-of-duty-mw',
  'StarCraft': 'starcraft-remastered',
  'World of Warcraft Classic': 'world-of-warcraft',
  'World of Warcraft Public Test': 'world-of-warcraft',
});