From da93f6364d794362c750cecc7b587d20b7838a77 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Mon, 29 Aug 2022 10:29:03 +0700 Subject: [PATCH] refactor(RichPresence): getUUID, getExternal => static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Nguyễn Hồng Đức --- Document/RichPresence.md | 8 ++++---- src/structures/RichPresence.js | 4 ++-- typings/index.d.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Document/RichPresence.md b/Document/RichPresence.md index 42fb8a6..17fdfe7 100644 --- a/Document/RichPresence.md +++ b/Document/RichPresence.md @@ -94,7 +94,7 @@ const r = new Discord.RichPresence() .setParty({ max: 9, current: 1, - id: Discord.getUUID(), + id: Discord.RichPresence.getUUID(), }) .setStartTimestamp(Date.now()) .setAssetsLargeImage('mp:attachments/820557032016969751/991172011483218010/unknown.png') @@ -118,7 +118,7 @@ const r = new Discord.RichPresence() .setParty({ max: 9, current: 1, - id: Discord.getUUID(), + id: Discord.RichPresence.getUUID(), }) .setStartTimestamp(Date.now()) .setAssetsLargeImage('https://cdn.discordapp.com/attachments/820557032016969751/991172011483218010/unknown.png') @@ -135,7 +135,7 @@ client.user.setActivity(r.toJSON()); ```js const rpc = new Discord.RichPresence(); -const imageSet = await rpc.getExternal(client, '820344593357996092', 'https://musedash.moe/covers/papipupipupipa_cover.hash.93ae31d41.png', 'https://musedash.moe/covers/lights_of_muse_cover.hash.1c18e1e22.png') +const imageSet = await Discord.RichPresence.getExternal(client, '820344593357996092', 'https://musedash.moe/covers/papipupipupipa_cover.hash.93ae31d41.png', 'https://musedash.moe/covers/lights_of_muse_cover.hash.1c18e1e22.png') rpc .setApplicationId('820344593357996092') .setType('PLAYING') @@ -165,4 +165,4 @@ const asset = await bot.application.fetchAssets(); - More: - - You can change the status 5 times every 20 seconds! + - You can change the status 5 times / 20 seconds! diff --git a/src/structures/RichPresence.js b/src/structures/RichPresence.js index 4390811..badd918 100644 --- a/src/structures/RichPresence.js +++ b/src/structures/RichPresence.js @@ -473,7 +473,7 @@ https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichP * Get random UUID string (Util) * @returns {string} */ - getUUID() { + static getUUID() { return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, a => (a ^ ((Math.random() * 16) >> (a / 4))).toString(16), ); @@ -487,7 +487,7 @@ https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichP * @param {string} image2 URL image 2 (not from Discord) * @returns {ExternalAssets[]} */ - async getExternal(client, applicationId, image1 = '', image2 = '') { + static async getExternal(client, applicationId, image1 = '', image2 = '') { const checkURL = url => { try { // eslint-disable-next-line no-new diff --git a/typings/index.d.ts b/typings/index.d.ts index 79408d9..1385f3d 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -250,13 +250,13 @@ export abstract class RichPresence { public setEndTimestamp(timestamp?: Date): this; public setButtons(...button: RichButton[]): this; public addButton(name: string, url: string): this; - public getExternal( + public static getExternal( client: Client, applicationId: Snowflake, image1: string, image2: string, ): Promise; - public getUUID(): string; + public static getUUID(): string; public toJSON(): object; }