update
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
'use strict';
|
||||
/* Not used:
|
||||
const process = require('node:process');
|
||||
const Package = (exports.Package = require('../../package.json'));
|
||||
*/
|
||||
const { Error, RangeError, TypeError } = require('../errors');
|
||||
|
||||
exports.defaultUA =
|
||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.9023 Chrome/108.0.5359.215 Electron/22.3.26 Safari/537.36';
|
||||
const { Error, RangeError, TypeError } = require('../errors');
|
||||
|
||||
/**
|
||||
* Max bulk deletable message age
|
||||
@@ -14,121 +8,8 @@ exports.defaultUA =
|
||||
*/
|
||||
exports.MaxBulkDeletableMessageAge = 1_209_600_000;
|
||||
|
||||
/**
|
||||
* API captcha solver
|
||||
* * `2captcha` - 2captcha.com
|
||||
* * `capmonster` - capmonster.cloud
|
||||
* @typedef {string[]} captchaServices
|
||||
*/
|
||||
exports.captchaServices = ['2captcha', 'capmonster', 'custom'];
|
||||
|
||||
/**
|
||||
* Automatically scan and delete direct messages you receive that contain explicit media content.
|
||||
* * `NOT_SCAN` - Direct messages will not be scanned for explicit content.
|
||||
* * `NOT_FRIEND` - Scan direct messages from everyone unless they are a friend.
|
||||
* * `EVERYONE` - Scan direct messages from everyone.
|
||||
* @typedef {string} DMScanLevel
|
||||
*/
|
||||
exports.DMScanLevel = createEnum(['NOT_SCAN', 'NOT_FRIEND', 'EVERYONE']);
|
||||
|
||||
/**
|
||||
* This controls when stickers animate:
|
||||
* * `ALWAYS` - Always animate.
|
||||
* * `INTERACTION` - On the desktop client, stickers will animate on hover or focus. On mobile clients, stickers will animate on long-press.
|
||||
* * `NEVER` - Never animate.
|
||||
* @typedef {string} stickerAnimationMode
|
||||
*/
|
||||
exports.stickerAnimationMode = createEnum(['ALWAYS', 'INTERACTION', 'NEVER']);
|
||||
|
||||
/**
|
||||
* All available nitro types:
|
||||
* * `NONE` - None
|
||||
* * `NITRO_CLASSIC` - Nitro Classic
|
||||
* * `NITRO_BOOST` - Nitro
|
||||
* * `NITRO_BASIC` - Nitro Basic
|
||||
* * `UNKNOWN` - Unknown
|
||||
* @typedef {string} NitroType
|
||||
* @see {@link https://discord.com/developers/docs/resources/user#user-object-premium-types}
|
||||
*/
|
||||
exports.NitroType = createEnum(['NONE', 'NITRO_CLASSIC', 'NITRO_BOOST', 'NITRO_BASIC']);
|
||||
|
||||
/**
|
||||
* All available HypeSquad types:
|
||||
* * `LEAVE` - None
|
||||
* * `HOUSE_BRAVERY` - HypeSquad Bravery
|
||||
* * `HOUSE_BRILLIANCE` - HypeSquad Brilliance
|
||||
* * `HOUSE_BALANCE` - HypeSquad Balance
|
||||
* @typedef {string} HypeSquadType
|
||||
*/
|
||||
exports.HypeSquadType = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']);
|
||||
|
||||
/**
|
||||
* All locale codes:
|
||||
* * `DANISH`
|
||||
* * `GERMAN`
|
||||
* * `ENGLISH_UK`
|
||||
* * `ENGLISH_US`
|
||||
* * `SPANISH`
|
||||
* * `FRENCH`
|
||||
* * `CROATIAN`
|
||||
* * `ITALIAN`
|
||||
* * `LITHUANIAN`
|
||||
* * `HUNGARIAN`
|
||||
* * `DUTCH`
|
||||
* * `NORWEGIAN`
|
||||
* * `POLISH`
|
||||
* * `BRAZILIAN_PORTUGUESE`
|
||||
* * `ROMANIA_ROMANIAN`
|
||||
* * `FINNISH`
|
||||
* * `SWEDISH`
|
||||
* * `VIETNAMESE`
|
||||
* * `TURKISH`
|
||||
* * `CZECH`
|
||||
* * `GREEK`
|
||||
* * `BULGARIAN`
|
||||
* * `RUSSIAN`
|
||||
* * `UKRAINIAN`
|
||||
* * `HINDI`
|
||||
* * `THAI`
|
||||
* * `CHINA_CHINESE`
|
||||
* * `JAPANESE`
|
||||
* * `TAIWAN_CHINESE`
|
||||
* * `KOREAN`
|
||||
* @typedef {Object<string, string>} localeSetting
|
||||
* @see {@link https://discord.com/developers/docs/reference#locales}
|
||||
*/
|
||||
exports.localeSetting = {
|
||||
da: 'DANISH',
|
||||
de: 'GERMAN',
|
||||
'en-GB': 'ENGLISH_UK',
|
||||
'en-US': 'ENGLISH_US',
|
||||
'es-ES': 'SPANISH',
|
||||
fr: 'FRENCH',
|
||||
hr: 'CROATIAN',
|
||||
it: 'ITALIAN',
|
||||
lt: 'LITHUANIAN',
|
||||
hu: 'HUNGARIAN',
|
||||
nl: 'DUTCH',
|
||||
no: 'NORWEGIAN',
|
||||
pl: 'POLISH',
|
||||
'pt-BR': 'BRAZILIAN_PORTUGUESE',
|
||||
ro: 'ROMANIA_ROMANIAN',
|
||||
fi: 'FINNISH',
|
||||
'sv-SE': 'SWEDISH',
|
||||
vi: 'VIETNAMESE',
|
||||
tr: 'TURKISH',
|
||||
cs: 'CZECH',
|
||||
el: 'GREEK',
|
||||
bg: 'BULGARIAN',
|
||||
ru: 'RUSSIAN',
|
||||
uk: 'UKRAINIAN',
|
||||
hi: 'HINDI',
|
||||
th: 'THAI',
|
||||
'zh-CN': 'CHINA_CHINESE',
|
||||
ja: 'JAPANESE',
|
||||
'zh-TW': 'TAIWAN_CHINESE',
|
||||
ko: 'KOREAN',
|
||||
};
|
||||
exports.UserAgent =
|
||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.9023 Chrome/108.0.5359.215 Electron/22.3.26 Safari/537.36';
|
||||
|
||||
/**
|
||||
* The types of WebSocket error codes:
|
||||
@@ -197,10 +78,6 @@ exports.Endpoints = {
|
||||
if (dynamic && hash.startsWith('a_')) format = 'gif';
|
||||
return makeImageUrl(`${root}/guilds/${guildId}/users/${memberId}/avatars/${hash}`, { format, size });
|
||||
},
|
||||
GuildMemberBanner: (guildId, memberId, hash, format = 'webp', size, dynamic = false) => {
|
||||
if (dynamic && hash.startsWith('a_')) format = 'gif';
|
||||
return makeImageUrl(`${root}/guilds/${guildId}/users/${memberId}/banners/${hash}`, { format, size });
|
||||
},
|
||||
Banner: (id, hash, format, size, dynamic = false) => {
|
||||
if (dynamic && hash.startsWith('a_')) format = 'gif';
|
||||
return makeImageUrl(`${root}/banners/${id}/${hash}`, { format, size });
|
||||
@@ -227,14 +104,11 @@ exports.Endpoints = {
|
||||
makeImageUrl(`${root}/role-icons/${roleId}/${hash}`, { size, format }),
|
||||
guildScheduledEventCover: (scheduledEventId, coverHash, format, size) =>
|
||||
makeImageUrl(`${root}/guild-events/${scheduledEventId}/${coverHash}`, { size, format }),
|
||||
// Test only
|
||||
BadgeIcon: hash => makeImageUrl(`${root}/badge-icons/${hash}`, { format: 'png' }),
|
||||
};
|
||||
},
|
||||
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),
|
||||
scheduledEvent: (root, guildId, eventId) => `${root}/${guildId}/${eventId}`,
|
||||
botGateway: '/gateway/bot',
|
||||
userGateway: '/gateway',
|
||||
botGateway: '/gateway',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -348,7 +222,6 @@ exports.Opcodes = {
|
||||
* * API_RESPONSE: apiResponse
|
||||
* * API_REQUEST: apiRequest
|
||||
* * CLIENT_READY: ready
|
||||
* * APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE: applicationCommandAutocompleteResponse
|
||||
* * APPLICATION_COMMAND_CREATE: applicationCommandCreate (deprecated)
|
||||
* * APPLICATION_COMMAND_DELETE: applicationCommandDelete (deprecated)
|
||||
* * APPLICATION_COMMAND_UPDATE: applicationCommandUpdate (deprecated)
|
||||
@@ -357,9 +230,6 @@ exports.Opcodes = {
|
||||
* * AUTO_MODERATION_RULE_CREATE: autoModerationRuleCreate
|
||||
* * AUTO_MODERATION_RULE_DELETE: autoModerationRuleDelete
|
||||
* * AUTO_MODERATION_RULE_UPDATE: autoModerationRuleUpdate
|
||||
* * CALL_CREATE: callCreate
|
||||
* * CALL_DELETE: callDelete
|
||||
* * CALL_UPDATE: callUpdate
|
||||
* * GUILD_AVAILABLE: guildAvailable
|
||||
* * GUILD_CREATE: guildCreate
|
||||
* * GUILD_DELETE: guildDelete
|
||||
@@ -385,9 +255,6 @@ exports.Opcodes = {
|
||||
* * CHANNEL_DELETE: channelDelete
|
||||
* * CHANNEL_UPDATE: channelUpdate
|
||||
* * CHANNEL_PINS_UPDATE: channelPinsUpdate
|
||||
* * CHANNEL_RECIPIENT_REMOVE: channelRecipientRemove
|
||||
* * CHANNEL_RECIPIENT_ADD: channelRecipientAdd
|
||||
* * MESSAGE_ACK: messageAck
|
||||
* * MESSAGE_CREATE: messageCreate
|
||||
* * MESSAGE_DELETE: messageDelete
|
||||
* * MESSAGE_UPDATE: messageUpdate
|
||||
@@ -408,7 +275,6 @@ exports.Opcodes = {
|
||||
* * VOICE_STATE_UPDATE: voiceStateUpdate
|
||||
* * TYPING_START: typingStart
|
||||
* * WEBHOOKS_UPDATE: webhookUpdate
|
||||
* * INTERACTION_CREATE: interactionCreate
|
||||
* * ERROR: error
|
||||
* * WARN: warn
|
||||
* * DEBUG: debug
|
||||
@@ -432,6 +298,16 @@ exports.Opcodes = {
|
||||
* * GUILD_SCHEDULED_EVENT_USER_ADD: guildScheduledEventUserAdd
|
||||
* * GUILD_SCHEDULED_EVENT_USER_REMOVE: guildScheduledEventUserRemove
|
||||
* * GUILD_AUDIT_LOG_ENTRY_CREATE: guildAuditLogEntryCreate
|
||||
* * UNHANDLED_PACKET: unhandledPacket
|
||||
* * RELATIONSHIP_ADD: relationshipAdd
|
||||
* * RELATIONSHIP_REMOVE: relationshipRemove
|
||||
* * RELATIONSHIP_UPDATE: relationshipUpdate
|
||||
* * CHANNEL_RECIPIENT_ADD: channelRecipientAdd
|
||||
* * CHANNEL_RECIPIENT_REMOVE: channelRecipientRemove
|
||||
* * INTERACTION_MODAL_CREATE: interactionModalCreate
|
||||
* * CALL_CREATE: callCreate
|
||||
* * CALL_UPDATE: callUpdate
|
||||
* * CALL_DELETE: callDelete
|
||||
* @typedef {Object<string, string>} Events
|
||||
*/
|
||||
exports.Events = {
|
||||
@@ -440,7 +316,6 @@ exports.Events = {
|
||||
API_RESPONSE: 'apiResponse',
|
||||
API_REQUEST: 'apiRequest',
|
||||
CLIENT_READY: 'ready',
|
||||
APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE: 'applicationCommandAutocompleteResponse',
|
||||
APPLICATION_COMMAND_CREATE: 'applicationCommandCreate',
|
||||
APPLICATION_COMMAND_DELETE: 'applicationCommandDelete',
|
||||
APPLICATION_COMMAND_UPDATE: 'applicationCommandUpdate',
|
||||
@@ -449,21 +324,16 @@ exports.Events = {
|
||||
AUTO_MODERATION_RULE_CREATE: 'autoModerationRuleCreate',
|
||||
AUTO_MODERATION_RULE_DELETE: 'autoModerationRuleDelete',
|
||||
AUTO_MODERATION_RULE_UPDATE: 'autoModerationRuleUpdate',
|
||||
CALL_CREATE: 'callCreate',
|
||||
CALL_DELETE: 'callDelete',
|
||||
CALL_UPDATE: 'callUpdate',
|
||||
GUILD_AVAILABLE: 'guildAvailable',
|
||||
GUILD_CREATE: 'guildCreate',
|
||||
GUILD_DELETE: 'guildDelete',
|
||||
GUILD_UPDATE: 'guildUpdate',
|
||||
GUILD_APPLICATION_COMMANDS_UPDATE: 'guildApplicationCommandUpdate',
|
||||
GUILD_UNAVAILABLE: 'guildUnavailable',
|
||||
GUILD_MEMBER_ADD: 'guildMemberAdd',
|
||||
GUILD_MEMBER_REMOVE: 'guildMemberRemove',
|
||||
GUILD_MEMBER_UPDATE: 'guildMemberUpdate',
|
||||
GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable',
|
||||
GUILD_MEMBERS_CHUNK: 'guildMembersChunk',
|
||||
GUILD_MEMBER_LIST_UPDATE: 'guildMemberListUpdate',
|
||||
GUILD_INTEGRATIONS_UPDATE: 'guildIntegrationsUpdate',
|
||||
GUILD_ROLE_CREATE: 'roleCreate',
|
||||
GUILD_ROLE_DELETE: 'roleDelete',
|
||||
@@ -479,9 +349,6 @@ exports.Events = {
|
||||
CHANNEL_DELETE: 'channelDelete',
|
||||
CHANNEL_UPDATE: 'channelUpdate',
|
||||
CHANNEL_PINS_UPDATE: 'channelPinsUpdate',
|
||||
CHANNEL_RECIPIENT_REMOVE: 'channelRecipientRemove',
|
||||
CHANNEL_RECIPIENT_ADD: 'channelRecipientAdd',
|
||||
MESSAGE_ACK: 'messageAck',
|
||||
MESSAGE_CREATE: 'messageCreate',
|
||||
MESSAGE_DELETE: 'messageDelete',
|
||||
MESSAGE_UPDATE: 'messageUpdate',
|
||||
@@ -497,17 +364,11 @@ exports.Events = {
|
||||
THREAD_MEMBER_UPDATE: 'threadMemberUpdate',
|
||||
THREAD_MEMBERS_UPDATE: 'threadMembersUpdate',
|
||||
USER_UPDATE: 'userUpdate',
|
||||
USER_SETTINGS_UPDATE: 'userSettingsUpdate',
|
||||
USER_GUILD_SETTINGS_UPDATE: 'userGuildSettingsUpdate',
|
||||
PRESENCE_UPDATE: 'presenceUpdate',
|
||||
VOICE_SERVER_UPDATE: 'voiceServerUpdate',
|
||||
VOICE_STATE_UPDATE: 'voiceStateUpdate',
|
||||
TYPING_START: 'typingStart',
|
||||
WEBHOOKS_UPDATE: 'webhookUpdate',
|
||||
INTERACTION_CREATE: 'interactionCreate',
|
||||
INTERACTION_SUCCESS: 'interactionSuccess',
|
||||
INTERACTION_FAILURE: 'interactionFailure',
|
||||
INTERACTION_MODAL_CREATE: 'interactionModalCreate',
|
||||
ERROR: 'error',
|
||||
WARN: 'warn',
|
||||
DEBUG: 'debug',
|
||||
@@ -531,18 +392,16 @@ exports.Events = {
|
||||
GUILD_SCHEDULED_EVENT_USER_ADD: 'guildScheduledEventUserAdd',
|
||||
GUILD_SCHEDULED_EVENT_USER_REMOVE: 'guildScheduledEventUserRemove',
|
||||
GUILD_AUDIT_LOG_ENTRY_CREATE: 'guildAuditLogEntryCreate',
|
||||
RELATIONSHIP_ADD: 'relationshipAdd',
|
||||
RELATIONSHIP_REMOVE: 'relationshipRemove',
|
||||
RELATIONSHIP_UPDATE: 'relationshipUpdate',
|
||||
UNHANDLED_PACKET: 'unhandledPacket',
|
||||
CAPTCHA_REQUIRED: 'captchaRequired',
|
||||
// ! TODO: Add more events
|
||||
SOUNDBOARD_SOUNDS: 'soundboardSounds',
|
||||
VOICE_CHANNEL_EFFECT_SEND: 'voiceChannelEffectSend',
|
||||
GUILD_SOUNDBOARD_SOUND_CREATE: 'guildSoundboardSoundCreate',
|
||||
GUILD_SOUNDBOARD_SOUND_UPDATE: 'guildSoundboardSoundUpdate',
|
||||
GUILD_SOUNDBOARD_SOUNDS_UPDATE: 'guildSoundboardSoundsUpdate',
|
||||
GUILD_SOUNDBOARD_SOUND_DELETE: 'guildSoundboardSoundDelete',
|
||||
RELATIONSHIP_ADD: 'relationshipAdd',
|
||||
RELATIONSHIP_UPDATE: 'relationshipUpdate',
|
||||
RELATIONSHIP_REMOVE: 'relationshipRemove',
|
||||
CHANNEL_RECIPIENT_ADD: 'channelRecipientAdd',
|
||||
CHANNEL_RECIPIENT_REMOVE: 'channelRecipientRemove',
|
||||
INTERACTION_MODAL_CREATE: 'interactionModalCreate',
|
||||
CALL_CREATE: 'callCreate',
|
||||
CALL_UPDATE: 'callUpdate',
|
||||
CALL_DELETE: 'callDelete',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -582,11 +441,10 @@ exports.PartialTypes = keyMirror(['USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE',
|
||||
* The type of a WebSocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:
|
||||
* * READY
|
||||
* * RESUMED
|
||||
* * APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE
|
||||
* * APPLICATION_COMMAND_CREATE (deprecated)
|
||||
* * APPLICATION_COMMAND_DELETE (deprecated)
|
||||
* * APPLICATION_COMMAND_UPDATE (deprecated)
|
||||
* * APPLICATION_COMMAND_PERMISSIONS_UPDATE
|
||||
* * APPLICATION_COMMAND_UPDATE (deprecated)
|
||||
* * AUTO_MODERATION_ACTION_EXECUTION
|
||||
* * AUTO_MODERATION_RULE_CREATE
|
||||
* * AUTO_MODERATION_RULE_DELETE
|
||||
@@ -631,7 +489,6 @@ exports.PartialTypes = keyMirror(['USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE',
|
||||
* * VOICE_STATE_UPDATE
|
||||
* * VOICE_SERVER_UPDATE
|
||||
* * WEBHOOKS_UPDATE
|
||||
* * INTERACTION_CREATE
|
||||
* * STAGE_INSTANCE_CREATE
|
||||
* * STAGE_INSTANCE_UPDATE
|
||||
* * STAGE_INSTANCE_DELETE
|
||||
@@ -648,7 +505,6 @@ exports.PartialTypes = keyMirror(['USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE',
|
||||
exports.WSEvents = keyMirror([
|
||||
'READY',
|
||||
'RESUMED',
|
||||
'APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE',
|
||||
'APPLICATION_COMMAND_CREATE',
|
||||
'APPLICATION_COMMAND_DELETE',
|
||||
'APPLICATION_COMMAND_UPDATE',
|
||||
@@ -697,7 +553,6 @@ exports.WSEvents = keyMirror([
|
||||
'VOICE_STATE_UPDATE',
|
||||
'VOICE_SERVER_UPDATE',
|
||||
'WEBHOOKS_UPDATE',
|
||||
'INTERACTION_CREATE',
|
||||
'STAGE_INSTANCE_CREATE',
|
||||
'STAGE_INSTANCE_UPDATE',
|
||||
'STAGE_INSTANCE_DELETE',
|
||||
@@ -725,6 +580,7 @@ exports.WSEvents = keyMirror([
|
||||
* * `guilds.join`: allows the bot to join the user to any guild it is in using Guild#addMember
|
||||
* * `gdm.join`: allows joining the user to a group dm
|
||||
* * `webhook.incoming`: generates a webhook to a channel
|
||||
* * `role_connections.write`: allows your app to update a user's connection and metadata for the app
|
||||
* @typedef {string} InviteScope
|
||||
* @see {@link https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes}
|
||||
*/
|
||||
@@ -741,6 +597,7 @@ exports.InviteScopes = [
|
||||
'guilds.join',
|
||||
'gdm.join',
|
||||
'webhook.incoming',
|
||||
'role_connections.write',
|
||||
];
|
||||
|
||||
// TODO: change Integration#expireBehavior to this and clean up Integration
|
||||
@@ -892,7 +749,7 @@ exports.ActivityTypes = createEnum(['PLAYING', 'STREAMING', 'LISTENING', 'WATCHI
|
||||
* * `GUILD_PRIVATE_THREAD` - a guild text channel's private thread channel
|
||||
* * `GUILD_STAGE_VOICE` - a guild stage voice channel
|
||||
* * `GUILD_DIRECTORY` - the channel in a hub containing guilds
|
||||
* * `GUILD_FORUM` - a guild channel that only contains threads
|
||||
* * `GUILD_FORUM` - a channel that can only contain threads
|
||||
* * `UNKNOWN` - a generic channel of unknown type, could be Channel or GuildChannel
|
||||
* @typedef {string} ChannelType
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-types}
|
||||
@@ -1131,7 +988,6 @@ exports.VerificationLevels = createEnum(['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_
|
||||
* * MAXIMUM_PINS
|
||||
* * MAXIMUM_RECIPIENTS
|
||||
* * MAXIMUM_ROLES
|
||||
* * MAXIMUM_USERNAMES
|
||||
* * MAXIMUM_WEBHOOKS
|
||||
* * MAXIMUM_EMOJIS
|
||||
* * MAXIMUM_REACTIONS
|
||||
@@ -1188,7 +1044,6 @@ exports.VerificationLevels = createEnum(['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_
|
||||
* * INVALID_API_VERSION
|
||||
* * FILE_UPLOADED_EXCEEDS_MAXIMUM_SIZE
|
||||
* * INVALID_FILE_UPLOADED
|
||||
* * GIFT_CODE_CLAIMED
|
||||
* * CANNOT_SELF_REDEEM_GIFT
|
||||
* * INVALID_GUILD
|
||||
* * INVALID_MESSAGE_TYPE
|
||||
@@ -1203,7 +1058,6 @@ exports.VerificationLevels = createEnum(['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_
|
||||
* * INSUFFICIENT_BOOSTS
|
||||
* * INVALID_JSON
|
||||
* * TWO_FACTOR_REQUIRED
|
||||
* * INVALID_TWO_FACTOR_CODE
|
||||
* * NO_USERS_WITH_DISCORDTAG_EXIST
|
||||
* * REACTION_BLOCKED
|
||||
* * RESOURCE_OVERLOADED
|
||||
@@ -1269,27 +1123,20 @@ exports.APIErrors = {
|
||||
UNKNOWN_GUILD_SCHEDULED_EVENT_USER: 10071,
|
||||
BOT_PROHIBITED_ENDPOINT: 20001,
|
||||
BOT_ONLY_ENDPOINT: 20002,
|
||||
RPC_PROXY_DISALLOWED: 20003,
|
||||
CANNOT_SEND_EXPLICIT_CONTENT: 20009,
|
||||
ACCOUNT_SCHEDULED_FOR_DELETION: 20011,
|
||||
NOT_AUTHORIZED: 20012,
|
||||
ACCOUNT_DISABLED: 20013,
|
||||
SLOWMODE_RATE_LIMIT: 20016,
|
||||
ACCOUNT_OWNER_ONLY: 20018,
|
||||
ANNOUNCEMENT_EDIT_LIMIT_EXCEEDED: 20022,
|
||||
UNDER_MINIMUM_AGE: 20024,
|
||||
QUARANTINED: 20026,
|
||||
CHANNEL_HIT_WRITE_RATELIMIT: 20028,
|
||||
SERVER_HIT_WRITE_RATELIMIT: 20029,
|
||||
CONTENT_NOT_ALLOWED: 20031,
|
||||
GUILD_PREMIUM_LEVEL_TOO_LOW: 20035,
|
||||
VANITY_URL_REQUIRED_FOR_PUBLISHED_GUILDS: 20040,
|
||||
MAXIMUM_GUILDS: 30001,
|
||||
MAXIMUM_FRIENDS: 30002,
|
||||
MAXIMUM_PINS: 30003,
|
||||
MAXIMUM_RECIPIENTS: 30004,
|
||||
MAXIMUM_ROLES: 30005,
|
||||
MAXIMUN_USERNAMES: 30006,
|
||||
MAXIMUM_WEBHOOKS: 30007,
|
||||
MAXIMUM_EMOJIS: 30008,
|
||||
MAXIMUM_REACTIONS: 30010,
|
||||
@@ -1298,7 +1145,6 @@ exports.APIErrors = {
|
||||
MAXIMUM_INVITES: 30016,
|
||||
MAXIMUM_ANIMATED_EMOJIS: 30018,
|
||||
MAXIMUM_SERVER_MEMBERS: 30019,
|
||||
NOT_ENOUGH_GUILD_MEMBERS: 30029,
|
||||
MAXIMUM_NUMBER_OF_SERVER_CATEGORIES: 30030,
|
||||
GUILD_ALREADY_HAS_TEMPLATE: 30031,
|
||||
MAXIMUM_THREAD_PARTICIPANTS: 30033,
|
||||
@@ -1312,16 +1158,11 @@ exports.APIErrors = {
|
||||
UNAUTHORIZED: 40001,
|
||||
ACCOUNT_VERIFICATION_REQUIRED: 40002,
|
||||
DIRECT_MESSAGES_TOO_FAST: 40003,
|
||||
SEND_MESSAGE_TEMPORARILY_DISABLED: 40004,
|
||||
REQUEST_ENTITY_TOO_LARGE: 40005,
|
||||
FEATURE_TEMPORARILY_DISABLED: 40006,
|
||||
USER_BANNED: 40007,
|
||||
CONNECTION_REVOKED: 40012,
|
||||
DELETE_ACCOUNT_TRANSFER_TEAM_OWNERSHIP: 40028,
|
||||
TARGET_USER_NOT_CONNECTED_TO_VOICE: 40032,
|
||||
ALREADY_CROSSPOSTED: 40033,
|
||||
TAG_REQUIRED: 40067,
|
||||
INVITES_DISABLED: 40069,
|
||||
MISSING_ACCESS: 50001,
|
||||
INVALID_ACCOUNT_TYPE: 50002,
|
||||
CANNOT_EXECUTE_ON_DM: 50003,
|
||||
@@ -1338,13 +1179,9 @@ exports.APIErrors = {
|
||||
INVALID_AUTHENTICATION_TOKEN: 50014,
|
||||
NOTE_TOO_LONG: 50015,
|
||||
INVALID_BULK_DELETE_QUANTITY: 50016,
|
||||
INVALID_MFA_LEVEL: 50017,
|
||||
INVALID_PASSWORD: 50018,
|
||||
CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019,
|
||||
INVALID_OR_TAKEN_INVITE_CODE: 50020,
|
||||
CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021,
|
||||
INVALID_PHONE_NUMBER: 50022,
|
||||
INVALID_CLIENT_ID: 50023,
|
||||
CANNOT_EXECUTE_ON_CHANNEL_TYPE: 50024,
|
||||
INVALID_OAUTH_TOKEN: 50025,
|
||||
MISSING_OAUTH_SCOPE: 50026,
|
||||
@@ -1357,8 +1194,6 @@ exports.APIErrors = {
|
||||
INVALID_API_VERSION: 50041,
|
||||
FILE_UPLOADED_EXCEEDS_MAXIMUM_SIZE: 50045,
|
||||
INVALID_FILE_UPLOADED: 50046,
|
||||
GIFT_CODE_CLAIMED: 50050,
|
||||
INVALID_GIFT_REDEMPTION_OWNED: 50051,
|
||||
CANNOT_SELF_REDEEM_GIFT: 50054,
|
||||
INVALID_GUILD: 50055,
|
||||
INVALID_MESSAGE_TYPE: 50068,
|
||||
@@ -1369,15 +1204,9 @@ exports.APIErrors = {
|
||||
INVALID_THREAD_NOTIFICATION_SETTINGS: 50084,
|
||||
PARAMETER_EARLIER_THAN_CREATION: 50085,
|
||||
GUILD_NOT_AVAILABLE_IN_LOCATION: 50095,
|
||||
INVALID_CANNOT_FRIEND_SELF: 50096,
|
||||
GUILD_MONETIZATION_REQUIRED: 50097,
|
||||
INSUFFICIENT_BOOSTS: 50101,
|
||||
INVALID_USER_SETTINGS_DATA: 50105,
|
||||
INVALID_ACTIVITY_LAUNCH_NO_ACCESS: 50106,
|
||||
INVALID_ACTIVITY_LAUNCH_PREMIUM_TIER: 50107,
|
||||
INVALID_ACTIVITY_LAUNCH_CONCURRENT_ACTIVITIES: 50108,
|
||||
INVALID_JSON: 50109,
|
||||
INVALID_FILE_ASSET_SIZE_RESIZE_GIF: 50138,
|
||||
CANNOT_MIX_SUBSCRIPTION_AND_NON_SUBSCRIPTION_ROLES_FOR_EMOJI: 50144,
|
||||
CANNOT_CONVERT_PREMIUM_EMOJI_TO_NORMAL_EMOJI: 50145,
|
||||
VOICE_MESSAGES_DO_NOT_SUPPORT_ADDITIONAL_CONTENT: 50159,
|
||||
@@ -1385,30 +1214,9 @@ exports.APIErrors = {
|
||||
VOICE_MESSAGES_MUST_HAVE_SUPPORTING_METADATA: 50161,
|
||||
VOICE_MESSAGES_CANNOT_BE_EDITED: 50162,
|
||||
YOU_CANNOT_SEND_VOICE_MESSAGES_IN_THIS_CHANNEL: 50173,
|
||||
TWO_FACTOR_ENABLED: 60001,
|
||||
TWO_FACTOR_DISABLED: 60002,
|
||||
TWO_FACTOR_REQUIRED: 60003,
|
||||
TWO_FACTOR_UNVERIFIED: 60004,
|
||||
TWO_FACTOR_INVALID_SECRET: 60005,
|
||||
TWO_FACTOR_INVALID_TICKET: 60006,
|
||||
INVALID_TWO_FACTOR_CODE: 60008,
|
||||
TWO_FACTOR_INVALID_SESSION: 60009,
|
||||
PHONE_NUMBER_UNABLE_TO_SEND: 70003,
|
||||
PHONE_VERIFICATION_REQUIRED: 70007,
|
||||
RELATIONSHIP_INCOMING_DISABLED: 80000,
|
||||
RELATIONSHIP_INCOMING_BLOCKED: 80001,
|
||||
RELATIONSHIP_INVALUD_USER_BOT: 80002,
|
||||
RELATIONSHIP_INVALID_SELF: 80003,
|
||||
NO_USERS_WITH_DISCORDTAG_EXIST: 80004,
|
||||
RELATIONSHIP_ALREADY_FRIENDS: 80007,
|
||||
REACTION_BLOCKED: 90001,
|
||||
INVALID_GIFT_REDEMPTION_SUBSCRIPTION_MANAGED: 100021,
|
||||
INVALID_GIFT_REDEMPTION_SUBSCRIPTION_INCOMPATIBLE: 100023,
|
||||
INVALID_GIFT_REDEMPTION_INVOICE_OPEN: 100024,
|
||||
BILLING_NON_REFUNDABLE_PAYMENT_SOURCE: 100060,
|
||||
LISTING_ALREADY_JOINED: 120000,
|
||||
LISTING_TOO_MANY_MEMBERS: 120001,
|
||||
LISTING_JOIN_BLOCKED: 120002,
|
||||
RESOURCE_OVERLOADED: 130000,
|
||||
STAGE_ALREADY_OPEN: 150006,
|
||||
CANNOT_REPLY_WITHOUT_READ_MESSAGE_HISTORY_PERMISSION: 160002,
|
||||
@@ -1423,12 +1231,8 @@ exports.APIErrors = {
|
||||
LOTTIE_ANIMATION_MAXIMUM_DIMENSIONS_EXCEEDED: 170005,
|
||||
STICKER_FRAME_RATE_IS_TOO_SMALL_OR_TOO_LARGE: 170006,
|
||||
STICKER_ANIMATION_DURATION_EXCEEDS_MAXIMUM_OF_5_SECONDS: 170007,
|
||||
POGGERMODE_TEMPORARILY_DISABLED: 170008,
|
||||
CANNOT_UPDATE_A_FINISHED_EVENT: 180000,
|
||||
FAILED_TO_CREATE_STAGE_NEEDED_FOR_STAGE_EVENT: 180002,
|
||||
AUTOMOD_MESSAGE_BLOCKED: 200000,
|
||||
AUTOMOD_TITLE_BLOCKED: 200001,
|
||||
HARMFUL_LINK_MESSAGE_BLOCKED: 240000,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1554,7 +1358,7 @@ exports.ApplicationCommandPermissionTypes = createEnum([null, 'ROLE', 'USER']);
|
||||
* * BOOLEAN_EQUAL
|
||||
* * BOOLEAN_NOT_EQUAL
|
||||
* @typedef {string} ApplicationRoleConnectionMetadataType
|
||||
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type}
|
||||
* @see{@link https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type}
|
||||
*/
|
||||
exports.ApplicationRoleConnectionMetadataTypes = createEnum([
|
||||
null,
|
||||
@@ -1607,7 +1411,6 @@ exports.AutoModerationActionTypes = createEnum([null, 'BLOCK_MESSAGE', 'SEND_ALE
|
||||
*/
|
||||
|
||||
exports.AutoModerationRuleEventTypes = createEnum([null, 'MESSAGE_SEND']);
|
||||
|
||||
/**
|
||||
* The type of an {@link Interaction} object:
|
||||
* * PING
|
||||
@@ -1656,37 +1459,29 @@ exports.InteractionResponseTypes = createEnum([
|
||||
* The type of a message component
|
||||
* * ACTION_ROW
|
||||
* * BUTTON
|
||||
* * TEXT_INPUT
|
||||
* * STRING_SELECT
|
||||
* * TEXT_INPUT
|
||||
* * USER_SELECT
|
||||
* * ROLE_SELECT
|
||||
* * MENTIONABLE_SELECT
|
||||
* * CHANNEL_SELECT
|
||||
* * SELECT_MENU (deprecated)
|
||||
* @typedef {string} MessageComponentType
|
||||
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types}
|
||||
*/
|
||||
exports.MessageComponentTypes = {
|
||||
...createEnum([
|
||||
null,
|
||||
'ACTION_ROW',
|
||||
'BUTTON',
|
||||
'STRING_SELECT',
|
||||
'TEXT_INPUT',
|
||||
'USER_SELECT',
|
||||
'ROLE_SELECT',
|
||||
'MENTIONABLE_SELECT',
|
||||
'CHANNEL_SELECT',
|
||||
]),
|
||||
/** @deprecated Use `STRING_SELECT` instead */
|
||||
SELECT_MENU: 3,
|
||||
/** @deprecated Use `STRING_SELECT` instead */
|
||||
3: 'SELECT_MENU',
|
||||
};
|
||||
exports.MessageComponentTypes = createEnum([
|
||||
null,
|
||||
'ACTION_ROW',
|
||||
'BUTTON',
|
||||
'STRING_SELECT',
|
||||
'TEXT_INPUT',
|
||||
'USER_SELECT',
|
||||
'ROLE_SELECT',
|
||||
'MENTIONABLE_SELECT',
|
||||
'CHANNEL_SELECT',
|
||||
]);
|
||||
|
||||
/**
|
||||
* The types of components that are select menus. The available types are:
|
||||
* * SELECT_MENU (deprecated)
|
||||
* * STRING_MENU
|
||||
* * USER_SELECT
|
||||
* * ROLE_SELECT
|
||||
@@ -1695,19 +1490,15 @@ exports.MessageComponentTypes = {
|
||||
* @typedef {string} SelectMenuComponentType
|
||||
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types}
|
||||
*/
|
||||
exports.SelectMenuComponentTypes = {
|
||||
...createEnum([
|
||||
...new Array(3).fill(null),
|
||||
'STRING_MENU',
|
||||
null,
|
||||
'USER_SELECT',
|
||||
'ROLE_SELECT',
|
||||
'MENTIONABLE_SELECT',
|
||||
'CHANNEL_SELECT',
|
||||
]),
|
||||
/** @deprecated Use `STRING_SELECT` instead */
|
||||
SELECT_MENU: 3,
|
||||
};
|
||||
exports.SelectMenuComponentTypes = createEnum([
|
||||
...new Array(3).fill(null),
|
||||
'STRING_MENU',
|
||||
null,
|
||||
'USER_SELECT',
|
||||
'ROLE_SELECT',
|
||||
'MENTIONABLE_SELECT',
|
||||
'CHANNEL_SELECT',
|
||||
]);
|
||||
|
||||
/**
|
||||
* The style of a message button
|
||||
@@ -1767,27 +1558,6 @@ exports.TextInputStyles = createEnum([null, 'SHORT', 'PARAGRAPH']);
|
||||
*/
|
||||
exports.GuildScheduledEventPrivacyLevels = createEnum([null, null, 'GUILD_ONLY']);
|
||||
|
||||
/**
|
||||
* Relationship Enums:
|
||||
* * 0: NONE
|
||||
* * 1: FRIEND
|
||||
* * 2: BLOCKED
|
||||
* * 3: PENDING_INCOMING
|
||||
* * 4: PENDING_OUTGOING
|
||||
* * 5: IMPLICIT
|
||||
* @typedef {string} RelationshipTypes
|
||||
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/relationships.html}
|
||||
*/
|
||||
|
||||
exports.RelationshipTypes = createEnum([
|
||||
'NONE',
|
||||
'FRIEND',
|
||||
'BLOCKED',
|
||||
'PENDING_INCOMING',
|
||||
'PENDING_OUTGOING',
|
||||
'IMPLICIT',
|
||||
]);
|
||||
|
||||
/**
|
||||
* The premium tier (Server Boost level) of a guild:
|
||||
* * NONE
|
||||
@@ -1821,6 +1591,7 @@ exports.GuildScheduledEventStatuses = createEnum([null, 'SCHEDULED', 'ACTIVE', '
|
||||
*/
|
||||
exports.GuildScheduledEventEntityTypes = createEnum([null, 'STAGE_INSTANCE', 'VOICE', 'EXTERNAL']);
|
||||
/* eslint-enable max-len */
|
||||
|
||||
/**
|
||||
* The camera video quality mode of a {@link VoiceChannel}:
|
||||
* * AUTO
|
||||
@@ -1831,7 +1602,7 @@ exports.GuildScheduledEventEntityTypes = createEnum([null, 'STAGE_INSTANCE', 'VO
|
||||
exports.VideoQualityModes = createEnum([null, 'AUTO', 'FULL']);
|
||||
|
||||
/**
|
||||
* Sort {@link ForumChannel} posts by ?
|
||||
* Sort {@link ForumChannel} posts by creation time or activity
|
||||
* * LATEST_ACTIVITY
|
||||
* * CREATION_DATE
|
||||
* @typedef {string} SortOrderType
|
||||
@@ -1849,10 +1620,31 @@ exports.SortOrderTypes = createEnum([null, 'LATEST_ACTIVITY', 'CREATION_DATE']);
|
||||
*/
|
||||
exports.ForumLayoutTypes = createEnum(['NOT_SET', 'LIST_VIEW', 'GALLERY_VIEW']);
|
||||
|
||||
/**
|
||||
* Relationship Enums:
|
||||
* * 0: NONE
|
||||
* * 1: FRIEND
|
||||
* * 2: BLOCKED
|
||||
* * 3: PENDING_INCOMING
|
||||
* * 4: PENDING_OUTGOING
|
||||
* * 5: IMPLICIT
|
||||
* @typedef {string} RelationshipTypes
|
||||
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/relationships.html}
|
||||
*/
|
||||
|
||||
exports.RelationshipTypes = createEnum([
|
||||
'NONE',
|
||||
'FRIEND',
|
||||
'BLOCKED',
|
||||
'PENDING_INCOMING',
|
||||
'PENDING_OUTGOING',
|
||||
'IMPLICIT',
|
||||
]);
|
||||
|
||||
exports._cleanupSymbol = Symbol('djsCleanup');
|
||||
|
||||
function keyMirror(arr) {
|
||||
const tmp = Object.create(null);
|
||||
let tmp = Object.create(null);
|
||||
for (const value of arr) tmp[value] = value;
|
||||
return tmp;
|
||||
}
|
||||
@@ -1907,12 +1699,11 @@ function createEnum(keys) {
|
||||
* @property {Object<InteractionResponseType, number>} InteractionResponseTypes The type of an interaction response.
|
||||
* @property {Object<InteractionType, number>} InteractionTypes The type of an {@link Interaction} object.
|
||||
* @property {InviteScope[]} InviteScopes The scopes of an invite.
|
||||
* @property {number} MaxBulkDeletableMessageAge Max bulk deletable message age (Unavailable to selfbots)
|
||||
* @property {Object<RelationshipTypes, number>} RelationshipTypes Relationship Enums
|
||||
* @property {Object<MembershipState, number>} MembershipStates The value set for a team members membership state.
|
||||
* @property {Object<MessageButtonStyle, number>} MessageButtonStyles The style of a message button.
|
||||
* @property {Object<MessageComponentType, number>} MessageComponentTypes The type of a message component.
|
||||
* @property {MessageType[]} MessageTypes The type of a {@link Message} object.
|
||||
* @property {Object<SelectMenuComponentType, number>} SelectMenuComponentTypes The type of any select menu.
|
||||
* @property {Object<MFALevel, number>} MFALevels The required MFA level for a guild.
|
||||
* @property {Object<NSFWLevel, number>} NSFWLevels NSFW level of a guild.
|
||||
* @property {Opcodes} Opcodes The types of Opcodes sent to the Gateway.
|
||||
@@ -1923,6 +1714,7 @@ function createEnum(keys) {
|
||||
* @property {Object<PrivacyLevel, number>} PrivacyLevels Privacy level of a {@link StageInstance} object.
|
||||
* @property {ShardEvents} ShardEvents The type of events emitted by a Shard.
|
||||
* @property {Status} Status The available statuses of the client.
|
||||
* @property {Object<SelectMenuComponentType, number>} SelectMenuComponentTypes The type of any select menu.
|
||||
* @property {Object<StickerFormatType, number>} StickerFormatTypes The value set for a stickers format type.
|
||||
* @property {Object<StickerType, number>} StickerTypes The value set for a stickers type.
|
||||
* @property {SweeperKey[]} SweeperKeys The name of an item to be swept in Sweepers.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const JSONBig = require('json-bigint');
|
||||
const { UserAgent } = require('./Constants');
|
||||
const Intents = require('./Intents');
|
||||
const { defaultUA } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* Rate limit data
|
||||
* @typedef {Object} RateLimitData
|
||||
@@ -28,28 +28,34 @@ const { defaultUA } = require('../util/Constants');
|
||||
* @returns {Collection} A Collection used to store the cache of the manager.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Function} CaptchaSolver
|
||||
* @param {Captcha} captcha Discord Captcha
|
||||
* @param {string} UserAgent Current UserAgent
|
||||
* @returns {Promise<string>} HCaptcha Token
|
||||
* @example
|
||||
* const Captcha = require("2captcha")
|
||||
* // A new 'solver' instance with our API key
|
||||
* const solver = new Captcha.Solver("<Your 2captcha api key>")
|
||||
* function solveCaptcha(captcha, UA) {
|
||||
* return solver.hcaptcha(captcha.captcha_sitekey, 'discord.com', {
|
||||
* invisible: 1,
|
||||
* userAgent: UA,
|
||||
* data: captcha.captcha_rqdata,
|
||||
* }).then(res => res.data)
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options for a client.
|
||||
* @typedef {Object} ClientOptions
|
||||
* @property {number|number[]|string} [shards] The shard's id to run, or an array of shard ids. If not specified,
|
||||
* the client will spawn {@link ClientOptions#shardCount} shards. If set to `auto`, it will fetch the
|
||||
* recommended amount of shards from Discord and spawn that amount
|
||||
* @property {number} [messageCreateEventGuildTimeout=100] The amount of time in milliseconds that the Client to register for messages with each guild
|
||||
* @property {number} [DMChannelVoiceStatusSync=0] The amount of time in milliseconds that the Client to register the event with each DM channel (0=Disable)
|
||||
* @property {number} [captchaRetryLimit=3] Captcha retry limit
|
||||
* @property {CaptchaSolver} [captchaSolver] Captcha Solver
|
||||
* @property {number} [closeTimeout=5000] The amount of time in milliseconds to wait for the close frame to be received
|
||||
* from the WebSocket. Don't have this too high/low. Its best to have it between 2_000-6_000 ms.
|
||||
* @property {boolean} [checkUpdate=true] Display module update information on the screen
|
||||
* @property {boolean} [syncStatus=true] Sync state with Discord Client
|
||||
* @property {boolean} [patchVoice=false] Automatically patch @discordjs/voice module (support for call)
|
||||
* @property {string} [captchaService=null] Captcha service to use for solving captcha {@link captchaServices}
|
||||
* @property {string} [captchaKey=null] Captcha service key
|
||||
* @property {string} [captchaRetryLimit=3] Captcha retry limit
|
||||
* @property {string} [captchaWithProxy=false] Whether to use proxy for captcha solving
|
||||
* @property {string} [password=null] Your Discord account password
|
||||
* @property {boolean} [usingNewAttachmentAPI=true] Use new attachment API
|
||||
* @property {string} [interactionTimeout=15000] The amount of time in milliseconds to wait for an interaction response, before rejecting
|
||||
* @property {boolean} [autoRedeemNitro=false] Automaticlly redeems nitro codes <NOTE: there is no cooldown on the auto redeem>
|
||||
* @property {string} [proxy] Proxy to use for the WebSocket + REST connection (proxy-agent uri type) {@link https://www.npmjs.com/package/proxy-agent}.
|
||||
* @property {boolean} [DMSync=false] Automatically synchronize call status (DM and group) at startup (event synchronization) [Warning: May cause rate limit to gateway)
|
||||
* @property {number} [shardCount=1] The total amount of shards used by all processes of this bot
|
||||
* from the WebSocket.
|
||||
* <info>Don't have this too high/low. It's best to have it between 2000-6000 ms.</info>
|
||||
* (e.g. recommended shard count, shard count of the ShardingManager)
|
||||
* @property {CacheFactory} [makeCache] Function to create a cache.
|
||||
* You can use your own function, or the {@link Options} class to customize the Collection used for the cache.
|
||||
@@ -86,23 +92,12 @@ const { defaultUA } = require('../util/Constants');
|
||||
* @property {boolean} [failIfNotExists=true] Default value for {@link ReplyMessageOptions#failIfNotExists}
|
||||
* @property {string[]} [userAgentSuffix] An array of additional bot info to be appended to the end of the required
|
||||
* [User Agent](https://discord.com/developers/docs/reference#user-agent) header
|
||||
* @property {PresenceData} [presence={}] Presence data to use upon login
|
||||
* @property {IntentsResolvable} [intents=131071] Intents to enable for this connection (but not using)
|
||||
* @property {number} [waitGuildTimeout=15000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
||||
* @property {number} [messageCreateEventGuildTimeout=100] Time in milliseconds that Clients to register for messages with each guild
|
||||
* missing guilds to be received before starting the bot. If not specified, the default is 100 milliseconds.
|
||||
* @property {PresenceData} [presence={ status: 'online', since: 0, activities: [], afk: false }] Presence data to use upon login
|
||||
* @property {number} [waitGuildTimeout=15_000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
||||
* missing guilds to be received before starting the bot. If not specified, the default is 15 seconds.
|
||||
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
|
||||
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
||||
* @property {HTTPOptions} [http] HTTP options
|
||||
* @property {CustomCaptchaSolver} [captchaSolver] Function to solve a captcha (custom)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function to solve a captcha
|
||||
* @typedef {function} CustomCaptchaSolver
|
||||
* @param {Captcha} captcha The captcha to solve
|
||||
* @param {string} userAgent The user agent to use for the request
|
||||
* @returns {Promise<string>} hcaptcha token
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -124,6 +119,7 @@ const { defaultUA } = require('../util/Constants');
|
||||
/**
|
||||
* WebSocket options (these are left as snake_case to match the API)
|
||||
* @typedef {Object} WebsocketOptions
|
||||
* @property {AgentOptions} [agent={}] HTTPS Agent options (WS Proxy)
|
||||
* @property {boolean} [compress=false] Whether to compress data sent on the connection
|
||||
* @property {WebSocketProperties} [properties] Properties to identify the client with
|
||||
*/
|
||||
@@ -158,23 +154,12 @@ class Options extends null {
|
||||
*/
|
||||
static createDefault() {
|
||||
return {
|
||||
jsonTransformer: object => JSONBig.stringify(object),
|
||||
captchaSolver: captcha => Promise.reject(new Error('CAPTCHA_SOLVER_NOT_IMPLEMENTED', captcha)),
|
||||
closeTimeout: 5_000,
|
||||
checkUpdate: true,
|
||||
syncStatus: true,
|
||||
autoRedeemNitro: false,
|
||||
captchaService: '',
|
||||
captchaKey: null,
|
||||
captchaRetryLimit: 3,
|
||||
captchaWithProxy: false,
|
||||
DMSync: false,
|
||||
patchVoice: false,
|
||||
password: null,
|
||||
usingNewAttachmentAPI: true,
|
||||
interactionTimeout: 15_000,
|
||||
waitGuildTimeout: 15_000,
|
||||
messageCreateEventGuildTimeout: 100,
|
||||
DMChannelVoiceStatusSync: 0,
|
||||
captchaRetryLimit: 3,
|
||||
captchaSolver: () => Promise.reject(new Error('CAPTCHA_SOLVER_NOT_IMPLEMENTED')),
|
||||
closeTimeout: 5_000,
|
||||
waitGuildTimeout: 15_000,
|
||||
shardCount: 1,
|
||||
makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
|
||||
messageCacheLifetime: 0,
|
||||
@@ -188,13 +173,11 @@ class Options extends null {
|
||||
retryLimit: 1,
|
||||
restTimeOffset: 500,
|
||||
restSweepInterval: 60,
|
||||
failIfNotExists: false,
|
||||
failIfNotExists: true,
|
||||
userAgentSuffix: [],
|
||||
presence: { status: 'online', since: 0, activities: [], afk: false },
|
||||
sweepers: {},
|
||||
proxy: '',
|
||||
ws: {
|
||||
// eslint-disable-next-line no-undef
|
||||
capabilities: 0, // https://discord-userdoccers.vercel.app/topics/gateway#gateway-capabilities
|
||||
properties: {
|
||||
os: 'Windows',
|
||||
@@ -205,7 +188,7 @@ class Options extends null {
|
||||
os_arch: 'x64',
|
||||
app_arch: 'ia32',
|
||||
system_locale: 'en-US',
|
||||
browser_user_agent: defaultUA,
|
||||
browser_user_agent: UserAgent,
|
||||
browser_version: '22.3.26',
|
||||
client_build_number: 244874,
|
||||
native_build_number: 39515,
|
||||
@@ -223,11 +206,12 @@ class Options extends null {
|
||||
api_code_version: 0,
|
||||
},
|
||||
version: 9,
|
||||
agent: {},
|
||||
},
|
||||
http: {
|
||||
agent: {},
|
||||
headers: {
|
||||
'User-Agent': defaultUA,
|
||||
'User-Agent': UserAgent,
|
||||
},
|
||||
version: 9,
|
||||
api: 'https://discord.com/api',
|
||||
@@ -328,7 +312,6 @@ class Options extends null {
|
||||
static get defaultMakeCacheSettings() {
|
||||
return {
|
||||
MessageManager: 200,
|
||||
/*
|
||||
ChannelManager: {
|
||||
sweepInterval: 3600,
|
||||
sweepFilter: require('./Util').archivedThreadSweepFilter(),
|
||||
@@ -341,7 +324,6 @@ class Options extends null {
|
||||
sweepInterval: 3600,
|
||||
sweepFilter: require('./Util').archivedThreadSweepFilter(),
|
||||
},
|
||||
*/
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user