From 8797069acf63e6ebdf8dbd820c4faa77c89b4124 Mon Sep 17 00:00:00 2001 From: TheDevYellowy Date: Tue, 2 Aug 2022 00:26:12 -0500 Subject: [PATCH 1/2] feat(Guild): mark as read; --- src/structures/Guild.js | 11 +++++++++++ typings/index.d.ts | 1 + 2 files changed, 12 insertions(+) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 6cb2f1b..240207c 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -1429,6 +1429,17 @@ class Guild extends AnonymousGuild { return this.client.actions.GuildDelete.handle({ id: this.id }).guild; } + /** + * Marks the guild as read + * @returns {undefined} nothing :) + * @example + * const guild = client.guilds.fetch('222078108977594368'); + * guild.read(); + */ + async read() { + await this.client.api.guilds(this.id).ack.post(); + } + /** * Deletes the guild. * @returns {Promise} diff --git a/typings/index.d.ts b/typings/index.d.ts index a7bf9ea..289d88b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1236,6 +1236,7 @@ export class Guild extends AnonymousGuild { public readonly maximumBitrate: number; public createTemplate(name: string, description?: string): Promise; public delete(): Promise; + public read(): undefined; public discoverySplashURL(options?: StaticImageURLOptions): string | null; public edit(data: GuildEditData, reason?: string): Promise; public editWelcomeScreen(data: WelcomeScreenEditData): Promise; From 56d62506383a0fe93ca4a4ed096152b2b1932798 Mon Sep 17 00:00:00 2001 From: TheDevYellowy Date: Tue, 2 Aug 2022 00:31:24 -0500 Subject: [PATCH 2/2] feat(Application): tidy up code --- src/structures/interfaces/Application.js | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/structures/interfaces/Application.js b/src/structures/interfaces/Application.js index 4d3d2c7..659fc1d 100644 --- a/src/structures/interfaces/Application.js +++ b/src/structures/interfaces/Application.js @@ -80,30 +80,30 @@ class Application extends Base { * @param {string} guild_id The id of the guild that you want to invite the bot to * @param {bigint} [permissions] The permissions for the bot in number form (the default is 8 / Administrator) * @param {string} [captcha] The captcha key to add - * @returns nothing :) + * @returns {undefined} nothing :) */ async invite(guild_id, permissions = 8, captcha = null) { - let res = await this.client.api.oauth2.authorize.post({ + await this.client.api.oauth2.authorize.post({ query: { client_id: this.id, - scope: 'bot applications.commands' - }, - data: captcha ? { - captcha_key: captcha, - authorize: true, - guild_id, - permissions, - } : { - authorize: true, - guild_id, - permissions, + scope: 'bot applications.commands', }, + data: captcha + ? { + captcha_key: captcha, + authorize: true, + guild_id, + permissions, + } + : { + authorize: true, + guild_id, + permissions, + }, headers: { - "referer": `https://discord.com/oauth2/authorize?client_id=${this.id}&permissions=${permissions}&scope=bot` - } + referer: `https://discord.com/oauth2/authorize?client_id=${this.id}&permissions=${permissions}&scope=bot`, + }, }); - - return; } /**