3. User Note

Credit: Discord S.C.U.M
This commit is contained in:
March 7th 2022-03-30 18:40:43 +07:00
parent c8598a36d5
commit 8c7dfd595c
2 changed files with 11 additions and 1 deletions

View File

@ -92,7 +92,9 @@ class UserManager extends CachedManager {
const data = await this.client.api.users(id).get(); const data = await this.client.api.users(id).get();
const userObject = this._add(data, cache); 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; return userObject;
} }

View File

@ -39,6 +39,7 @@ class User extends Base {
this.premiumGuildSince = null; this.premiumGuildSince = null;
this.mutualGuilds = new Collection(); this.mutualGuilds = new Collection();
this.applications = null; this.applications = null;
this.note = null;
this._patch(data); this._patch(data);
} }
@ -422,6 +423,13 @@ class User extends Base {
return json; 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 // These are here only for documentation purposes - they are implemented by TextBasedChannel
/* eslint-disable no-empty-function */ /* eslint-disable no-empty-function */
send() {} send() {}