feat(User): presenceFetch()

v12: user.presence
This commit is contained in:
Cinnamon
2022-06-23 10:25:02 +07:00
parent 614c32fed6
commit f6f3274878
3 changed files with 18 additions and 2 deletions

View File

@@ -472,6 +472,22 @@ class User extends Base {
return this;
}
/**
* Get presence (~ v12)
* @returns {Promise<Presence | null>}
*/
async presenceFetch() {
let data = null;
await Promise.all(
this.client.guilds.cache.map(async guild => {
const res_ = await guild.presences.resolve(this.id);
if (res_) return (data = res_);
return true;
}),
);
return data;
}
// These are here only for documentation purposes - they are implemented by TextBasedChannel
/* eslint-disable no-empty-function */
send() {}