From 8c7dfd595ccbb4ea7842efb0a04f3a0ab8c520ae Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 30 Mar 2022 18:40:43 +0700 Subject: [PATCH] 3. User Note Credit: Discord S.C.U.M --- src/managers/UserManager.js | 4 +++- src/structures/User.js | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/managers/UserManager.js b/src/managers/UserManager.js index 357a118..c84be8c 100644 --- a/src/managers/UserManager.js +++ b/src/managers/UserManager.js @@ -92,7 +92,9 @@ class UserManager extends CachedManager { const data = await this.client.api.users(id).get(); const userObject = this._add(data, cache); - if(!userObject.bot) await userObject.getProfile().catch(() => {}); + await userObject.getProfile().catch(() => {}); + const noteObject = await this.client.api.users['@me'].notes(id).get().catch(() => null); + userObject.note = noteObject?.note ?? null; return userObject; } diff --git a/src/structures/User.js b/src/structures/User.js index ced6bf3..b3717a1 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -39,6 +39,7 @@ class User extends Base { this.premiumGuildSince = null; this.mutualGuilds = new Collection(); this.applications = null; + this.note = null; this._patch(data); } @@ -422,6 +423,13 @@ class User extends Base { return json; } + async setNote(note = null) { + await this.client.api.users['@me'] + .notes(id) + .put({ data: { note } }); + return this.note = note; + } + // These are here only for documentation purposes - they are implemented by TextBasedChannel /* eslint-disable no-empty-function */ send() {}