feat: remove messageCreateEventGuildTimeout & change UA default

This commit is contained in:
Elysia
2024-01-23 21:03:42 +07:00
parent 87d0334eb8
commit 2472642184
5 changed files with 39 additions and 35 deletions

View File

@@ -9,7 +9,7 @@ const { Error, RangeError, TypeError } = require('../errors');
exports.MaxBulkDeletableMessageAge = 1_209_600_000;
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';
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
/**
* The types of WebSocket error codes:
@@ -172,8 +172,10 @@ exports.Status = {
* * REQUEST_SOUNDBOARD_SOUNDS: 31
* * SPEED_TEST_CREATE: 32 => Create a voice speed test.
* * SPEED_TEST_DELETE: 33 => Delete a voice speed test.
* * REQUEST_LAST_MESSAGES: 34 => Request last messages for a guild's channels.
* * REQUEST_LAST_MESSAGES: 34 => Request last messages for a guild's channels.
* * SEARCH_RECENT_MEMBERS: 35 => ~ Opcode 8 (Member Safety)
* * REQUEST_CHANNEL_STATUSES: 36 => Request Voice Channel status.
* * GUILD_SUBSCRIPTIONS_BULK: 37 => ~ Opcode 14
* @typedef {Object<string, number>} Opcodes
*/
exports.Opcodes = {
@@ -212,7 +214,9 @@ exports.Opcodes = {
SPEED_TEST_DELETE: 33, // Payload: null
REQUEST_LAST_MESSAGES: 34, // Payload: { guild_id: string, channel_ids: string[] }
SEARCH_RECENT_MEMBERS: 35, // Payload: { guild_id: string, query: string, continuation_token?: Snowflake }
// Update: 17/7/2023
REQUEST_CHANNEL_STATUSES: 36, // Payload: { guild_id: string } | Response: CHANNEL_STATUSES | { guild_id, channels: { status, id }[] }
GUILD_SUBSCRIPTIONS_BULK: 37, // Payload: { subscriptions: Object<guild_id, { Payload_op14 - guild_id }> } | Response: Opcode 14
// Updated: 23/1/2024
};
/**

View File

@@ -49,7 +49,6 @@ const Intents = require('./Intents');
/**
* Options for a client.
* @typedef {Object} ClientOptions
* @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
@@ -154,7 +153,6 @@ class Options extends null {
*/
static createDefault() {
return {
messageCreateEventGuildTimeout: 100,
DMChannelVoiceStatusSync: 0,
captchaRetryLimit: 3,
captchaSolver: () => Promise.reject(new Error('CAPTCHA_SOLVER_NOT_IMPLEMENTED')),
@@ -181,19 +179,19 @@ class Options extends null {
capabilities: 0, // https://discord-userdoccers.vercel.app/topics/gateway#gateway-capabilities
properties: {
os: 'Windows',
browser: 'Discord Client',
release_channel: 'stable',
client_version: '1.0.9023',
os_version: '10.0.19045',
os_arch: 'x64',
app_arch: 'ia32',
browser: 'Chrome',
device: '',
system_locale: 'en-US',
browser_user_agent: UserAgent,
browser_version: '22.3.26',
client_build_number: 244874,
native_build_number: 39515,
browser_version: '120.0.0.0',
os_version: '10',
referrer: '',
referring_domain: '',
referrer_current: '',
referring_domain_current: '',
release_channel: 'stable',
client_build_number: 260292,
client_event_source: null,
design_id: 0,
},
compress: false,
client_state: {