From d107066dbab07ed6d7d6e790ddd0181f26c16672 Mon Sep 17 00:00:00 2001 From: Ramsey Date: Fri, 20 Dec 2024 15:18:49 +0100 Subject: [PATCH 1/2] Add application to client options in constructor --- index.d.ts | 1 + lib/Client.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/index.d.ts b/index.d.ts index 6cd2a5d39..b2c433459 100644 --- a/index.d.ts +++ b/index.d.ts @@ -507,6 +507,7 @@ declare namespace Eris { type: ApplicationRoleConnectionMetadataTypes; } interface ClientOptions { + application?: { id: string; flags?: number }; /** @deprecated */ agent?: HTTPSAgent; allowedMentions?: AllowedMentions; diff --git a/lib/Client.js b/lib/Client.js index 97f9ea634..5e819c850 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -152,6 +152,13 @@ class Client extends EventEmitter { ws: {}, reconnectDelay: (lastDelay, attempts) => Math.pow(attempts + 1, 0.7) * 20000, }, options); + + if (options.application) { + this.application = { + id: options.application.id, + flags: options.application.flags ?? 0, + }; + } this.options.allowedMentions = this._formatAllowedMentions(this.options.allowedMentions); if (this.options.lastShardID === undefined && this.options.maxShards !== "auto") { this.options.lastShardID = this.options.maxShards - 1; From 1010102fa3c401615b4e2c98c4901865038084a2 Mon Sep 17 00:00:00 2001 From: Ramsey Date: Fri, 20 Dec 2024 16:21:53 +0100 Subject: [PATCH 2/2] Fix JSDoc and formatting --- index.d.ts | 2 +- lib/Client.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index b2c433459..8e2348cf0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -507,10 +507,10 @@ declare namespace Eris { type: ApplicationRoleConnectionMetadataTypes; } interface ClientOptions { - application?: { id: string; flags?: number }; /** @deprecated */ agent?: HTTPSAgent; allowedMentions?: AllowedMentions; + application?: { id: string; flags?: number }; autoreconnect?: boolean; compress?: boolean; connectionTimeout?: number; diff --git a/lib/Client.js b/lib/Client.js index 5e819c850..991ef7dcd 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -79,6 +79,7 @@ class Client extends EventEmitter { * Create a Client * @arg {String} token The auth token to use. Bot tokens should be prefixed with `Bot` (e.g. `Bot MTExIHlvdSAgdHJpZWQgMTEx.O5rKAA.dQw4w9WgXcQ_wpV-gGA4PSk_bm8`). Prefix-less bot tokens are [DEPRECATED] * @arg {Object} options Eris client options + * @arg {Object} [options.application] Object containing the bot application's ID and its public flags * @arg {Object} [options.agent] [DEPRECATED] A HTTPS Agent used to proxy requests. This option has been moved under `options.rest` * @arg {Object} [options.allowedMentions] A list of mentions to allow by default in createMessage/editMessage * @arg {Boolean} [options.allowedMentions.everyone] Whether or not to allow @everyone/@here