import { EventEmitter } from "events"; import { Duplex, Readable as ReadableStream, Stream } from "stream"; import { Agent as HTTPSAgent } from "https"; import { IncomingMessage, ClientRequest, IncomingHttpHeaders } from "http"; import OpusScript = require("opusscript"); // Thanks TypeScript import { URL } from "url"; import { Socket as DgramSocket } from "dgram"; import * as WebSocket from "ws"; import type Constants from "./lib/Constants.d.ts"; declare function Eris(token: string, options?: Eris.ClientOptions): Eris.Client; declare namespace Eris { export const Constants: Constants; export const VERSION: string; /** @deprecated */ export const PrivateChannel: typeof DMChannel; // TYPES // Application Commands type ApplicationCommandOptions = ApplicationCommandOptionsSubCommand | ApplicationCommandOptionsSubCommandGroup | ApplicationCommandOptionsWithValue; type ApplicationCommandOptionsBoolean = ApplicationCommandOption; type ApplicationCommandOptionsChannel = ApplicationCommandOption; type ApplicationCommandOptionsInteger = ApplicationCommandOptionsIntegerWithAutocomplete | ApplicationCommandOptionsIntegerWithoutAutocomplete | ApplicationCommandOptionsIntegerWithMinMax; type ApplicationCommandOptionsIntegerWithAutocomplete = Omit, "choices" | "min_value" | "max_value"> & AutocompleteEnabled; type ApplicationCommandOptionsIntegerWithoutAutocomplete = Omit, "autocomplete" | "min_value" | "max_value"> & AutocompleteDisabledInteger; type ApplicationCommandOptionsIntegerWithMinMax = Omit, "choices" | "autocomplete"> & AutocompleteDisabledIntegerMinMax; type ApplicationCommandOptionsMentionable = ApplicationCommandOption; type ApplicationCommandOptionsNumber = ApplicationCommandOptionsNumberWithAutocomplete | ApplicationCommandOptionsNumberWithoutAutocomplete | ApplicationCommandOptionsNumberWithMinMax; type ApplicationCommandOptionsNumberWithAutocomplete = Omit, "choices" | "min_value" | "max_value"> & AutocompleteEnabled; type ApplicationCommandOptionsNumberWithoutAutocomplete = Omit, "autocomplete" | "min_value" | "max_value"> & AutocompleteDisabledInteger; type ApplicationCommandOptionsNumberWithMinMax = Omit, "choices" | "autocomplete"> & AutocompleteDisabledIntegerMinMax; type ApplicationCommandOptionsRole = ApplicationCommandOption; type ApplicationCommandOptionsString = ApplicationCommandOptionsStringWithAutocomplete | ApplicationCommandOptionsStringWithoutAutocomplete; type ApplicationCommandOptionsStringWithAutocomplete = Omit, "choices"> & AutocompleteEnabled; type ApplicationCommandOptionsStringWithoutAutocomplete = Omit, "autocomplete"> & AutocompleteDisabled; type ApplicationCommandOptionsUser = ApplicationCommandOption; type ApplicationCommandOptionsWithValue = ApplicationCommandOptionsString | ApplicationCommandOptionsInteger | ApplicationCommandOptionsBoolean | ApplicationCommandOptionsUser | ApplicationCommandOptionsChannel | ApplicationCommandOptionsRole | ApplicationCommandOptionsMentionable | ApplicationCommandOptionsNumber; type ApplicationCommandPermissionTypes = Constants["ApplicationCommandPermissionTypes"][keyof Constants["ApplicationCommandPermissionTypes"]]; type ApplicationCommandTypes = Constants["ApplicationCommandTypes"][keyof Constants["ApplicationCommandTypes"]]; type ModalSubmitInteractionDataComponent = ModalSubmitInteractionDataTextInputComponent; // Auto Moderation type AutoModerationActionType = Constants["AutoModerationActionTypes"][keyof Constants["AutoModerationActionTypes"]]; type AutoModerationEventType = Constants["AutoModerationEventTypes"][keyof Constants["AutoModerationEventTypes"]]; type AutoModerationKeywordPresetType = Constants["AutoModerationKeywordPresetTypes"][keyof Constants["AutoModerationKeywordPresetTypes"]]; type AutoModerationTriggerType = Constants["AutoModerationTriggerTypes"][keyof Constants["AutoModerationTriggerTypes"]]; type EditAutoModerationRuleOptions = Partial; // Cache interface Uncached { id: string } // Channel type AnyChannel = AnyGuildChannel | AnyThreadChannel | DMChannel | GroupChannel; type AnyGuildChannel = AnyGuildTextableChannel | AnyThreadChannel | CategoryChannel | ForumChannel | MediaChannel; type AnyGuildTextableChannel = TextChannel | VoiceChannel | NewsChannel | StageChannel; type AnyThreadChannel = NewsThreadChannel | PrivateThreadChannel | PublicThreadChannel | ThreadChannel; type AnyVoiceChannel = VoiceChannel | StageChannel; type ChannelTypeConversion = T extends Constants["ChannelTypes"]["GUILD_TEXT"] ? TextChannel : T extends Constants["ChannelTypes"]["GUILD_VOICE"] ? VoiceChannel : T extends Constants["ChannelTypes"]["GUILD_CATEGORY"] ? CategoryChannel : T extends Constants["ChannelTypes"]["GUILD_NEWS"] ? NewsChannel : T extends Constants["ChannelTypes"]["GUILD_STAGE_VOICE"] ? StageChannel : T extends Constants["ChannelTypes"]["GUILD_FORUM"] ? ForumChannel : T extends Constants["ChannelTypes"]["GUILD_MEDIA"] ? MediaChannel : never; type EditGuildChannelOptions = EditForumChannelOptions | EditMediaChannelOptions | EditGuildTextableChannelOptions; type EditGuildTextableChannelOptions = EditNewsChannelOptions | EditTextChannelOptions | EditThreadChannelOptions | EditVoiceChannelOptions; type GuildTextableWithThreads = AnyGuildTextableChannel | GuildTextableChannel | AnyThreadChannel; type InviteChannel = InvitePartialChannel | Exclude; type PossiblyUncachedSpeakableChannel = AnyVoiceChannel | Uncached; type PossiblyUncachedTextableChannel = TextableChannel | Uncached; type TextableChannel = GuildTextableWithThreads | DMChannel; type VideoQualityMode = Constants["VideoQualityModes"][keyof Constants["VideoQualityModes"]]; // Channel Types type ChannelTypes = GuildChannelTypes | PrivateChannelTypes; type GuildChannelTypes = Exclude; type GuildTextChannelTypes = Constants["ChannelTypes"][keyof Pick]; type GuildVoiceChannelTypes = Constants["ChannelTypes"][keyof Pick]; type GuildThreadChannelTypes = Constants["ChannelTypes"][keyof Pick]; type GuildPublicThreadChannelTypes = Exclude; type PrivateChannelTypes = Constants["ChannelTypes"][keyof Pick]; type TextChannelTypes = GuildTextChannelTypes | PrivateChannelTypes; type TextVoiceChannelTypes = Constants["ChannelTypes"][keyof Pick]; // Client type ApplicationRoleConnectionMetadataTypes = Constants["RoleConnectionMetadataTypes"][keyof Constants["RoleConnectionMetadataTypes"]]; type MembershipStates = Constants["MembershipState"][keyof Constants["MembershipState"]]; type OAuthTeamMemberRoleTypes = Constants["OAuthTeamMemberRoleTypes"][keyof Constants["OAuthTeamMemberRoleTypes"]]; // Command type CommandGenerator = CommandGeneratorFunction | MessageContent | MessageContent[] | CommandGeneratorFunction[]; type CommandGeneratorFunction = (msg: Message, args: string[]) => GeneratorFunctionReturn; type GeneratorFunctionReturn = Promise | Promise | MessageContent | void; type GenericCheckFunction = (msg: Message) => T | Promise; type ReactionButtonsFilterFunction = (msg: Message, emoji: Emoji, userID: string) => boolean; type ReactionButtonsGenerator = ReactionButtonsGeneratorFunction | MessageContent | MessageContent[] | ReactionButtonsGeneratorFunction[]; type ReactionButtonsGeneratorFunction = (msg: Message, args: string[], userID: string) => GeneratorFunctionReturn; // Gateway/REST type IntentStrings = keyof Constants["Intents"]; type ReconnectDelayFunction = (lastDelay: number, attempts: number) => number; type RequestMethod = "GET" | "PATCH" | "DELETE" | "POST" | "PUT"; // Guild type DefaultNotifications = Constants["DefaultMessageNotificationLevels"][keyof Constants["DefaultMessageNotificationLevels"]]; type ExplicitContentFilter = Constants["ExplicitContentFilterLevels"][keyof Constants["ExplicitContentFilterLevels"]]; type GuildFeatures = Constants["GuildFeatures"][number]; type GuildIntegrationExpireBehavior = Constants["GuildIntegrationExpireBehavior"][keyof Constants["GuildIntegrationExpireBehavior"]]; type GuildIntegrationTypes = Constants["GuildIntegrationTypes"][number]; type GuildScheduledEventEditOptions = GuildScheduledEventEditOptionsExternal | GuildScheduledEventEditOptionsDiscord | GuildScheduledEventEditOptionsBase; type GuildScheduledEventEntityTypes = Constants["GuildScheduledEventEntityTypes"][keyof Constants["GuildScheduledEventEntityTypes"]]; type GuildScheduledEventOptions = GuildScheduledEventOptionsExternal | GuildScheduledEventOptionsDiscord | GuildScheduledEventOptionsBase; type GuildScheduledEventPrivacyLevel = Constants["GuildScheduledEventPrivacyLevel"][keyof Constants["GuildScheduledEventPrivacyLevel"]]; type GuildScheduledEventStatus = Constants["GuildScheduledEventStatus"][keyof Constants["GuildScheduledEventStatus"]]; type GuildWidgetStyles = Constants["GuildWidgetStyles"][keyof Constants["GuildWidgetStyles"]]; type MFALevel = Constants["MFALevels"][keyof Constants["MFALevels"]]; type NSFWLevel = Constants["GuildNSFWLevels"][keyof Constants["GuildNSFWLevels"]]; type OnboardingModes = Constants["GuildOnboardingModes"][keyof Constants["GuildOnboardingModes"]]; type OnboardingPromptTypes = Constants["GuildOnboardingPromptTypes"][keyof Constants["GuildOnboardingPromptTypes"]]; type PermissionValueTypes = bigint | number | string; type PossiblyUncachedGuild = Guild | Uncached; type PossiblyUncachedGuildScheduledEvent = GuildScheduledEvent | Uncached; type PremiumTier = Constants["PremiumTiers"][keyof Constants["PremiumTiers"]]; type SystemChannelFlags = Constants["SystemChannelFlags"][keyof Constants["SystemChannelFlags"]]; type VerificationLevel = Constants["VerificationLevels"][keyof Constants["VerificationLevels"]]; // Interaction type AnyInteraction = PingInteraction | CommandInteraction | ComponentInteraction | AutocompleteInteraction | ModalSubmitInteraction; type InteractionCallbackData = InteractionAutocomplete | InteractionContent | InteractionModal; type InteractionContent = Pick; type InteractionContentEdit = Pick; type InteractionDataOptions = InteractionDataOptionsSubCommand | InteractionDataOptionsSubCommandGroup | InteractionDataOptionsWithValue; type InteractionDataOptionsBoolean = InteractionDataOptionWithValue; type InteractionDataOptionsChannel = InteractionDataOptionWithValue; type InteractionDataOptionsInteger = InteractionDataOptionWithValue; type InteractionDataOptionsMentionable = InteractionDataOptionWithValue; type InteractionDataOptionsNumber = InteractionDataOptionWithValue; type InteractionDataOptionsRole = InteractionDataOptionWithValue; type InteractionDataOptionsString = InteractionDataOptionWithValue; type InteractionDataOptionsUser = InteractionDataOptionWithValue; type InteractionDataOptionsWithValue = InteractionDataOptionsString | InteractionDataOptionsInteger | InteractionDataOptionsBoolean | InteractionDataOptionsUser | InteractionDataOptionsChannel | InteractionDataOptionsRole | InteractionDataOptionsMentionable | InteractionDataOptionsNumber; type InteractionResponseTypes = Constants["InteractionResponseTypes"][keyof Constants["InteractionResponseTypes"]]; type InteractionTypes = Constants["InteractionTypes"][keyof Constants["InteractionTypes"]]; type LocaleStrings = Constants["Locales"][keyof Constants["Locales"]]; // Invite type InviteTargetTypes = Constants["InviteTargetTypes"][keyof Constants["InviteTargetTypes"]]; // Message type ActionRowComponents = Button | SelectMenu; type Button = InteractionButton | URLButton; type ButtonStyles = Constants["ButtonStyles"][keyof Constants["ButtonStyles"]]; type Component = ActionRow | ActionRowComponents; type ImageFormat = Constants["ImageFormats"][number]; type MessageActivityTypes = Constants["MessageActivityTypes"][keyof Constants["MessageActivityTypes"]]; type MessageContent = string | AdvancedMessageContent; type MessageContentEdit = string | AdvancedMessageContentEdit; type MessageReferenceTypes = Constants["MessageReferenceTypes"][keyof Constants["MessageReferenceTypes"]]; type PollLayoutTypes = Constants["PollLayoutTypes"][keyof Constants["PollLayoutTypes"]]; type PossiblyUncachedMessage = Message | { channel: TextableChannel | { id: string; guild?: Uncached }; guildID?: string; id: string }; type ReactionTypes = Constants["ReactionTypes"][keyof Constants["ReactionTypes"]]; // Permission type PermissionType = Constants["PermissionOverwriteTypes"][keyof Constants["PermissionOverwriteTypes"]]; // Presence type ActivityFlags = Constants["ActivityFlags"][keyof Constants["ActivityFlags"]]; type ActivityType = Constants["ActivityTypes"][keyof Constants["ActivityTypes"]]; type SelfStatus = Status | "invisible"; type Status = "online" | "idle" | "dnd"; type UserStatus = Status | "offline"; // Sticker type StickerFormats = Constants["StickerFormats"][keyof Constants["StickerFormats"]]; type StickerTypes = Constants["StickerTypes"][keyof Constants["StickerTypes"]]; // Thread/Forum type AutoArchiveDuration = 60 | 1440 | 4320 | 10080; type ChannelFlags = Constants["ChannelFlags"][keyof Constants["ChannelFlags"]]; type ForumLayoutTypes = Constants["ForumLayoutTypes"][keyof Constants["ForumLayoutTypes"]]; type SortOrderTypes = Constants["SortOrderTypes"][keyof Constants["SortOrderTypes"]]; // User type PremiumTypes = Constants["PremiumTypes"][keyof Constants["PremiumTypes"]]; // Voice type ConverterCommand = "./ffmpeg" | "./avconv" | "ffmpeg" | "avconv"; type StageInstancePrivacyLevel = Constants["StageInstancePrivacyLevel"][keyof Constants["StageInstancePrivacyLevel"]]; // Webhook type WebhookPayloadEdit = Pick; type WebhookTypes = Constants["WebhookTypes"][keyof Constants["WebhookTypes"]]; // INTERFACES // Internals type JSONCache = Record; interface NestedJSON { toJSON(arg?: unknown, cache?: (string | unknown)[]): JSONCache; } interface SimpleJSON { toJSON(props?: string[]): JSONCache; } // Application Commands /** Generic T is `true` if editing Guild scoped commands, and `false` if not */ interface ApplicationCommandEditOptions { defaultMemberPermissions?: bigint | number | string | Permission | null; /** @deprecated */ defaultPermission?: boolean; description?: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? string : "" | void; descriptionLocalizations?: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? Record | null : null; dmPermission?: T extends true ? never : boolean | null; name?: string; nameLocalizations?: Record | null; nsfw?: boolean; options?: ApplicationCommandOptions[]; } /** Generic T is `true` if creating Guild scoped commands, and `false` if not */ interface ApplicationCommandCreateOptions extends ApplicationCommandEditOptions { description: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? string : "" | void; name: string; type?: U; } /** Generic T is `true` if editing Guild scoped commands, and `false` if not */ interface ApplicationCommandBulkEditOptions extends ApplicationCommandCreateOptions { id?: string; } interface ApplicationCommandOption]> { channel_types: T extends Constants["ApplicationCommandOptionTypes"]["CHANNEL"] ? ChannelTypes | undefined : never; description: string; descriptionLocalizations?: Record | null; name: string; nameLocalizations?: Record | null; required?: boolean; type: T; } interface ApplicationCommandOptionChoice] | unknown = unknown> { name: string; value: T extends Constants["ApplicationCommandOptionTypes"]["STRING"] ? string : T extends Constants["ApplicationCommandOptionTypes"]["NUMBER"] ? number : T extends Constants["ApplicationCommandOptionTypes"]["INTEGER"] ? number : number | string; } interface ApplicationCommandOptionsSubCommand { description: string; descriptionLocalizations?: Record | null; name: string; nameLocalizations?: Record | null; options?: ApplicationCommandOptionsWithValue[]; type: Constants["ApplicationCommandOptionTypes"]["SUB_COMMAND"]; } interface ApplicationCommandOptionsSubCommandGroup { description: string; descriptionLocalizations?: Record | null; name: string; nameLocalizations?: Record | null; options?: (ApplicationCommandOptionsSubCommand | ApplicationCommandOptionsWithValue)[]; type: Constants["ApplicationCommandOptionTypes"]["SUB_COMMAND_GROUP"]; } interface ApplicationCommandOptionWithChoices] = Constants["ApplicationCommandOptionTypes"][keyof Pick]> { autocomplete?: boolean; choices?: ApplicationCommandOptionChoice[]; description: string; descriptionLocalizations?: Record | null; name: string; nameLocalizations?: Record | null; required?: boolean; type: T; } interface ApplicationCommandOptionWithMinMax] = Constants["ApplicationCommandOptionTypes"][keyof Pick]> { autocomplete?: boolean; choices?: ApplicationCommandOptionChoice[]; description: string; descriptionLocalizations?: Record | null; max_value?: number; min_value?: number; name: string; nameLocalizations?: Record | null; required?: boolean; type: T; } interface ApplicationCommandPermissions { id: string; permission: boolean; type: ApplicationCommandPermissionTypes; } interface AutocompleteEnabled { autocomplete: true; } interface AutocompleteDisabled { autocomplete?: false; } interface AutocompleteDisabledInteger extends AutocompleteDisabled { min_value?: null; max_value?: null; } interface AutocompleteDisabledIntegerMinMax extends AutocompleteDisabled { choices?: null; } interface GuildApplicationCommandPermissions { application_id: string; guild_id: string; id: string; permissions: ApplicationCommandPermissions[]; } // Auto Moderation interface AutoModerationAction { metadata?: AutoModerationActionMetadata; type: AutoModerationActionType; } interface AutoModerationActionExecution { action: AutoModerationAction; alertSystemMessageID?: string; channelID?: string; content?: string; guildID: string; matchedContent?: string | null; matchedKeyword: string | null; messageID?: string; ruleID: string; ruleTriggerType: AutoModerationTriggerType; userID: string; } interface AutoModerationActionMetadata { /** valid for SEND_ALERT_MESSAGE */ channelID?: string; /** valid for TIMEOUT */ durationSeconds?: number; } interface AutoModerationRule { actions: AutoModerationAction[]; creatorID: string; enabled: boolean; eventType: AutoModerationEventType; exemptRoles: string[]; exemptUsers: string[]; guildID: string; id: string; name: string; triggerMetadata: AutoModerationTriggerMetadata; triggerType: AutoModerationTriggerType; } interface CreateAutoModerationRuleOptions { actions: AutoModerationAction[]; enabled?: boolean; eventType: AutoModerationActionType; exemptChannels?: string[]; exemptRoles?: string[]; name: string; reason?: string; triggerMetadata?: AutoModerationTriggerMetadata; triggerType: AutoModerationTriggerType; } interface AutoModerationTriggerMetadata { /** valid for KEYWORD */ keywordFilter: string[]; /** valid for KEYWORD_PRESET */ presets: AutoModerationKeywordPresetType[]; } // Channel interface ChannelFollow { channel_id: string; webhook_id: string; } interface ChannelPosition extends EditChannelPositionOptions { id: string; position?: number; } interface CreateChannelOptions { availableTags?: ForumTag[]; bitrate?: number; defaultAutoArchiveDuration?: AutoArchiveDuration; defaultForumLayout?: ForumLayoutTypes; defaultReactionEmoji?: DefaultReactionEmoji; defaultSortOrder?: SortOrderTypes; defaultThreadRateLimitPerUser?: number; nsfw?: boolean; parentID?: string; permissionOverwrites?: Overwrite[]; position?: number; rateLimitPerUser?: number; reason?: string; topic?: string; userLimit?: number; } interface EditChannelOptionsBase { name?: string; position?: number; permissionOverwrites?: Overwrite[]; } interface EditNewsChannelOptions extends EditChannelOptionsBase { defaultAutoArchiveDuration?: AutoArchiveDuration | null; nsfw?: boolean | null; parentID?: string | null; topic?: string | null; type?: GuildTextChannelTypes; } interface EditTextChannelOptions extends EditNewsChannelOptions { defaultThreadRateLimitPerUser?: number | null; rateLimitPerUser?: number | null; } interface EditVoiceChannelOptions extends EditChannelOptionsBase { bitrate?: number | null; nsfw?: boolean | null; parentID?: string | null; rateLimitPerUser?: number | null; rtcRegion?: string | null; userLimit?: number | null; videoQualityMode?: VideoQualityMode | null; } interface EditMediaChannelOptions extends EditChannelOptionsBase { availableTags?: ForumTag[]; defaultAutoArchiveDuration?: AutoArchiveDuration | null; defaultReactionEmoji?: DefaultReactionEmoji | null; defaultSortOrder?: SortOrderTypes | null; defaultThreadRateLimitPerUser?: number; flags?: ChannelFlags; nsfw?: boolean | null; parentID?: string | null; rateLimitPerUser?: number | null; topic?: string | null; } interface EditForumChannelOptions extends EditMediaChannelOptions { defaultForumLayout?: ForumLayoutTypes | null; } interface EditThreadChannelOptions { appliedTags?: string[]; archived?: boolean; autoArchiveDuration?: AutoArchiveDuration; flags?: ChannelFlags; invitable?: boolean; locked?: boolean; name?: string; rateLimitPerUser?: number | null; } interface EditChannelPositionOptions { lockPermissions?: boolean; parentID?: string; } interface EditGroupChannelOptions { icon?: string | null; name?: string; } interface GetMessagesOptions { after?: string; around?: string; before?: string; limit?: number; } interface GroupRecipientOptions { accessToken: string; nick?: string; } interface PartialChannel { bitrate?: number; id: string; name?: string; nsfw?: boolean; parent_id?: number; permission_overwrites?: Overwrite[]; rate_limit_per_user?: number; topic?: string | null; type: number; user_limit?: number; } interface Permissionable { permissionOverwrites: Collection; position: number; deletePermission(overwriteID: string, reason?: string): Promise; editPermission(overwriteID: string, allow: PermissionValueTypes, deny: PermissionValueTypes, type: PermissionType, reason?: string): Promise; } interface Pinnable { lastPinTimestamp: number | null; getPins(): Promise; pinMessage(messageID: string): Promise; unpinMessage(messageID: string): Promise; } interface PurgeChannelOptions { after?: string; before?: string; filter?: (m: Message) => boolean; limit: number; reason?: string; } interface WebhookData { channelID: string; guildID: string; } // Client interface ApplicationRoleConnectionMetadata { description: string; description_localizations?: Record; key: string; name: string; name_localizations?: Record; type: ApplicationRoleConnectionMetadataTypes; } interface ClientOptions { /** @deprecated */ agent?: HTTPSAgent; allowedMentions?: AllowedMentions; autoreconnect?: boolean; compress?: boolean; connectionTimeout?: number; defaultImageFormat?: string; defaultImageSize?: number; disableEvents?: Record; firstShardID?: number; getAllUsers?: boolean; guildCreateTimeout?: number; intents: number | (IntentStrings | number)[]; largeThreshold?: number; lastShardID?: number; /** @deprecated */ latencyThreshold?: number; maxReconnectAttempts?: number; maxResumeAttempts?: number; maxShards?: number | "auto"; messageLimit?: number; opusOnly?: boolean; /** @deprecated */ ratelimiterOffset?: number; reconnectDelay?: ReconnectDelayFunction; requestTimeout?: number; rest?: RequestHandlerOptions; restMode?: boolean; seedVoiceConnections?: boolean; shardConcurrency?: number | "auto"; ws?: unknown; } interface CommandClientOptions { argsSplitter?: (str: string) => string[]; defaultCommandOptions?: CommandOptions; defaultHelpCommand?: boolean; description?: string; ignoreBots?: boolean; ignoreSelf?: boolean; name?: string; owner?: string; prefix?: string | string[]; } interface EditSelfOptions { avatar?: string | null; banner?: string | null; username?: string; } interface RequestHandlerOptions { agent?: HTTPSAgent; baseURL?: string; decodeReasons?: boolean; disableLatencyCompensation?: boolean; domain?: string; latencyThreshold?: number; ratelimiterOffset?: number; requestTimeout?: number; } // Command interface CommandCooldownExclusions { channelIDs?: string[]; guildIDs?: string[]; userIDs?: string[]; } interface CommandOptions { aliases?: string[]; argsRequired?: boolean; caseInsensitive?: boolean; cooldown?: number; cooldownExclusions?: CommandCooldownExclusions; cooldownMessage?: MessageContent | GenericCheckFunction | false; cooldownReturns?: number; defaultSubcommandOptions?: CommandOptions; deleteCommand?: boolean; description?: string; dmOnly?: boolean; errorMessage?: MessageContent | GenericCheckFunction; fullDescription?: string; guildOnly?: boolean; hidden?: boolean; hooks?: Hooks; invalidUsageMessage?: MessageContent | GenericCheckFunction | false; permissionMessage?: MessageContent | GenericCheckFunction | false; reactionButtons?: CommandReactionButtonsOptions[] | null; reactionButtonTimeout?: number; requirements?: CommandRequirements; restartCooldown?: boolean; usage?: string; } interface CommandReactionButtons extends CommandReactionButtonsOptions { execute: (msg: Message, args: string[], userID: string) => string | GeneratorFunctionReturn; responses: ((() => string) | ReactionButtonsGeneratorFunction)[]; } interface CommandReactionButtonsOptions { emoji: string; filter: ReactionButtonsFilterFunction; response: string | ReactionButtonsGeneratorFunction; type: "edit" | "cancel"; } interface CommandRequirements { custom?: GenericCheckFunction; permissions?: Record | GenericCheckFunction>; roleIDs?: string[] | GenericCheckFunction; roleNames?: string[] | GenericCheckFunction; userIDs?: string[] | GenericCheckFunction; } interface Hooks { postCheck?: (msg: Message, args: string[], checksPassed: boolean) => void; postCommand?: (msg: Message, args: string[], sent?: Message) => void; postExecution?: (msg: Message, args: string[], executionSuccess: boolean) => void; preCommand?: (msg: Message, args: string[]) => void; } // Embed // Omit used to override interface Embed extends Omit { author?: EmbedAuthor; footer?: EmbedFooter; image?: EmbedImage; provider?: EmbedProvider; thumbnail?: EmbedImage; type: string; video?: EmbedVideo; } interface EmbedAuthor extends EmbedAuthorOptions { proxy_icon_url?: string; } interface EmbedAuthorOptions { icon_url?: string; name: string; url?: string; } interface EmbedField { inline?: boolean; name: string; value: string; } interface EmbedFooter extends EmbedFooterOptions { proxy_icon_url?: string; } interface EmbedFooterOptions { icon_url?: string; text: string; } interface EmbedImage extends EmbedImageOptions { height?: number; proxy_url?: string; width?: number; } interface EmbedImageOptions { url?: string; } interface EmbedOptions { author?: EmbedAuthorOptions; color?: number; description?: string; fields?: EmbedField[]; footer?: EmbedFooterOptions; image?: EmbedImageOptions; thumbnail?: EmbedImageOptions; timestamp?: Date | string; title?: string; url?: string; } interface EmbedProvider { name?: string; url?: string; } interface EmbedVideo { height?: number; proxy_url?: string; url?: string; width?: number; } // Emoji interface Emoji extends EmojiBase { animated: boolean; available: boolean; id: string; managed: boolean; require_colons: boolean; roles: string[]; user?: PartialUser; } interface EmojiBase { icon?: string; name: string; } interface EmojiOptions extends Exclude { image: string; roles?: string[]; } interface PartialEmoji { id: string | null; name: string; animated?: boolean; } // Events interface OldCall { endedTimestamp?: number; participants: string[]; region: string; ringing: string[]; unavailable: boolean; } interface OldForumChannel extends OldGuildChannel { availableTags: ForumTag[]; defaultAutoArchiveDuration: AutoArchiveDuration; defaultForumLayout: ForumLayoutTypes; defaultReactionEmoji: DefaultReactionEmoji; defaultSortOrder: SortOrderTypes; defaultThreadRateLimitPerUser: number; } interface OldGroupChannel { icon: string; name: string; ownerID: string; type: Constants["ChannelTypes"]["GROUP_DM"]; } interface OldGuild { afkChannelID: string | null; afkTimeout: number; autoRemoved: boolean | null; banner: string | null; defaultNotifications: DefaultNotifications; description: string | null; discoverySplash: string | null; emojiCount: number | null; emojis: Omit[]; explicitContentFilter: ExplicitContentFilter; features: GuildFeatures[]; icon: string | null; keywords: string[] | null; large: boolean; maxMembers?: number; maxVideoChannelUsers?: number; mfaLevel: MFALevel; name: string; /** @deprecated */ nsfw: boolean; nsfwLevel: NSFWLevel; ownerID: string; preferredLocale?: LocaleStrings; premiumProgressBarEnabled: boolean; premiumSubscriptionCount?: number; premiumTier: PremiumTier; primaryCategory?: DiscoveryCategory; primaryCategoryID: number | null; publicUpdatesChannelID: string | null; rulesChannelID: string | null; splash: string | null; stickers?: Sticker[]; systemChannelFlags: number; systemChannelID: string | null; vanityURL: string | null; verificationLevel: VerificationLevel; welcomeScreen?: WelcomeScreen; } interface OldGuildChannel { bitrate?: number; flags?: number; name: string; nsfw?: boolean; parentID: string | null; permissionOverwrites: Collection; position: number; rateLimitPerUser?: number; rtcRegion?: string | null; topic?: string | null; type: GuildChannelTypes; } interface OldGuildScheduledEvent { channel: PossiblyUncachedSpeakableChannel | null; description?: string | null; entityID: string | null; entityMetadata: GuildScheduledEventMetadata | null; entityType: GuildScheduledEventEntityTypes; image?: string; name: string; privacyLevel: GuildScheduledEventPrivacyLevel; scheduledEndTime: number | null; scheduledStartTime: number; status: GuildScheduledEventStatus; } interface OldGuildTextChannel extends OldGuildChannel { nsfw: boolean; rateLimitPerUser: number; topic?: string | null; type: GuildTextChannelTypes; } interface OldMember { avatar: string | null; avatarDecorationData?: AvatarDecorationData | null; communicationDisabledUntil?: number | null; nick: string | null; pending?: boolean; premiumSince?: number | null; roles: string[]; } interface OldMessage { attachments: Attachment[]; channelMentions: string[]; content: string; editedTimestamp?: number; embeds: Embed[]; flags: number; mentionedBy?: unknown; mentions: User[]; pinned: boolean; poll?: Poll; roleMentions: string[]; tts: boolean; } interface OldRole { color: number; flags: number; hoist: boolean; icon: string | null; managed: boolean; mentionable: boolean; name: string; permissions: Permission; position: number; unicodeEmoji: string | null; } interface OldStageInstance { discoverableDisabled: boolean; privacyLevel: StageInstancePrivacyLevel; topic: string; } interface OldVoiceChannel extends OldGuildChannel { bitrate: number; rtcRegion: string | null; type: GuildVoiceChannelTypes; userLimit: number; videoQualityMode: VideoQualityMode; } interface OldThread { appliedTags: string[]; autoArchiveDuration: number; name: string; rateLimitPerUser: number; threadMetadata: ThreadMetadata; } interface OldThreadMember { flags: number; } interface OldVoiceState { deaf: boolean; mute: boolean; selfDeaf: boolean; selfMute: boolean; selfStream: boolean; selfVideo: boolean; } interface EventListeners { applicationCommandPermissionsUpdate: [applicationCommandPermissions: GuildApplicationCommandPermissions]; autoModerationActionExecution: [guild: Guild, action: AutoModerationActionExecution]; autoModerationRuleCreate: [guild: Guild, rule: AutoModerationRule]; autoModerationRuleDelete: [guild: Guild, rule: AutoModerationRule]; autoModerationRuleUpdate: [guild: Guild, rule: AutoModerationRule | null, newRule: AutoModerationRule]; channelCreate: [channel: AnyGuildChannel]; channelDelete: [channel: Exclude]; channelPinUpdate: [channel: TextableChannel, timestamp: number, oldTimestamp: number]; channelUpdate: [channel: AnyGuildChannel, oldChannel: OldGuildChannel | OldForumChannel | OldGuildTextChannel | OldVoiceChannel] | [channel: GroupChannel, oldChannel: OldGroupChannel]; connect: [id: number]; debug: [message: string, id?: number]; disconnect: []; error: [err: Error, id?: number]; guildAuditLogEntryCreate: [guildAuditLogEntry: GuildAuditLogEntry]; guildAvailable: [guild: Guild]; guildBanAdd: [guild: Guild, user: User]; guildBanRemove: [guild: Guild, user: User]; guildCreate: [guild: Guild]; guildDelete: [guild: PossiblyUncachedGuild]; guildEmojisUpdate: [guild: PossiblyUncachedGuild, emojis: Emoji[], oldEmojis: Emoji[] | null]; guildIntegrationsUpdate: [guild: PossiblyUncachedGuild]; guildMemberAdd: [guild: Guild, member: Member]; guildMemberChunk: [guild: Guild, member: Member[]]; guildMemberRemove: [guild: Guild, member: Member | MemberPartial]; guildMemberUpdate: [guild: Guild, member: Member, oldMember: OldMember | null]; guildRoleCreate: [guild: Guild, role: Role]; guildRoleDelete: [guild: Guild, role: Role]; guildRoleUpdate: [guild: Guild, role: Role, oldRole: OldRole]; guildScheduledEventCreate: [event: GuildScheduledEvent]; guildScheduledEventDelete: [event: GuildScheduledEvent]; guildScheduledEventUpdate: [event: GuildScheduledEvent, oldEvent: OldGuildScheduledEvent | null]; guildScheduledEventUserAdd: [event: PossiblyUncachedGuildScheduledEvent, user: User | Uncached]; guildScheduledEventUserRemove: [event: PossiblyUncachedGuildScheduledEvent, user: User | Uncached]; guildStickersUpdate: [guild: PossiblyUncachedGuild, stickers: Sticker[], oldStickers: Sticker[] | null]; guildUnavailable: [guild: UnavailableGuild]; guildUpdate: [guild: Guild, oldGuild: OldGuild]; hello: [trace: string[], id: number]; interactionCreate: [interaction: PingInteraction | CommandInteraction | ComponentInteraction | AutocompleteInteraction | ModalSubmitInteraction | UnknownInteraction]; inviteCreate: [guild: Guild, invite: Invite]; inviteDelete: [guild: Guild, invite: Invite]; messageCreate: [message: Message]; messageDelete: [message: PossiblyUncachedMessage]; messageDeleteBulk: [messages: PossiblyUncachedMessage[]]; messagePollVoteAdd: [message: PossiblyUncachedMessage, user: User | Uncached, answerID: number]; messagePollVoteRemove: [message: PossiblyUncachedMessage, user: User | Uncached, answerID: number]; messageReactionAdd: [message: PossiblyUncachedMessage, emoji: PartialEmoji, reactor: Member | Uncached, burst: boolean]; messageReactionRemove: [message: PossiblyUncachedMessage, emoji: PartialEmoji, userID: string, burst: boolean]; messageReactionRemoveAll: [message: PossiblyUncachedMessage]; messageReactionRemoveEmoji: [message: PossiblyUncachedMessage, emoji: PartialEmoji]; messageUpdate: [message: Message, oldMessage: OldMessage | null]; presenceUpdate: [other: Member, oldPresence: Presence | null]; rawREST: [request: RawRESTRequest]; rawWS: [packet: RawPacket, id: number]; ready: []; shardPreReady: [id: number]; stageInstanceCreate: [stageInstance: StageInstance]; stageInstanceDelete: [stageInstance: StageInstance]; stageInstanceUpdate: [stageInstance: StageInstance, oldStageInstance: OldStageInstance | null]; threadCreate: [channel: AnyThreadChannel]; threadDelete: [channel: AnyThreadChannel]; threadListSync: [guild: Guild, deletedThreads: (AnyThreadChannel | Uncached)[], activeThreads: AnyThreadChannel[], joinedThreadsMember: ThreadMember[]]; threadMembersUpdate: [channel: AnyThreadChannel, addedMembers: ThreadMember[], removedMembers: (ThreadMember | Uncached)[]]; threadMemberUpdate: [channel: AnyThreadChannel, member: ThreadMember, oldMember: OldThreadMember]; threadUpdate: [channel: AnyThreadChannel, oldChannel: OldThread | null]; typingStart: [channel: AnyGuildTextableChannel | Uncached, user: User | Uncached, member: Member] | [channel: DMChannel | Uncached, user: User | Uncached, member: null]; unavailableGuildCreate: [guild: UnavailableGuild]; unknown: [packet: RawPacket, id?: number]; userUpdate: [user: User, oldUser: PartialUser | null]; voiceChannelJoin: [member: Member, channel: AnyVoiceChannel]; voiceChannelLeave: [member: Member, channel: AnyVoiceChannel]; voiceChannelStatusUpdate: [channel: AnyVoiceChannel, oldChannel: VoiceStatus]; voiceChannelSwitch: [member: Member, newChannel: AnyVoiceChannel, oldChannel: AnyVoiceChannel]; voiceStateUpdate: [member: Member, oldState: OldVoiceState]; warn: [message: string, id?: number]; webhooksUpdate: [data: WebhookData]; } interface ClientEvents extends EventListeners { shardDisconnect: [err: Error | undefined, id: number]; shardReady: [id: number]; shardResume: [id: number]; } interface ShardEvents extends EventListeners { resume: []; } interface StreamEvents { end: []; error: [err: Error]; start: []; } interface VoiceEvents { connect: []; debug: [message: string]; disconnect: [err?: Error]; end: []; error: [err: Error]; pong: [latency: number]; ready: []; speakingStart: [userID: string]; speakingStop: [userID: string]; start: []; unknown: [packet: RawPacket]; userDisconnect: [userID: string]; warn: [message: string]; } // Gateway/REST interface HTTPResponse { code: number; message: string; } interface LatencyRef { lastTimeOffsetCheck: number; latency: number; raw: number[]; timeOffset: number; timeOffsets: number[]; } interface RawPacket { d?: unknown; op: number; s?: number; t?: string; } interface RawRESTRequest { auth: boolean; body?: unknown; file?: FileContent; latency: number; method: string; resp: IncomingMessage; route: string; short: boolean; url: string; } interface RequestMembersPromise { members: Member; received: number; res: (value: Member[]) => void; timeout: NodeJS.Timeout; } interface ShardManagerOptions { concurrency?: number | "auto"; } // Guild interface AddGuildMemberOptions { deaf?: boolean; mute?: boolean; nick?: string; roles?: string[]; } interface BanMemberOptions { /** @deprecated */ deleteMessageDays?: number; deleteMessageSeconds?: number; reason?: string; } interface BulkBanMembersOptions extends Omit { userIDs: string[]; } interface BulkBanMembersResponse { banned_users: string[]; failed_users: string[]; } interface CreateGuildOptions { afkChannelID?: string; afkTimeout?: number; channels?: PartialChannel[]; defaultNotifications?: DefaultNotifications; explicitContentFilter?: ExplicitContentFilter; icon?: string; roles?: PartialRole[]; systemChannelID: string; verificationLevel?: VerificationLevel; } interface DiscoveryCategory { id: number; is_primary: boolean; name: { default: string; localizations?: Record; }; } interface DiscoveryMetadata { category_ids: number[]; emoji_discoverability_enabled: boolean; guild_id: string; keywords: string[] | null; primary_category_id: number; } interface DiscoveryOptions { emojiDiscoverabilityEnabled?: boolean; keywords?: string[]; primaryCategoryID?: string; reason?: string; } interface DiscoverySubcategoryResponse { category_id: number; guild_id: string; } interface GetGuildAuditLogOptions { actionType?: number; before?: string; limit?: number; userID?: string; } interface GetGuildBansOptions { after?: string; before?: string; limit?: number; } interface GetGuildScheduledEventOptions { withUserCount?: boolean; } interface GetGuildScheduledEventUsersOptions { after?: string; before?: string; limit?: number; withMember?: boolean; } interface GetPruneOptions { days?: number; includeRoles?: string[]; } interface GetRESTGuildMembersOptions { after?: string; limit?: number; } interface GetRESTGuildsOptions { after?: string; before?: string; limit?: number; withCounts?: boolean; } interface GuildAuditLog { entries: GuildAuditLogEntry[]; integrations: GuildIntegration[]; threads: AnyThreadChannel[]; users: User[]; webhooks: Webhook[]; } interface GuildBan { reason?: string; user: User; } interface GuildOnboarding { default_channel_ids: string[]; enabled: boolean; guild_id: string; mode: OnboardingModes; prompts: GuildOnboardingPrompt[]; } interface GuildOnboardingOptions extends Omit { prompts: GuildOnboardingPromptOptions[]; } interface GuildOnboardingPrompt { id: string; in_onboarding: boolean; options: GuildOnboardingPromptOption[]; required: boolean; single_select: boolean; title: string; type: OnboardingPromptTypes; } interface GuildOnboardingPromptOption { channel_ids: string[]; description: string | null; emoji?: PartialEmoji; id: string; role_ids: string[]; title: string; } interface GuildOnboardingPromptOptionOptions extends Omit { emoji_animated: T extends true ? boolean : never; emoji_id: T extends true ? string : never; emoji_name: T extends true ? string : never; } interface GuildOnboardingPromptOptions extends Omit { options: GuildOnboardingPromptOptionOptions[]; } interface GuildOptions { afkChannelID?: string | null; afkTimeout?: number; banner?: string | null; defaultNotifications?: DefaultNotifications | null; description?: string | null; discoverySplash?: string | null; explicitContentFilter?: ExplicitContentFilter | null; features?: GuildFeatures[]; // Though only some are editable? icon?: string | null; name?: string; ownerID?: string; preferredLocale?: LocaleStrings | null; publicUpdatesChannelID?: string | null; rulesChannelID?: string | null; safetyAlertsChannelID?: string | null; splash?: string | null; systemChannelFlags?: number; systemChannelID?: string | null; verificationLevel?: VerificationLevel | null; } interface GuildScheduledEventEditOptionsBase { channelID?: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? null : string; description?: string | null; entityMetadata?: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? Required : GuildScheduledEventMetadata | null; entityType?: T; image?: string; name?: string; privacyLevel?: GuildScheduledEventPrivacyLevel; scheduledEndTime?: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? Date : Date | undefined; scheduledStartTime?: Date; status?: GuildScheduledEventStatus; } interface GuildScheduledEventEditOptionsDiscord extends GuildScheduledEventEditOptionsBase> { channelID: string; entityMetadata: GuildScheduledEventMetadata; } interface GuildScheduledEventEditOptionsExternal extends GuildScheduledEventEditOptionsBase { channelID: null; entityMetadata: Required; scheduledEndTime: Date; } interface GuildScheduledEventMetadata { location?: string; } interface GuildScheduledEventOptionsBase extends Omit, "entityMetadata" | "status"> { channelID: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? never : string; entityMetadata?: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? Required : GuildScheduledEventMetadata | undefined; entityType: T; name: string; privacyLevel: GuildScheduledEventPrivacyLevel; scheduledStartTime: Date; } interface GuildScheduledEventOptionsDiscord extends GuildScheduledEventEditOptionsBase> { channelID: string; entityMetadata: GuildScheduledEventMetadata; } interface GuildScheduledEventOptionsExternal extends GuildScheduledEventOptionsBase { channelID: never; entityMetadata: Required; scheduledEndTime: Date; } interface GuildScheduledEventUser { guildScheduledEventID: string; member?: Member; user: User; } interface GuildTemplateOptions { description?: string | null; name?: string; } interface GuildVanity { code: string | null; uses: number; } interface IntegrationApplication { bot?: User; description: string; icon: string | null; id: string; name: string; summary: ""; // Returns an empty string } interface IntegrationOptions { enableEmoticons?: string; expireBehavior?: string; expireGracePeriod?: string; } interface MFALevelResponse { level: MFALevel; } interface PruneMemberOptions extends GetPruneOptions { computePruneCount?: boolean; reason?: string; } interface VoiceRegion { custom: boolean; deprecated: boolean; id: string; name: string; optimal: boolean; vip: boolean; } interface WelcomeChannel { channelID: string; description: string; emojiID: string | null; emojiName: string | null; } interface WelcomeScreen { description: string; welcomeChannels: WelcomeChannel[]; } interface WelcomeScreenOptions extends WelcomeScreen { enabled: boolean; } interface Widget extends Omit { channel_id: string | null; enabled: boolean; } interface WidgetChannel { id: string; name: string; position: number; } interface WidgetData { channels: WidgetChannel[]; id: string; instant_invite: string; members: WidgetMember[]; name: string; presence_count: number; } interface WidgetMember { avatar: string | null; avatar_url: string; discriminator: string; id: string; status: string; username: string; } interface WidgetOptions { channelID?: string | null; channel_id?: string | null; enabled?: boolean; reason?: string; } // Interaction interface AutocompleteInteractionData { id: string; name: string; type: Constants["ApplicationCommandTypes"]["CHAT_INPUT"]; target_id?: string; options: InteractionDataOptions[]; } interface CommandInteractionData { id: string; name: string; type: ApplicationCommandTypes; target_id?: string; resolved?: CommandInteractionResolvedData; options?: InteractionDataOptions[]; } interface CommandInteractionResolvedData { channels?: Collection; members?: Collection; messages?: Collection; roles?: Collection; users?: Collection; } interface ComponentInteractionButtonData { component_type: Constants["ComponentTypes"]["BUTTON"]; custom_id: string; } interface ComponentInteractionSelectMenuData { component_type: Constants["ComponentTypes"]["SELECT_MENU"]; custom_id: string; values: string[]; } interface InteractionAutocomplete { choices: ApplicationCommandOptionChoice[]; } interface InteractionDataOptionsSubCommand { name: string; options?: InteractionDataOptions[]; type: Constants["ApplicationCommandOptionTypes"]["SUB_COMMAND"]; } interface InteractionDataOptionsSubCommandGroup { name: string; options: InteractionDataOptions[]; type: Constants["ApplicationCommandOptionTypes"]["SUB_COMMAND_GROUP"]; } interface InteractionDataOptionWithValue] = Constants["ApplicationCommandOptionTypes"][Exclude], V = unknown> { focused?: boolean; name: string; type: T; value: V; } interface InteractionModal { title: string; custom_id: string; components: ModalContentActionRow[]; } interface InteractionOptions { data?: InteractionCallbackData; type: InteractionResponseTypes; } // Invite interface CreateChannelInviteOptions extends CreateInviteOptions { targetApplicationID?: string; targetType?: InviteTargetTypes; targetUserID?: string; } interface CreateInviteOptions { maxAge?: number; maxUses?: number; temporary?: boolean; unique?: boolean; } interface Invitable { createInvite(options?: CreateInviteOptions, reason?: string): Promise; getInvites(): Promise; } interface InvitePartialChannel { icon?: string | null; id: string; name: string | null; recipients?: { username: string }[]; type: Exclude; } interface InviteStageInstance { members: Member[]; participantCount: number; speakerCount: number; topic: string; } // Member/User interface AvatarDecorationData { asset: string; sku_id: string; } interface MemberOptions { channelID?: string | null; communicationDisabledUntil?: Date | null; deaf?: boolean; flags?: number; mute?: boolean; nick?: string | null; roles?: string[]; } interface MemberPartial { id: string; user: User; } interface MemberRoles extends BaseData { roles: string[]; } interface PartialUser { accentColor?: number | null; avatar: string | null; avatarDecorationData?: AvatarDecorationData | null; banner?: string | null; discriminator: string; id: string; username: string; } interface RequestGuildMembersOptions { limit?: number; presences?: boolean; query?: string; timeout?: number; userIDs?: string[]; } // Message interface ActionRow { components: ActionRowComponents[]; type: Constants["ComponentTypes"]["ACTION_ROW"]; } interface ModalContentActionRow { components: TextInput[]; type: Constants["ComponentTypes"]["ACTION_ROW"]; } interface ActiveMessages { args: string[]; command: Command; timeout: NodeJS.Timer; } interface AdvancedMessageContent extends AdvancedMessageContentEdit { messageReference?: MessageReferenceReply | MessageReferenceForward; /** @deprecated */ messageReferenceID?: string; poll?: PollCreateOptions; stickerIDs?: string[]; tts?: boolean; } interface AdvancedMessageContentEdit { flags?: number; allowedMentions?: AllowedMentions; attachments?: PartialAttachment[]; components?: ActionRow[]; content?: string; /** @deprecated */ embed?: EmbedOptions; embeds?: EmbedOptions[]; file?: FileContent | FileContent[]; } interface AllowedMentions { everyone?: boolean; repliedUser?: boolean; roles?: boolean | string[]; users?: boolean | string[]; } interface Attachment extends PartialAttachment { content_type?: string; duration_secs?: number; ephemeral?: boolean; filename: string; flags?: number; height?: number; id: string; proxy_url: string; size: number; url: string; waveform?: string; width?: number; } interface ButtonBase { disabled?: boolean; emoji?: Partial; label?: string; type: Constants["ComponentTypes"]["BUTTON"]; } interface CreateStickerOptions extends Required> { file: FileContent; } interface EditStickerOptions { description?: string; name?: string; tags?: string; } interface FileContent { file: Buffer | string; name: string; } interface TextInput { custom_id: string; label: string; max_length?: number; min_length?: number; placeholder?: string; required?: boolean; style: Constants["TextInputStyles"][keyof Constants["TextInputStyles"]]; type: Constants["ComponentTypes"]["TEXT_INPUT"]; value?: string; } interface GetMessageReactionOptions { after?: string; /** @deprecated */ before?: string; limit?: number; type?: ReactionTypes; } interface GetPollAnswerVotersOptions { after?: string; limit?: number; } interface InteractionButton extends ButtonBase { custom_id: string; style: Exclude; } interface MessageActivity { party_id?: string; type: MessageActivityTypes; } interface MessageApplication { cover_image?: string; description: string; icon: string | null; id: string; name: string; } interface MessageInteraction { id: string; member: Member | null; name: string; type: InteractionTypes; user: User; } interface MessageReference extends MessageReferenceBase { channelID: string; } interface MessageReferenceBase { channelID?: string; guildID?: string; messageID?: string; type: MessageReferenceTypes; } interface MessageReferenceForward extends MessageReferenceBase { channelID: string; messageID: string; type: Constants["MessageReferenceTypes"]["FORWARD"]; } interface MessageReferenceReply extends MessageReferenceBase { messageID: string; failIfNotExists?: boolean; type?: Constants["MessageReferenceTypes"]["DEFAULT"]; } interface MessageSnapshot { guildID?: string; message: Pick; } interface PartialAttachment { description?: string; filename?: string; id: string | number; } interface Poll { allow_multiselect: boolean; answers: PollAnswer[]; expiry: number | null; layout_type: PollLayoutTypes; question: Pick; results?: PollResult; } interface PollAnswer { answer_id: number; poll_media: PollMedia; } interface PollCreateOptions extends Omit { duration: number; } interface PollMedia { emoji?: PartialEmoji; text: string; } interface PollResult { answer_counts: PollAnswerCount[]; is_finalized: boolean; } interface PollAnswerCount { count: number; id: number; me_voted: boolean; } interface Reaction { burst_colors: string[]; count: number; count_details: ReactionCountDetails; me: boolean; me_burst: boolean; type: ReactionTypes; } interface ReactionCountDetails { burst: number; normal: number; } interface SelectMenu { custom_id: string; disabled?: boolean; max_values?: number; min_values?: number; options: SelectMenuOptions[]; placeholder?: string; type: Constants["ComponentTypes"]["SELECT_MENU"]; } interface SelectMenuOptions { default?: boolean; description?: string; emoji?: Partial; label: string; value: string; } interface Sticker extends StickerItems { /** @deprecated */ asset: ""; available?: boolean; description: string; guild_id?: string; pack_id?: string; sort_value?: number; tags: string; type: StickerTypes; user?: User; } interface StickerItems { format_type: StickerFormats; id: string; name: string; } interface StickerPack { banner_asset_id: string; cover_sticker_id?: string; description: string; id: string; name: string; sku_id: string; stickers: Sticker[]; } interface URLButton extends ButtonBase { style: Constants["ButtonStyles"]["LINK"]; url: string; } // Presence interface Activity extends ActivityPartial { application_id?: string; assets?: { large_image?: string; large_text?: string; small_image?: string; small_text?: string; [key: string]: unknown; }; created_at: number; details?: string; emoji?: { animated?: boolean; id?: string; name: string }; flags?: number; instance?: boolean; party?: { id?: string; size?: [number, number] }; secrets?: { join?: string; spectate?: string; match?: string }; state?: string; timestamps?: { end?: number; start: number }; type: T; // the stuff attached to this object apparently varies even more than documented, so... [key: string]: unknown; } interface ActivityPartial { name: string; state?: string; type?: T; url?: string; } interface ClientPresence { activities: Activity[] | null; afk: boolean; since: number | null; status: SelfStatus; } interface ClientStatus { desktop: UserStatus; mobile: UserStatus; web: UserStatus; } interface Presence { activities?: Activity[]; clientStatus?: ClientStatus; status?: UserStatus; } // Role interface Overwrite { allow: bigint | number; deny: bigint | number; id: string; type: PermissionType; } interface PartialRole { color?: number; flags?: number; hoist?: boolean; id: string; mentionable?: boolean; name?: string; permissions?: number; position?: number; } interface RoleOptions { color?: number; hoist?: boolean; icon?: string; mentionable?: boolean; name?: string; permissions?: bigint | number | string | Permission; unicodeEmoji?: string; } interface RoleSubscriptionData { is_renewal: boolean; role_subscription_listing_id: string; tier_name: string; total_months_subscribed: number; } interface RoleTags { bot_id?: string; integration_id?: string; premium_subscriber?: true; subscription_listing_id?: string; available_for_purchase?: true; guild_connections?: true; } // Forum/Thread interface CreateThreadOptions { autoArchiveDuration?: AutoArchiveDuration; name: string; rateLimitPerUser?: number; reason?: string; } interface CreateForumThreadOptions extends CreateThreadOptions { appliedTags?: string[]; message: Omit & FileContent[]; } interface CreateThreadWithoutMessageOptions extends CreateThreadOptions { invitable?: T extends PrivateThreadChannel["type"] ? boolean : never; type?: T; } interface DefaultReactionEmoji { emoji_id?: string; emoji_name?: string; } interface ForumTag extends DefaultReactionEmoji { id: string; name: string; moderated: boolean; } interface GetArchivedThreadsOptions { before?: Date; limit?: number; } interface GetThreadMembersOptions { after?: string; limit?: number; withMember?: boolean; } interface ListedChannelThreads extends ListedGuildThreads { hasMore: boolean; } interface ListedGuildThreads { members: ThreadMember[]; threads: T[]; } interface PrivateThreadMetadata extends ThreadMetadata { invitable: boolean; } interface ThreadMetadata { archived: boolean; archiveTimestamp: number; autoArchiveDuration: AutoArchiveDuration; createTimestamp?: number | null; locked: boolean; } // Modals interface ModalSubmitInteractionDataComponents { components: ModalSubmitInteractionDataComponent[]; type: Constants["ComponentTypes"]["ACTION_ROW"]; } interface ModalSubmitInteractionDataTextInputComponent { custom_id: string; type: Constants["ComponentTypes"]["TEXT_INPUT"]; value: string; } interface ModalSubmitInteractionData { custom_id: string; components: ModalSubmitInteractionDataComponents[]; } // Voice interface JoinVoiceChannelOptions { opusOnly?: boolean; selfDeaf?: boolean; selfMute?: boolean; shared?: boolean; } interface StageInstanceOptions { privacyLevel?: StageInstancePrivacyLevel; topic?: string; } interface UncachedMemberVoiceState { id: string; voiceState: OldVoiceState; } interface VoiceConnectData { channel_id: string; endpoint: string; session_id: string; token: string; user_id: string; } interface VoiceResourceOptions { encoderArgs?: string[]; format?: string; frameDuration?: number; frameSize?: number; inlineVolume?: boolean; inputArgs?: string[]; pcmSize?: number; samplingRate?: number; voiceDataTimeout?: number; } interface VoiceServerUpdateData extends Omit { guild_id: string; shard: Shard; } interface VoiceStateOptions { channelID: string; requestToSpeakTimestamp?: Date | null; suppress?: boolean; } interface VoiceStatus { status: string; } interface VoiceStreamCurrent { buffer: Buffer | null; bufferingTicks: number; options: VoiceResourceOptions; pausedTime?: number; pausedTimestamp?: number; playTime: number; startTime: number; timeout: NodeJS.Timeout | null; } // Webhook interface Webhook { application_id: string | null; avatar: string | null; channel_id: string | null; guild_id: string | null; id: string; name: string; source_channel?: { id: string; name: string }; source_guild: { icon: string | null; id: string; name: string }; token?: string; type: WebhookTypes; url?: string; user?: PartialUser; } interface WebhookCreateOptions extends Omit { name: string; } interface WebhookEditOptions { avatar?: string | null; channelID?: string; name?: string; } interface WebhookPayload { allowedMentions?: AllowedMentions; attachments?: PartialAttachment[]; auth?: boolean; avatarURL?: string; components?: ActionRow[]; content?: string; /** @deprecated */ embed?: EmbedOptions; embeds?: EmbedOptions[]; file?: FileContent | FileContent[]; flags?: number; poll?: PollCreateOptions; threadID?: string; tts?: boolean; username?: string; wait?: boolean; } // TODO: Does this have more stuff? interface BaseData { id: string; [key: string]: unknown; } interface OAuthApplicationInfo { bot?: PartialUser; bot_public: boolean; bot_require_code_grant: boolean; description: string; icon: string | null; id: string; name: string; owner: PartialUser; privacy_policy_url?: string; role_connections_verification_url?: string; rpc_origins?: string[]; /** @deprecated */ summary: ""; team: OAuthTeamInfo | null; terms_of_service_url?: string; verify_key: string; } interface OAuthTeamInfo { icon: string | null; id: string; members: OAuthTeamMember[]; name: string; owner_user_id: string; } interface OAuthTeamMember { membership_state: MembershipStates; role: OAuthTeamMemberRoleTypes; team_id: string; user: PartialUser; } // Classes /** Generic T is `true` if a Guild scoped command, and `false` if not */ export class ApplicationCommand extends Base { applicationID: string; defaultMemberPermissions: Permission; /** @deprecated */ defaultPermission?: boolean | null; description: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? string : ""; descriptionLocalizations?: U extends "CHAT_INPUT" ? Record | null : null; dmPermission?: boolean; guild: T extends true ? PossiblyUncachedGuild : never; name: string; nameLocalizations?: Record | null; nsfw?: boolean; options?: ApplicationCommandOptions[]; type?: U; version: string; delete(): Promise; edit(options: ApplicationCommandEditOptions): Promise>; } class Base implements SimpleJSON { createdAt: number; id: string; constructor(id: string); static getCreatedAt(id: string): number; static getDiscordEpoch(id: string): number; toString(): string; toJSON(props?: string[]): JSONCache; } export class BrowserWebSocket extends EventEmitter { readyState: number; constructor(url: string); close(code?: number, reason?: string): void; removeEventListener(event: string | symbol, listener: (...args: any[]) => void): this; // @ts-ignore: DOM send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void; terminate(): void; /* eslint-disable sort-class-members/sort-class-members */ static CONNECTING: 0; static OPEN: 1; static CLOSING: 2; static CLOSED: 3; /* eslint-enable sort-class-members/sort-class-members */ } export class BrowserWebSocketError extends Error { // @ts-ignore: DOM event: Event; // @ts-ignore: DOM constructor(message: string, event: Event); } export class Bucket { interval: number; lastReset: number; lastSend: number; tokenLimit: number; tokens: number; constructor(tokenLimit: number, interval: number, options: { latencyRef: { latency: number }; reservedTokens: number }); check(): void; queue(func: () => void, priority?: boolean): void; } export class CategoryChannel extends GuildChannel implements Permissionable { channels: Collection>; permissionOverwrites: Collection; position: number; type: Constants["ChannelTypes"]["GUILD_CATEGORY"]; deletePermission(overwriteID: string, reason?: string): Promise; edit(options: EditChannelOptionsBase, reason?: string): Promise; editPermission(overwriteID: string, allow: PermissionValueTypes, deny: PermissionValueTypes, type: PermissionType, reason?: string): Promise; } export class Channel extends Base { mention: string; type: ChannelTypes; constructor(data: BaseData, client: Client); static from(data: BaseData, client: Client): AnyChannel; } export class Client extends EventEmitter { application?: { id: string; flags: number }; bot: boolean; channelGuildMap: Record; dmChannelMap: Record; dmChannels: Collection; gatewayURL?: string; guilds: Collection; guildShardMap: Record; lastConnect: number; lastReconnectDelay: number; options: ClientOptions; presence: ClientPresence; /** @deprecated */ privateChannelMap: Record; /** @deprecated */ privateChannels: Collection; ready: boolean; reconnectAttempts: number; requestHandler: RequestHandler; shards: ShardManager; startTime: number; threadGuildMap: Record; unavailableGuilds: Collection; uptime: number; user: ExtendedUser; users: Collection; voiceConnections: VoiceConnectionManager; constructor(token: string, options?: ClientOptions); addGroupRecipient(groupID: string, userID: string): Promise; addGuildDiscoverySubcategory(guildID: string, categoryID: string, reason?: string): Promise; addGuildMember(guildID: string, userID: string, accessToken: string, options?: AddGuildMemberOptions): Promise; addGuildMemberRole(guildID: string, memberID: string, roleID: string, reason?: string): Promise; addMessageReaction(channelID: string, messageID: string, reaction: string): Promise; banGuildMember(guildID: string, userID: string, options?: BanMemberOptions): Promise; /** @deprecated */ banGuildMember(guildID: string, userID: string, deleteMessageDays?: number, reason?: string): Promise; bulkBanGuildMembers(guildID: string, options: BulkBanMembersOptions): Promise; bulkEditCommands(commands: ApplicationCommandBulkEditOptions[]): Promise[]>; bulkEditGuildCommands(guildID: string, commands: ApplicationCommandBulkEditOptions[]): Promise[]>; closeVoiceConnection(guildID: string): void; connect(): Promise; createAutoModerationRule(guildID: string, rule: CreateAutoModerationRuleOptions): Promise; createChannel(guildID: string, name: string): Promise; createChannel(guildID: string, name: string, type: T, options?: CreateChannelOptions): Promise>; /** @deprecated */ createChannel(guildID: string, name: string, type: T, options?: CreateChannelOptions | string): Promise>; createChannelInvite( channelID: string, options?: CreateChannelInviteOptions, reason?: string ): Promise>; createChannelWebhook( channelID: string, options: WebhookCreateOptions, reason?: string ): Promise; createCommand(command: ApplicationCommandCreateOptions): Promise>; createGroupChannel(userIDs: string[]): Promise; createGuild(name: string, options?: CreateGuildOptions): Promise; createGuildCommand(guildID: string, command: ApplicationCommandCreateOptions): Promise>; createGuildEmoji(guildID: string, options: EmojiOptions, reason?: string): Promise; createGuildFromTemplate(code: string, name: string, icon?: string): Promise; createGuildScheduledEvent(guildID: string, event: GuildScheduledEventOptions, reason?: string): Promise>; createGuildSticker(guildID: string, options: CreateStickerOptions, reason?: string): Promise; createGuildTemplate(guildID: string, name: string, description?: string | null): Promise; createInteractionResponse(interactionID: string, interactionToken: string, options: InteractionOptions, file?: FileContent | FileContent[]): Promise; createMessage(channelID: string, content: MessageContent, file?: FileContent | FileContent[]): Promise; createRole(guildID: string, options?: Role | RoleOptions, reason?: string): Promise; createStageInstance(channelID: string, options: StageInstanceOptions): Promise; createThread(channelID: string, options: CreateForumThreadOptions, file?: FileContent | FileContent[]): Promise>; createThread(channelID: string, options: CreateThreadWithoutMessageOptions, file?: FileContent | FileContent[]): Promise; createThreadWithMessage(channelID: string, messageID: string, options: CreateThreadOptions): Promise; /** @deprecated */ createThreadWithoutMessage(channelID: string, options: CreateThreadWithoutMessageOptions): Promise; crosspostMessage(channelID: string, messageID: string): Promise; deleteAutoModerationRule(guildID: string, ruleID: string, reason?: string): Promise; deleteChannel(channelID: string, reason?: string): Promise; deleteChannelPermission(channelID: string, overwriteID: string, reason?: string): Promise; deleteCommand(commandID: string): Promise; deleteGuild(guildID: string): Promise; deleteGuildCommand(guildID: string, commandID: string): Promise; deleteGuildDiscoverySubcategory(guildID: string, categoryID: string, reason?: string): Promise; deleteGuildEmoji(guildID: string, emojiID: string, reason?: string): Promise; deleteGuildIntegration(guildID: string, integrationID: string): Promise; deleteGuildScheduledEvent(guildID: string, eventID: string): Promise; deleteGuildSticker(guildID: string, stickerID: string, reason?: string): Promise; deleteGuildTemplate(guildID: string, code: string): Promise; deleteInvite(inviteID: string, reason?: string): Promise; deleteMessage(channelID: string, messageID: string, reason?: string): Promise; deleteMessages(channelID: string, messageIDs: string[], reason?: string): Promise; deleteRole(guildID: string, roleID: string, reason?: string): Promise; deleteStageInstance(channelID: string): Promise; deleteWebhook(webhookID: string, token?: string, reason?: string): Promise; deleteWebhookMessage(webhookID: string, token: string, messageID: string): Promise; disconnect(options: { reconnect?: boolean | "auto" }): void; editAFK(afk: boolean): void; editAutoModerationRule(guildID: string, ruleID: string, options: EditAutoModerationRuleOptions): Promise; editChannel( channelID: string, options: EditGuildChannelOptions | EditGroupChannelOptions, reason?: string ): Promise; editChannelPermission( channelID: string, overwriteID: string, allow: bigint | number, deny: bigint | number, type: PermissionType, reason?: string ): Promise; editChannelPosition(channelID: string, position: number, options?: EditChannelPositionOptions): Promise; editChannelPositions(guildID: string, channelPositions: ChannelPosition[]): Promise; editCommand(commandID: string, command: ApplicationCommandEditOptions): Promise>; editCommandPermissions(guildID: string, commandID: string, permissions: ApplicationCommandPermissions[], reason?: string): Promise; editGuild(guildID: string, options: GuildOptions, reason?: string): Promise; editGuildCommand(guildID: string, commandID: string, command: ApplicationCommandEditOptions): Promise>; editGuildDiscovery(guildID: string, options?: DiscoveryOptions): Promise; editGuildEmoji( guildID: string, emojiID: string, options: { name?: string; roles?: string[] }, reason?: string ): Promise; editGuildMember(guildID: string, memberID: string, options: MemberOptions, reason?: string): Promise; editGuildMFALevel(guildID: string, level: MFALevel, reason?: string): Promise; editGuildOnboarding(guildID: string, options: GuildOnboardingOptions, reason?: string): Promise; editGuildScheduledEvent(guildID: string, eventID: string, event: GuildScheduledEventEditOptions, reason?: string): Promise>; editGuildSticker(guildID: string, stickerID: string, options?: EditStickerOptions, reason?: string): Promise; editGuildTemplate(guildID: string, code: string, options: GuildTemplateOptions): Promise; editGuildVanity(guildID: string, code: string | null): Promise; editGuildVoiceState(guildID: string, options: VoiceStateOptions, userID?: string): Promise; editGuildWelcomeScreen(guildID: string, options: WelcomeScreenOptions): Promise; editGuildWidget(guildID: string, options: WidgetOptions): Promise; editMessage(channelID: string, messageID: string, content: MessageContentEdit): Promise; /** @deprecated */ editNickname(guildID: string, nick: string, reason?: string): Promise; editRole(guildID: string, roleID: string, options: RoleOptions, reason?: string): Promise; // TODO not all options are available? editRoleConnectionMetadataRecords(data: ApplicationRoleConnectionMetadata[]): Promise; editRolePosition(guildID: string, roleID: string, position: number): Promise; editSelf(options: EditSelfOptions): Promise; editStageInstance(channelID: string, options: StageInstanceOptions): Promise; editStatus(status: SelfStatus, activities?: ActivityPartial[] | ActivityPartial): void; editStatus(activities?: ActivityPartial[] | ActivityPartial): void; editWebhook( webhookID: string, options: WebhookEditOptions, token?: string, reason?: string ): Promise; editWebhookMessage( webhookID: string, token: string, messageID: string, options: WebhookPayloadEdit ): Promise>; emit(event: K, ...args: ClientEvents[K]): boolean; emit(event: string, ...args: any[]): boolean; endPoll(channelID: string, messageID: string): Promise>; executeSlackWebhook(webhookID: string, token: string, options: Record & { auth?: boolean; threadID?: string }): Promise; executeSlackWebhook(webhookID: string, token: string, options: Record & { auth?: boolean; threadID?: string; wait: true }): Promise>; executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise>; executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; followChannel(channelID: string, webhookChannelID: string): Promise; getActiveGuildThreads(guildID: string): Promise; getArchivedThreads(channelID: string, type: "private", options?: GetArchivedThreadsOptions): Promise>; getArchivedThreads(channelID: string, type: "public", options?: GetArchivedThreadsOptions): Promise>>; getAutoModerationRule(guildID: string, ruleID: string): Promise; getAutoModerationRules(guildID: string): Promise; getBotGateway(): Promise<{ session_start_limit: { max_concurrency: number; remaining: number; reset_after: number; total: number }; shards: number; url: string }>; getChannel(channelID: string): Exclude; getChannelInvites(channelID: string): Promise; getChannelWebhooks(channelID: string): Promise; getCommand(commandID: string): Promise>; getCommandPermissions(guildID: string, commandID: string): Promise; getCommands(): Promise[]>; getDiscoveryCategories(): Promise; getDMChannel(userID: string): Promise; getEmojiGuild(emojiID: string): Promise; getGateway(): Promise<{ url: string }>; getGuildAuditLog(guildID: string, options?: GetGuildAuditLogOptions): Promise; /** @deprecated */ getGuildAuditLogs(guildID: string, limit?: number, before?: string, actionType?: number, userID?: string): Promise; getGuildBan(guildID: string, userID: string): Promise; getGuildBans(guildID: string, options?: GetGuildBansOptions): Promise; getGuildCommand(guildID: string, commandID: string): Promise>; getGuildCommandPermissions(guildID: string): Promise; getGuildCommands(guildID: string): Promise[]>; getGuildDiscovery(guildID: string): Promise; /** @deprecated */ getGuildEmbed(guildID: string): Promise; getGuildIntegrations(guildID: string): Promise; getGuildInvites(guildID: string): Promise; getGuildOnboarding(guildID: string): Promise; getGuildPreview(guildID: string): Promise; getGuildScheduledEvents(guildID: string, options?: GetGuildScheduledEventOptions): Promise; getGuildScheduledEventUsers(guildID: string, eventID: string, options?: GetGuildScheduledEventUsersOptions): Promise; getGuildTemplate(code: string): Promise; getGuildTemplates(guildID: string): Promise; getGuildVanity(guildID: string): Promise; getGuildWebhooks(guildID: string): Promise; getGuildWelcomeScreen(guildID: string): Promise; getGuildWidget(guildID: string): Promise; getGuildWidgetImageURL(guildID: string, style?: GuildWidgetStyles): string; getGuildWidgetSettings(guildID: string): Promise; getInvite(inviteID: string, withCounts?: false, withExpiration?: boolean, guildScheduledEventID?: string): Promise>; getInvite(inviteID: string, withCounts: true, withExpiration?: boolean, guildScheduledEventID?: string): Promise>; getJoinedPrivateArchivedThreads(channelID: string, options?: GetArchivedThreadsOptions): Promise>; getMessage(channelID: string, messageID: string): Promise; getMessageReaction(channelID: string, messageID: string, reaction: string, options?: GetMessageReactionOptions): Promise; /** @deprecated */ getMessageReaction(channelID: string, messageID: string, reaction: string, limit?: number, before?: string, after?: string): Promise; getMessages(channelID: string, options?: GetMessagesOptions): Promise; /** @deprecated */ getMessages(channelID: string, limit?: number, before?: string, after?: string, around?: string): Promise; getNitroStickerPacks(): Promise<{ sticker_packs: StickerPack[] }>; getOAuthApplication(): Promise; getPins(channelID: string): Promise; getPollAnswerVoters(channelID: string, messageID: string, answerID: string, options?: GetPollAnswerVotersOptions): Promise; getPruneCount(guildID: string, options?: GetPruneOptions): Promise; getRESTChannel(channelID: string): Promise; getRESTGuild(guildID: string, withCounts?: boolean): Promise; getRESTGuildChannels(guildID: string): Promise; getRESTGuildEmoji(guildID: string, emojiID: string): Promise; getRESTGuildEmojis(guildID: string): Promise; getRESTGuildMember(guildID: string, memberID: string): Promise; getRESTGuildMembers(guildID: string, options?: GetRESTGuildMembersOptions): Promise; /** @deprecated */ getRESTGuildMembers(guildID: string, limit?: number, after?: string): Promise; getRESTGuildRoles(guildID: string): Promise; getRESTGuilds(options?: GetRESTGuildsOptions): Promise; /** @deprecated */ getRESTGuilds(limit?: number, before?: string, after?: string): Promise; getRESTGuildScheduledEvent(guildID: string, eventID: string, options?: GetGuildScheduledEventOptions): Promise; getRESTGuildSticker(guildID: string, stickerID: string): Promise; getRESTGuildStickers(guildID: string): Promise; getRESTSticker(stickerID: string): Promise; getRESTUser(userID: string): Promise; getRoleConnectionMetadataRecords(): Promise; getSelf(): Promise; getStageInstance(channelID: string): Promise; getThreadMember(channelID: string, userID: string, withMember?: boolean): Promise; getThreadMembers(channelID: string, options?: GetThreadMembersOptions): Promise; getVoiceRegions(guildID?: string): Promise; getWebhook(webhookID: string, token?: string): Promise; getWebhookMessage(webhookID: string, token: string, messageID: string): Promise>; joinThread(channelID: string, userID?: string): Promise; joinVoiceChannel(channelID: string, options?: JoinVoiceChannelOptions): Promise; kickGuildMember(guildID: string, userID: string, reason?: string): Promise; leaveGuild(guildID: string): Promise; leaveThread(channelID: string, userID?: string): Promise; leaveVoiceChannel(channelID: string): void; off(event: K, listener: (...args: ClientEvents[K]) => void): this; off(event: string, listener: (...args: any[]) => void): this; once(event: K, listener: (...args: ClientEvents[K]) => void): this; once(event: string, listener: (...args: any[]) => void): this; pinMessage(channelID: string, messageID: string): Promise; pruneMembers(guildID: string, options?: PruneMemberOptions): Promise; purgeChannel(channelID: string, options: PurgeChannelOptions): Promise; /** @deprecated */ purgeChannel( channelID: string, limit?: number, filter?: (m: Message) => boolean, before?: string, after?: string, reason?: string ): Promise; removeGroupRecipient(groupID: string, userID: string): Promise; removeGuildMemberRole(guildID: string, memberID: string, roleID: string, reason?: string): Promise; removeMessageReaction(channelID: string, messageID: string, reaction: string, userID?: string): Promise; removeMessageReactionEmoji(channelID: string, messageID: string, reaction: string): Promise; removeMessageReactions(channelID: string, messageID: string): Promise; searchGuildMembers(guildID: string, query: string, limit?: number): Promise; sendChannelTyping(channelID: string): Promise; setVoiceChannelStatus(channelID: string, status: string, reason?: string): Promise; syncGuildIntegration(guildID: string, integrationID: string): Promise; syncGuildTemplate(guildID: string, code: string): Promise; unbanGuildMember(guildID: string, userID: string, reason?: string): Promise; unpinMessage(channelID: string, messageID: string): Promise; validateDiscoverySearchTerm(term: string): Promise<{ valid: boolean }>; on(event: K, listener: (...args: ClientEvents[K]) => void): this; on(event: string, listener: (...args: any[]) => void): this; toString(): string; } export class Collection extends Map { baseObject: new (...args: any[]) => T; limit?: number; constructor(baseObject: new (...args: any[]) => T, limit?: number); update(obj: T, extra?: unknown, replace?: boolean): T; add(obj: T, extra?: unknown, replace?: boolean): T; every(func: (i: T) => boolean): boolean; filter(func: (i: T) => boolean): T[]; find(func: (i: T) => boolean): T | undefined; map(func: (i: T) => R): R[]; random(): T | undefined; reduce(func: (accumulator: U, val: T) => U, initialValue?: U): U; remove(obj: T | Uncached): T | null; some(func: (i: T) => boolean): boolean; } export class Command implements CommandOptions, SimpleJSON { aliases: string[]; argsRequired: boolean; caseInsensitive: boolean; cooldown: number; cooldownExclusions: CommandCooldownExclusions; cooldownMessage: MessageContent | false | GenericCheckFunction; cooldownReturns: number; defaultSubcommandOptions: CommandOptions; deleteCommand: boolean; description: string; dmOnly: boolean; errorMessage: MessageContent | GenericCheckFunction; fullDescription: string; fullLabel: string; guildOnly: boolean; hidden: boolean; hooks: Hooks; invalidUsageMessage: MessageContent | false | GenericCheckFunction; label: string; parentCommand?: Command; permissionMessage: MessageContent | false | GenericCheckFunction; reactionButtons: null | CommandReactionButtons[]; reactionButtonTimeout: number; requirements: CommandRequirements; restartCooldown: boolean; subcommandAliases: Record; subcommands: Record; usage: string; constructor(label: string, generate: CommandGenerator, options?: CommandOptions); cooldownCheck(msg: Message): boolean; cooldownExclusionCheck(msg: Message): boolean; executeCommand(msg: Message, args: string[]): Promise; permissionCheck(msg: Message): Promise; process(args: string[], msg: Message): Promise; registerSubcommand(label: string, generator: CommandGenerator, options?: CommandOptions): Command; registerSubcommandAlias(alias: string, label: string): void; unregisterSubcommand(label: string): void; toString(): string; toJSON(props?: string[]): JSONCache; } export class CommandClient extends Client { activeMessages: Record; commandAliases: Record; commandOptions: CommandClientOptions; commands: Record; guildPrefixes: Record; preReady?: true; constructor(token: string, options: ClientOptions, commandOptions?: CommandClientOptions); checkPrefix(msg: Message): string; onMessageCreate(msg: Message): Promise; onMessageReactionEvent(msg: Message, emoji: Emoji, reactor: Member | Uncached | string): Promise; registerCommand(label: string, generator: CommandGenerator, options?: CommandOptions): Command; registerCommandAlias(alias: string, label: string): void; registerGuildPrefix(guildID: string, prefix: string[] | string): void; resolveCommand(label: string): Command; unregisterCommand(label: string): void; unwatchMessage(id: string, channelID: string): void; toString(): string; } export class DiscordHTTPError extends Error { code: number; headers: IncomingHttpHeaders; name: "DiscordHTTPError"; req: ClientRequest; res: IncomingMessage; response: HTTPResponse; constructor(req: ClientRequest, res: IncomingMessage, response: HTTPResponse, stack: string); flattenErrors(errors: HTTPResponse, keyPrefix?: string): string[]; } export class DiscordRESTError extends Error { code: number; headers: IncomingHttpHeaders; name: string; req: ClientRequest; res: IncomingMessage; response: HTTPResponse; constructor(req: ClientRequest, res: IncomingMessage, response: HTTPResponse, stack: string); flattenErrors(errors: HTTPResponse, keyPrefix?: string): string[]; } export class DMChannel extends Channel implements Pinnable { lastMessageID: string | null; lastPinTimestamp: number | null; messages: Collection>; recipients: Collection; type: Constants["ChannelTypes"]["DM"]; constructor(data: BaseData, client: Client); addMessageReaction(messageID: string, reaction: string): Promise; createMessage(content: MessageContent, file?: FileContent | FileContent[]): Promise>; delete(): Promise; deleteMessage(messageID: string): Promise; editMessage(messageID: string, content: MessageContentEdit): Promise>; getMessage(messageID: string): Promise>; getMessageReaction(messageID: string, reaction: string, options: GetMessageReactionOptions): Promise; /** @deprecated */ getMessageReaction(messageID: string, reaction: string, limit?: number, before?: string, after?: string): Promise; getMessages(options: GetMessagesOptions): Promise[]>; /** @deprecated */ getMessages(limit?: number, before?: string, after?: string, around?: string): Promise[]>; getPins(): Promise[]>; pinMessage(messageID: string): Promise; removeMessageReaction(messageID: string, reaction: string): Promise; /** @deprecated */ removeMessageReaction(messageID: string, reaction: string, userID?: string): Promise; sendTyping(): Promise; unpinMessage(messageID: string): Promise; unsendMessage(messageID: string): Promise; } export class ExtendedUser extends User { email: string; mfaEnabled: boolean; premiumType: PremiumTypes; verified: boolean; } export class ForumChannel extends MediaChannel { defaultForumLayout: ForumLayoutTypes; } export class GroupChannel extends Channel { applicationID: string; icon: string | null; iconURL: string | null; lastMessageID: string | null; lastPinTimestamp: number | null; managed: boolean; name: string; ownerID: string; recipients: Collection; type: Constants["ChannelTypes"]["GROUP_DM"]; addRecipient(userID: string, options: GroupRecipientOptions): Promise; delete(): Promise; dynamicIconURL(format?: ImageFormat, size?: number): string | null; edit(options: EditGroupChannelOptions): Promise; removeRecipient(userID: string): Promise; } export class Guild extends Base { afkChannelID: string | null; afkTimeout: number; applicationID: string | null; approximateMemberCount?: number; approximatePresenceCount?: number; autoRemoved?: boolean; banner: string | null; bannerURL: string | null; channels: Collection; createdAt: number; defaultNotifications: DefaultNotifications; description: string | null; discoverySplash: string | null; discoverySplashURL: string | null; emojiCount?: number; emojis: Emoji[]; events: Collection; explicitContentFilter: ExplicitContentFilter; features: GuildFeatures[]; icon: string | null; iconURL: string | null; id: string; joinedAt: number; large: boolean; maxMembers?: number; maxPresences?: number | null; maxStageVideoChannelUsers?: number; maxVideoChannelUsers?: number; memberCount: number; members: Collection; mfaLevel: MFALevel; name: string; /** @deprecated */ nsfw: boolean; nsfwLevel: NSFWLevel; ownerID: string; preferredLocale: LocaleStrings; premiumProgressBarEnabled: boolean; premiumSubscriptionCount?: number; premiumTier: PremiumTier; primaryCategory?: DiscoveryCategory; primaryCategoryID?: number; publicUpdatesChannelID: string | null; roles: Collection; rulesChannelID: string | null; safetyAlertsChannelID: string | null; shard: Shard; splash: string | null; splashURL: string | null; stageInstances: Collection; stickers?: Sticker[]; systemChannelFlags: number; systemChannelID: string | null; threads: Collection; unavailable: boolean; vanityURL: string | null; verificationLevel: VerificationLevel; voiceStates: Collection; welcomeScreen?: WelcomeScreen; widgetChannelID?: string | null; widgetEnabled?: boolean; constructor(data: BaseData, client: Client); addDiscoverySubcategory(categoryID: string, reason?: string): Promise; addMember(userID: string, accessToken: string, options?: AddGuildMemberOptions): Promise; addMemberRole(memberID: string, roleID: string, reason?: string): Promise; banMember(userID: string, options?: BanMemberOptions): Promise; /** @deprecated */ banMember(userID: string, deleteMessageDays?: number, reason?: string): Promise; bulkBanMembers(options: BulkBanMembersOptions): Promise; bulkEditCommands(commands: ApplicationCommandBulkEditOptions[]): Promise[]>; createAutoModerationRule(rule: CreateAutoModerationRuleOptions): Promise; createChannel(name: string): Promise; createChannel(name: string, type: T, options?: CreateChannelOptions): Promise>; /** @deprecated */ createChannel(name: string, type: T, options?: CreateChannelOptions | string): Promise>; createCommand(command: ApplicationCommandCreateOptions): Promise>; createEmoji(options: { image: string; name: string; roles?: string[] }, reason?: string): Promise; createRole(options: RoleOptions, reason?: string): Promise; createRole(options: Role, reason?: string): Promise; createScheduledEvent(event: GuildScheduledEventOptions, reason?: string): Promise>; createSticker(options: CreateStickerOptions, reason?: string): Promise; createTemplate(name: string, description?: string | null): Promise; delete(): Promise; deleteAutoModerationRule(ruleID: string, reason?: string): Promise; deleteCommand(commandID: string): Promise; deleteDiscoverySubcategory(categoryID: string, reason?: string): Promise; deleteEmoji(emojiID: string, reason?: string): Promise; deleteIntegration(integrationID: string): Promise; deleteRole(roleID: string): Promise; deleteScheduledEvent(eventID: string): Promise; deleteSticker(stickerID: string, reason?: string): Promise; deleteTemplate(code: string): Promise; dynamicBannerURL(format?: ImageFormat, size?: number): string | null; dynamicDiscoverySplashURL(format?: ImageFormat, size?: number): string | null; dynamicIconURL(format?: ImageFormat, size?: number): string | null; dynamicSplashURL(format?: ImageFormat, size?: number): string | null; edit(options: GuildOptions, reason?: string): Promise; editAutoModerationRule(ruleID: string, options: EditAutoModerationRuleOptions): Promise; editChannelPositions(channelPositions: ChannelPosition[]): Promise; editCommand(commandID: string, command: ApplicationCommandEditOptions): Promise>; editCommandPermissions(permissions: ApplicationCommandPermissions[], reason?: string): Promise; editDiscovery(options?: DiscoveryOptions): Promise; editEmoji(emojiID: string, options: { name: string; roles?: string[] }, reason?: string): Promise; editMember(memberID: string, options: MemberOptions, reason?: string): Promise; editMFALevel(level: MFALevel, reason?: string): Promise; /** @deprecated */ editNickname(nick: string): Promise; editOnboarding(options: GuildOnboardingOptions, reason?: string): Promise; editRole(roleID: string, options: RoleOptions): Promise; editScheduledEvent(eventID: string, event: GuildScheduledEventEditOptions, reason?: string): Promise>; editSticker(stickerID: string, options?: EditStickerOptions, reason?: string): Promise; editTemplate(code: string, options: GuildTemplateOptions): Promise; editVanity(code: string | null): Promise; editVoiceState(options: VoiceStateOptions, userID?: string): Promise; editWelcomeScreen(options: WelcomeScreenOptions): Promise; editWidget(options: WidgetOptions): Promise; fetchAllMembers(timeout?: number): Promise; fetchMembers(options?: RequestGuildMembersOptions): Promise; getActiveThreads(): Promise; getAuditLog(options?: GetGuildAuditLogOptions): Promise; /** @deprecated */ getAuditLogs(limit?: number, before?: string, actionType?: number, userID?: string): Promise; getAutoModerationRule(guildID: string, ruleID: string): Promise; getAutoModerationRules(guildID: string): Promise; getBan(userID: string): Promise; getBans(options?: GetGuildBansOptions): Promise; getCommand(commandID: string): Promise>; getCommandPermissions(): Promise; getCommands(): Promise[]>; getDiscovery(): Promise; /** @deprecated */ getEmbed(): Promise; getIntegrations(): Promise; getInvites(): Promise; getOnboarding(): Promise; getPruneCount(options?: GetPruneOptions): Promise; getRESTChannels(): Promise; getRESTEmoji(emojiID: string): Promise; getRESTEmojis(): Promise; getRESTMember(memberID: string): Promise; getRESTMembers(options?: GetRESTGuildMembersOptions): Promise; /** @deprecated */ getRESTMembers(limit?: number, after?: string): Promise; getRESTRoles(): Promise; getRESTScheduledEvent(eventID: string): Promise; getRESTSticker(stickerID: string): Promise; getRESTStickers(): Promise; getScheduledEvents(options?: GetGuildScheduledEventOptions): Promise; getScheduledEventUsers(eventID: string, options?: GetGuildScheduledEventUsersOptions): Promise; getTemplates(): Promise; getVanity(): Promise; getVoiceRegions(): Promise; getWebhooks(): Promise; getWelcomeScreen(): Promise; getWidget(): Promise; getWidgetImageURL(style?: GuildWidgetStyles): string; getWidgetSettings(): Promise; kickMember(userID: string, reason?: string): Promise; leave(): Promise; leaveVoiceChannel(): void; permissionsOf(memberID: string | Member | MemberRoles): Permission; pruneMembers(options?: PruneMemberOptions): Promise; removeMemberRole(memberID: string, roleID: string, reason?: string): Promise; searchMembers(query: string, limit?: number): Promise; syncTemplate(code: string): Promise; unbanMember(userID: string, reason?: string): Promise; } export class GuildAuditLogEntry extends Base { actionType: number; after: Record | null; before: Record | null; channel?: AnyGuildChannel | Uncached; count?: number; deleteMemberDays?: number; guild: Guild | Uncached; id: string; member?: Member | Uncached; membersRemoved?: number; message?: Message | Uncached; reason: string | null; role?: Role | { id: string; name: string }; status?: string; target?: Guild | AnyGuildChannel | Member | Role | Invite | Emoji | Sticker | Message | null; targetID: string; user: User | Uncached; constructor(data: BaseData, guild: Guild); } export class GuildChannel extends Channel { flags: number; guild: Guild; name: string; parentID: string | null; type: GuildChannelTypes; delete(reason?: string): Promise; edit(options: EditGuildChannelOptions, reason?: string): Promise; permissionsOf(memberID: string | Member | MemberRoles): Permission; } export class GuildIntegration extends Base { account: { id: string; name: string }; application?: IntegrationApplication; createdAt: number; enabled: boolean; enableEmoticons?: boolean; expireBehavior?: GuildIntegrationExpireBehavior; expireGracePeriod?: number; id: string; name: string; revoked?: boolean; roleID?: string; subscriberCount?: number; syncedAt?: number; syncing?: boolean; type: GuildIntegrationTypes; user?: User; constructor(data: BaseData, guild: Guild); delete(): Promise; } export class GuildPreview extends Base { approximateMemberCount: number; approximatePresenceCount: number; description: string | null; discoverySplash: string | null; discoverySplashURL: string | null; emojis: Emoji[]; features: GuildFeatures[]; icon: string | null; iconURL: string | null; id: string; name: string; splash: string | null; splashURL: string | null; constructor(data: BaseData, client: Client); dynamicDiscoverySplashURL(format?: ImageFormat, size?: number): string | null; dynamicIconURL(format?: ImageFormat, size?: number): string | null; dynamicSplashURL(format?: ImageFormat, size?: number): string | null; } export class GuildScheduledEvent extends Base { channelID: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? null : PossiblyUncachedSpeakableChannel; creator?: User; description?: string; entityID: string | null; entityMetadata: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? Required : null; entityType: T; guild: PossiblyUncachedGuild; id: string; image?: string; name: string; privacyLevel: GuildScheduledEventPrivacyLevel; scheduledEndTime: T extends Constants["GuildScheduledEventEntityTypes"]["EXTERNAL"] ? number : number | null; scheduledStartTime: number; status: GuildScheduledEventStatus; userCount?: number; delete(): Promise; edit(event: GuildScheduledEventEditOptions, reason?: string): Promise>; getUsers(options?: GetGuildScheduledEventUsersOptions): Promise; } export class GuildTemplate { code: string; createdAt: number; creator: User; description: string | null; isDirty: string | null; name: string; serializedSourceGuild: Guild; sourceGuild: Guild | Uncached; updatedAt: number; usageCount: number; constructor(data: BaseData, client: Client); createGuild(name: string, icon?: string): Promise; delete(): Promise; edit(options: GuildTemplateOptions): Promise; sync(): Promise; toJSON(props?: string[]): JSONCache; } export class GuildTextableChannel extends GuildChannel { lastMessageID: string | null; messages: Collection>; rateLimitPerUser: number; type: GuildTextChannelTypes | GuildVoiceChannelTypes | GuildThreadChannelTypes; constructor(data: BaseData, client: Client, messageLimit?: number); addMessageReaction(messageID: string, reaction: string): Promise; createMessage(content: MessageContent, file?: FileContent | FileContent[]): Promise>; deleteMessage(messageID: string, reason?: string): Promise; deleteMessages(messageIDs: string[], reason?: string): Promise; edit(options: EditGuildTextableChannelOptions, reason?: string): Promise; editMessage(messageID: string, content: MessageContentEdit): Promise>; endPoll(messageID: string): Promise>; getMessage(messageID: string): Promise>; getMessageReaction(messageID: string, reaction: string, options?: GetMessageReactionOptions): Promise; /** @deprecated */ getMessageReaction(messageID: string, reaction: string, limit?: number, before?: string, after?: string): Promise; getMessages(options?: GetMessagesOptions): Promise[]>; /** @deprecated */ getMessages(limit?: number, before?: string, after?: string, around?: string): Promise[]>; getPollAnswerVoters(messageID: string, answerID: string, options?: GetPollAnswerVotersOptions): Promise; purge(options: PurgeChannelOptions): Promise; /** @deprecated */ purge(limit: number, filter?: (message: Message) => boolean, before?: string, after?: string, reason?: string): Promise; removeMessageReaction(messageID: string, reaction: string, userID?: string): Promise; removeMessageReactionEmoji(messageID: string, reaction: string): Promise; removeMessageReactions(messageID: string): Promise; sendTyping(): Promise; unsendMessage(messageID: string): Promise; } export class MediaChannel extends GuildChannel implements Invitable, Permissionable { availableTags: ForumTag[]; defaultAutoArchiveDuration: AutoArchiveDuration; defaultReactionEmoji: DefaultReactionEmoji; defaultSortOrder: SortOrderTypes; defaultThreadRateLimitPerUser: number; lastMessageID: string | null; nsfw: boolean; permissionOverwrites: Collection; position: number; rateLimitPerUser: number; threads: PublicThreadChannel[]; topic?: string; createInvite(options?: CreateInviteOptions, reason?: string): Promise>; createThread(options: CreateForumThreadOptions, file?: FileContent | FileContent[]): Promise>; createWebhook(options: WebhookCreateOptions, reason?: string): Promise; deletePermission(overwriteID: string, reason?: string): Promise; edit(options: EditForumChannelOptions, reason?: string): Promise; editPermission(overwriteID: string, allow: PermissionValueTypes, deny: PermissionValueTypes, type: PermissionType, reason?: string): Promise; getArchivedThreads(options?: GetArchivedThreadsOptions): Promise>>; getInvites(): Promise[]>; getWebhooks(): Promise; } // Interactions export class AutocompleteInteraction extends Interaction { appPermissions?: Permission; channel: T; data: AutocompleteInteractionData; guildID: T extends AnyGuildChannel ? string : undefined; member: T extends AnyGuildChannel ? Member : undefined; type: Constants["InteractionTypes"]["APPLICATION_COMMAND_AUTOCOMPLETE"]; user: T extends AnyGuildChannel ? undefined : User; acknowledge(choices: ApplicationCommandOptionChoice[]): Promise; result(choices: ApplicationCommandOptionChoice[]): Promise; } export class Interaction extends Base { acknowledged: boolean; applicationID: string; id: string; token: string; type: number; version: number; static from(data: BaseData): AnyInteraction; } export class PingInteraction extends Interaction { type: Constants["InteractionTypes"]["PING"]; acknowledge(): Promise; pong(): Promise; } export class CommandInteraction extends Interaction { appPermissions?: Permission; channel: T; data: CommandInteractionData; guildID: T extends AnyGuildChannel ? string : undefined; member: T extends AnyGuildChannel ? Member : undefined; type: Constants["InteractionTypes"]["APPLICATION_COMMAND"]; user: T extends AnyGuildChannel ? undefined : User; acknowledge(flags?: number): Promise; createFollowup(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; createMessage(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; createModal(content: InteractionModal): Promise; defer(flags?: number): Promise; deleteMessage(messageID: string): Promise; deleteOriginalMessage(): Promise; editMessage(messageID: string, content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise>; editOriginalMessage(content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise>; getOriginalMessage(): Promise>; } export class ComponentInteraction extends Interaction { appPermissions?: Permission; channel: T; data: ComponentInteractionButtonData | ComponentInteractionSelectMenuData; guildID: T extends AnyGuildChannel ? string : undefined; member: T extends AnyGuildChannel ? Member : undefined; message: Message; type: Constants["InteractionTypes"]["MESSAGE_COMPONENT"]; user: T extends AnyGuildChannel ? undefined : User; acknowledge(): Promise; createFollowup(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; createMessage(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; createModal(content: InteractionModal): Promise; defer(flags?: number): Promise; deferUpdate(): Promise; deleteMessage(messageID: string): Promise; deleteOriginalMessage(): Promise; editMessage(messageID: string, content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise>; editOriginalMessage(content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise>; editParent(content: InteractionContentEdit, file?: FileContent | FileContent[]): Promise; getOriginalMessage(): Promise>; } export class UnknownInteraction extends Interaction { appPermissions?: Permission; channel?: T; data?: unknown; guildID: T extends AnyGuildChannel ? string : undefined; member: T extends AnyGuildChannel ? Member : undefined; message?: Message; type: number; user: T extends AnyGuildChannel ? undefined : User; acknowledge(data: InteractionOptions): Promise; createFollowup(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; createMessage(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; defer(flags?: number): Promise; deferUpdate(): Promise; deleteMessage(messageID: string): Promise; deleteOriginalMessage(): Promise; editMessage(messageID: string, content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise>; editOriginalMessage(content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise>; editParent(content: InteractionContentEdit, file?: FileContent | FileContent[]): Promise; getOriginalMessage(): Promise>; pong(): Promise; result(choices: ApplicationCommandOptionChoice[]): Promise; } // If CT (count) is "withMetadata", it will not have count properties export class Invite extends Base { channel: CH; code: string; // @ts-ignore: Property is only not null when invite metadata is supplied createdAt: CT extends "withMetadata" ? number : null; expiresAt?: CT extends "withCount" ? number | null : null; guild: CT extends "withMetadata" ? Guild // Invite with Metadata always has guild prop : CH extends Extract // Invite without Metadata ? never // If the channel is GroupChannel, there is no guild : CH extends Exclude // Invite without Metadata and not GroupChanel ? Guild // If the invite channel is not partial : Guild | Uncached | undefined; // If the invite channel is partial inviter?: User; maxAge: CT extends "withMetadata" ? number : null; maxUses: CT extends "withMetadata" ? number : null; memberCount: CT extends "withMetadata" | "withoutCount" ? null : number; presenceCount: CT extends "withMetadata" | "withoutCount" ? null : number; /** @deprecated */ stageInstance: CH extends StageChannel ? InviteStageInstance : null; temporary: CT extends "withMetadata" ? boolean : null; uses: CT extends "withMetadata" ? number : null; constructor(data: BaseData, client: Client); delete(reason?: string): Promise; } export class Member extends Base implements Presence { accentColor?: number | null; activities?: Activity[]; avatar: string | null; avatarDecorationData?: AvatarDecorationData | null; avatarDecorationURL: string | null; avatarURL: string; banner?: string | null; bannerURL: string | null; bot: boolean; clientStatus?: ClientStatus; communicationDisabledUntil?: number | null; createdAt: number; defaultAvatar: string; defaultAvatarURL: string; discriminator: string; flags: number; game: Activity | null; globalName: string | null; guild: Guild; id: string; joinedAt: number | null; mention: string; nick: string | null; pending?: boolean; /** @deprecated */ permission: Permission; permissions: Permission; premiumSince?: number | null; roles: string[]; staticAvatarURL: string; status?: UserStatus; user: User; username: string; voiceState: VoiceState; constructor(data: BaseData, guild?: Guild, client?: Client); addRole(roleID: string, reason?: string): Promise; ban(options?: BanMemberOptions): Promise; /** @deprecated */ ban(deleteMessageDays?: number, reason?: string): Promise; dynamicAvatarURL(format?: ImageFormat, size?: number): string; edit(options: MemberOptions, reason?: string): Promise; kick(reason?: string): Promise; removeRole(roleID: string, reason?: string): Promise; unban(reason?: string): Promise; } export class Message extends Base { activity?: MessageActivity; application?: MessageApplication; applicationID?: string; attachments: Attachment[]; author: User; channel: T; channelMentions: string[]; /** @deprecated */ cleanContent: string; command?: Command; components?: ActionRow[]; content: string; createdAt: number; editedTimestamp?: number; embeds: Embed[]; flags: number; guildID: T extends GuildTextableWithThreads ? string : undefined; id: string; interaction: MessageInteraction | null; jumpLink: string; member: T extends GuildTextableWithThreads ? Member : null; mentionEveryone: boolean; mentions: User[]; messageReference: MessageReference | null; messageSnapshots?: MessageSnapshot[]; pinned: boolean; poll?: Poll; prefix?: string; reactions: Record; referencedMessage?: Message | null; roleMentions: string[]; roleSubscriptionData?: RoleSubscriptionData; stickerItems?: StickerItems[]; /** @deprecated */ stickers?: Sticker[]; timestamp: number; tts: boolean; type: number; webhookID: T extends GuildTextableWithThreads ? string | undefined : undefined; constructor(data: BaseData, client: Client); addReaction(reaction: string): Promise; createThreadWithMessage(options: CreateThreadOptions): Promise; crosspost(): Promise : never>; delete(reason?: string): Promise; deleteWebhook(token: string): Promise; edit(content: MessageContentEdit): Promise>; editWebhook(token: string, options: WebhookPayloadEdit): Promise>; getReaction(reaction: string, options?: GetMessageReactionOptions): Promise; /** @deprecated */ getReaction(reaction: string, limit?: number, before?: string, after?: string): Promise; pin(): Promise; removeReaction(reaction: string, userID?: string): Promise; removeReactionEmoji(reaction: string): Promise; removeReactions(): Promise; unpin(): Promise; } export class ModalSubmitInteraction extends Interaction { channel: T; data: ModalSubmitInteractionData; guildID: T extends AnyGuildChannel ? string : undefined; member: T extends AnyGuildChannel ? Member : undefined; type: Constants["InteractionTypes"]["MODAL_SUBMIT"]; user: T extends AnyGuildChannel ? undefined : User; acknowledge(): Promise; createFollowup(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; createMessage(content: string | InteractionContent, file?: FileContent | FileContent[]): Promise; defer(flags?: number): Promise; deferUpdate(): Promise; deleteMessage(messageID: string): Promise; deleteOriginalMessage(): Promise; editMessage(messageID: string, content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise; editOriginalMessage(content: string | InteractionContentEdit, file?: FileContent | FileContent[]): Promise; editParent(content: InteractionContentEdit, file?: FileContent | FileContent[]): Promise; getOriginalMessage(): Promise; } // News channel rate limit is always 0 export class NewsChannel extends TextChannel { rateLimitPerUser: 0; type: Constants["ChannelTypes"]["GUILD_NEWS"]; crosspostMessage(messageID: string): Promise>; edit(options: EditNewsChannelOptions, reason?: string): Promise; follow(webhookChannelID: string): Promise; } export class NewsThreadChannel extends ThreadChannel { type: Constants["ChannelTypes"]["GUILD_NEWS_THREAD"]; } export class Permission extends Base { allow: bigint; deny: bigint; json: Record; constructor(allow: number | string | bigint, deny?: number | string | bigint); has(permission: keyof Constants["Permissions"] | bigint): boolean; } export class PermissionOverwrite extends Permission { id: string; type: PermissionType; constructor(data: Overwrite); } export class Piper extends EventEmitter { converterCommand: ConverterCommand; dataPacketCount: number; encoding: boolean; libopus: boolean; opus: OpusScript | null; opusFactory: () => OpusScript; volumeLevel: number; constructor(converterCommand: string, opusFactory: OpusScript); addDataPacket(packet: unknown): void; encode(source: string | Stream, options: VoiceResourceOptions): boolean; getDataPacket(): Buffer; reset(): void; resetPackets(): void; setVolume(volume: number): void; stop(e: Error, source: Duplex): void; } export class PrivateThreadChannel extends ThreadChannel { threadMetadata: PrivateThreadMetadata; type: Constants["ChannelTypes"]["GUILD_PRIVATE_THREAD"]; } /** Generic T is true if the PublicThreadChannel's parent channel is a Forum Channel */ export class PublicThreadChannel extends ThreadChannel { appliedTags: T extends true ? string[] : never; type: GuildPublicThreadChannelTypes; } export class RequestHandler implements SimpleJSON { globalBlock: boolean; latencyRef: LatencyRef; options: RequestHandlerOptions; ratelimits: Record; readyQueue: (() => void)[]; userAgent: string; constructor(client: Client, options?: RequestHandlerOptions); /** @deprecated */ constructor(client: Client, forceQueueing?: boolean); globalUnblock(): void; request(method: RequestMethod, url: string, auth?: boolean, body?: Record, file?: FileContent, _route?: string, short?: boolean): Promise; routefy(url: string, method: RequestMethod): string; toString(): string; toJSON(props?: string[]): JSONCache; } export class Role extends Base { color: number; createdAt: number; flags: number; guild: Guild; hoist: boolean; icon: string | null; iconURL: string | null; id: string; json: Partial, boolean>>; managed: boolean; mention: string; mentionable: boolean; name: string; permissions: Permission; position: number; tags?: RoleTags; unicodeEmoji: string | null; constructor(data: BaseData, guild: Guild); delete(reason?: string): Promise; edit(options: RoleOptions, reason?: string): Promise; editPosition(position: number): Promise; } export class SequentialBucket { latencyRef: LatencyRef; limit: number; processing: boolean; remaining: number; reset: number; constructor(limit: number, latencyRef?: LatencyRef); check(override?: boolean): void; queue(func: (cb: () => void) => void, short?: boolean): void; } export class Shard extends EventEmitter implements SimpleJSON { client: Client; connectAttempts: number; connecting: boolean; connectTimeout: NodeJS.Timeout | null; discordServerTrace?: string[]; getAllUsersCount: Record; getAllUsersLength: number; getAllUsersQueue: string; globalBucket: Bucket; guildCreateTimeout: NodeJS.Timeout | null; heartbeatInterval: NodeJS.Timeout | null; id: number; lastHeartbeatAck: boolean; lastHeartbeatReceived: number | null; lastHeartbeatSent: number | null; latency: number; preReady: boolean; presence: ClientPresence; presenceUpdateBucket: Bucket; ready: boolean; reconnectInterval: number; requestMembersPromise: Record; resumeURL: string | null; seq: number; sessionID: string | null; status: "connecting" | "disconnected" | "handshaking" | "identifying" | "ready" | "resuming"; ws: WebSocket | BrowserWebSocket | null; constructor(id: number, client: Client); checkReady(): void; connect(): void; createGuild(_guild: Guild): Guild; disconnect(options?: { reconnect?: boolean | "auto" }, error?: Error): void; editAFK(afk: boolean): void; editStatus(status: SelfStatus, activities?: ActivityPartial[] | ActivityPartial): void; editStatus(activities?: ActivityPartial[] | ActivityPartial): void; // @ts-ignore: Method override emit(event: string, ...args: any[]): void; emit(event: K, ...args: ShardEvents[K]): boolean; emit(event: string, ...args: any[]): boolean; getGuildMembers(guildID: string, timeout: number): void; hardReset(): void; heartbeat(normal?: boolean): void; identify(): void; initializeWS(): void; off(event: K, listener: (...args: ShardEvents[K]) => void): this; off(event: string, listener: (...args: any[]) => void): this; once(event: K, listener: (...args: ShardEvents[K]) => void): this; once(event: string, listener: (...args: any[]) => void): this; onPacket(packet: RawPacket): void; requestGuildMembers(guildID: string, options?: RequestGuildMembersOptions): Promise; reset(): void; restartGuildCreateTimeout(): void; resume(): void; sendStatusUpdate(): void; sendWS(op: number, _data: Record, priority?: boolean): void; wsEvent(packet: Required): void; on(event: K, listener: (...args: ShardEvents[K]) => void): this; on(event: string, listener: (...args: any[]) => void): this; toJSON(props?: string[]): JSONCache; } export class ShardManager extends Collection implements SimpleJSON { buckets: Map; connectQueue: Shard[]; connectTimeout: NodeJS.Timer | null; constructor(client: Client, options: ShardManagerOptions); connect(shard: Shard): void; spawn(id: number): void; tryConnect(): void; toString(): string; toJSON(props?: string[]): JSONCache; } export class SharedStream extends EventEmitter { bitrate: number; channels: number; current?: VoiceStreamCurrent; ended: boolean; frameDuration: number; piper: Piper; playing: boolean; samplingRate: number; speaking: boolean; voiceConnections: Collection; volume: number; add(connection: VoiceConnection): void; emit(event: K, ...args: StreamEvents[K]): boolean; emit(event: string, ...args: any[]): boolean; off(event: K, listener: (...args: StreamEvents[K]) => void): this; off(event: string, listener: (...args: any[]) => void): this; once(event: K, listener: (...args: StreamEvents[K]) => void): this; once(event: string, listener: (...args: any[]) => void): this; play(resource: ReadableStream | string, options?: VoiceResourceOptions): void; remove(connection: VoiceConnection): void; setSpeaking(value: boolean): void; setVolume(volume: number): void; stopPlaying(): void; on(event: K, listener: (...args: StreamEvents[K]) => void): this; on(event: string, listener: (...args: any[]) => void): this; } export class StageChannel extends VoiceChannel { type: Constants["ChannelTypes"]["GUILD_STAGE_VOICE"]; createInstance(options: StageInstanceOptions): Promise; deleteInstance(): Promise; editInstance(options: StageInstanceOptions): Promise; getInstance(): Promise; } export class StageInstance extends Base { channel: StageChannel | Uncached; client: Client; discoverableDisabled: boolean; guild: Guild | Uncached; privacyLevel: StageInstancePrivacyLevel; topic: string; constructor(data: BaseData, client: Client); update(data: BaseData): void; delete(): Promise; edit(options: StageInstanceOptions): Promise; } export class TextChannel extends GuildTextableChannel implements Invitable, Permissionable, Pinnable { defaultAutoArchiveDuration: AutoArchiveDuration; lastPinTimestamp: number | null; nsfw: boolean; permissionOverwrites: Collection; position: number; topic: string | null; type: GuildTextChannelTypes; createInvite(options?: CreateChannelInviteOptions, reason?: string): Promise>; createThread(options: CreateThreadWithoutMessageOptions): Promise; createThreadWithMessage(messageID: string, options: CreateThreadOptions): Promise; /** @deprecated */ createThreadWithoutMessage(options: CreateThreadWithoutMessageOptions): Promise; createWebhook(options: WebhookCreateOptions, reason?: string | undefined): Promise; deletePermission(overwriteID: string, reason?: string): Promise; edit(options: EditTextChannelOptions, reason?: string): Promise; editPermission(overwriteID: string, allow: PermissionValueTypes, deny: PermissionValueTypes, type: PermissionType, reason?: string): Promise; getArchivedThreads(type: "private", options?: GetArchivedThreadsOptions): Promise>; getArchivedThreads(type: "public", options?: GetArchivedThreadsOptions): Promise>; getInvites(): Promise[]>; getJoinedPrivateArchivedThreads(options: GetArchivedThreadsOptions): Promise>; getPins(): Promise[]>; getWebhooks(): Promise; pinMessage(messageID: string): Promise; unpinMessage(messageID: string): Promise; } export class ThreadChannel extends GuildTextableChannel implements Pinnable { lastPinTimestamp: number | null; member?: ThreadMember; memberCount: number; members: Collection; messageCount: number; ownerID: string; threadMetadata: ThreadMetadata; totalMessageSent: number; type: GuildThreadChannelTypes; constructor(data: BaseData, client: Client); edit(options: EditThreadChannelOptions, reason?: string): Promise; getMember(userID: string, withMember?: boolean): Promise; getMembers(options?: GetThreadMembersOptions): Promise; getPins(): Promise[]>; join(userID?: string): Promise; leave(userID?: string): Promise; pinMessage(messageID: string): Promise; unpinMessage(messageID: string): Promise; } export class ThreadMember extends Base { flags: number; guildMember?: Member; joinTimestamp: number; threadID: string; constructor(data: BaseData, client: Client); update(data: BaseData): void; leave(): Promise; } export class UnavailableGuild extends Base { createdAt: number; id: string; shard: Shard; unavailable: boolean; constructor(data: BaseData, client: Client); } export class User extends Base { accentColor?: number | null; avatar: string | null; avatarDecorationData?: AvatarDecorationData | null; avatarDecorationURL: string | null; avatarURL: string; banner?: string | null; bannerURL: string | null; bot: boolean; createdAt: number; defaultAvatar: string; defaultAvatarURL: string; discriminator: string; globalName: string | null; id: string; mention: string; publicFlags?: number; staticAvatarURL: string; system: boolean; username: string; constructor(data: BaseData, client: Client); dynamicAvatarURL(format?: ImageFormat, size?: number): string; dynamicBannerURL(format?: ImageFormat, size?: number): string | null; getDMChannel(): Promise; } export class VoiceChannel extends GuildTextableChannel implements Invitable, Permissionable { bitrate: number; nsfw: boolean; permissionOverwrites: Collection; position: number; rtcRegion: string | null; status?: string; type: GuildVoiceChannelTypes; userLimit: number; videoQualityMode: VideoQualityMode; voiceMembers: Collection; createInvite(options?: CreateInviteOptions, reason?: string): Promise>; createWebhook(options: WebhookCreateOptions, reason?: string | undefined): Promise; deletePermission(overwriteID: string, reason?: string): Promise; editPermission(overwriteID: string, allow: PermissionValueTypes, deny: PermissionValueTypes, type: PermissionType, reason?: string): Promise; getInvites(): Promise[]>; getWebhooks(): Promise; join(options?: JoinVoiceChannelOptions): Promise; leave(): void; setStatus(status: string, reason?: string): Promise; } export class VoiceConnection extends EventEmitter implements SimpleJSON { bitrate: number; channelID: string | null; channels: number; connecting: boolean; connectionTimeout: NodeJS.Timeout | null; current?: VoiceStreamCurrent | null; ended?: boolean; endpoint: URL; frameDuration: number; frameSize: number; heartbeatInterval: NodeJS.Timeout | null; id: string; mode?: string; modes?: string; /** Optional dependencies OpusScript (opusscript) or OpusEncoder (@discordjs/opus) */ opus: Record; opusOnly: boolean; paused: boolean; pcmSize: number; piper: Piper; playing: boolean; ready: boolean; receiveStreamOpus?: VoiceDataStream | null; receiveStreamPCM?: VoiceDataStream | null; reconnecting: boolean; resuming: boolean; samplingRate: number; secret: Buffer; sendBuffer: Buffer; sendNonce: Buffer; sequence: number; shard: Shard | Record; shared: boolean; speaking: boolean; ssrc?: number; ssrcUserMap: Record; timestamp: number; udpIP?: string; udpPort?: number; udpSocket: DgramSocket | null; volume: number; ws: BrowserWebSocket | WebSocket | null; constructor(id: string, options?: { shard?: Shard; shared?: boolean; opusOnly?: boolean }); connect(data: VoiceConnectData): NodeJS.Timer | void; disconnect(error?: Error, reconnecting?: boolean): void; emit(event: K, ...args: VoiceEvents[K]): boolean; emit(event: string, ...args: any[]): boolean; heartbeat(): void; off(event: K, listener: (...args: VoiceEvents[K]) => void): this; off(event: string, listener: (...args: any[]) => void): this; once(event: K, listener: (...args: VoiceEvents[K]) => void): this; once(event: string, listener: (...args: any[]) => void): this; pause(): void; play(resource: ReadableStream | string, options?: VoiceResourceOptions): void; receive(type: "opus" | "pcm"): VoiceDataStream; registerReceiveEventHandler(): void; resume(): void; sendAudioFrame(frame: Buffer): void; sendUDPPacket(packet: Buffer): void; sendWS(op: number, data: Record): void; setSpeaking(value: boolean): void; setVolume(volume: number): void; stopPlaying(): void; switchChannel(channelID: string): void; updateVoiceState(selfMute: boolean, selfDeaf: boolean): void; on(event: K, listener: (...args: VoiceEvents[K]) => void): this; on(event: string, listener: (...args: any[]) => void): this; toJSON(props?: string[]): JSONCache; } export class VoiceConnectionManager extends Collection implements SimpleJSON { constructor(vcObject: new () => T); join(guildID: string, channelID: string, options: VoiceResourceOptions): Promise; leave(guildID: string): void; switch(guildID: string, channelID: string): void; voiceServerUpdate(data: VoiceServerUpdateData): void; toJSON(props?: string[]): JSONCache; } export class VoiceDataStream extends EventEmitter { type: "opus" | "pcm"; constructor(type: string); on(event: "data", listener: (data: Buffer, userID: string, timestamp: number, sequence: number) => void): this; } export class VoiceState extends Base { channelID: string | null; createdAt: number; deaf: boolean; id: string; mute: boolean; requestToSpeakTimestamp: number | null; selfDeaf: boolean; selfMute: boolean; selfStream: boolean; selfVideo: boolean; sessionID: string | null; suppress: boolean; constructor(data: BaseData); } } export = Eris;