@@ -53,6 +53,19 @@ class PresenceManager extends CachedManager {
|
||||
const userId = this.client.users.resolveId(presence);
|
||||
return this.cache.has(userId) ? userId : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the overall user presence for all of the user's non-offline friends and implicit relationships.
|
||||
* @returns {Promise<Collection<Snowflake, Presence>>}
|
||||
*/
|
||||
async fetch() {
|
||||
const data = await this.client.api.presences.get();
|
||||
// https://docs.discord.sex/resources/presence#endpoints
|
||||
data.presences.forEach(presence => {
|
||||
this._add(presence, true);
|
||||
});
|
||||
return this.cache;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PresenceManager;
|
||||
|
||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -4650,6 +4650,7 @@ export class PermissionOverwriteManager extends CachedManager<
|
||||
|
||||
export class PresenceManager extends CachedManager<Snowflake, Presence, PresenceResolvable> {
|
||||
private constructor(client: Client, iterable?: Iterable<RawPresenceData>);
|
||||
public fetch(): Promise<Collection<Snowflake, Presence>>;
|
||||
}
|
||||
|
||||
export class ReactionManager extends CachedManager<Snowflake | string, MessageReaction, MessageReactionResolvable> {
|
||||
|
||||
Reference in New Issue
Block a user