Add user status/activity
This commit is contained in:
parent
a7b300d233
commit
1b75753a3d
|
@ -33,6 +33,7 @@ export const Modules = {
|
|||
get UserStore() { return this._getModule('UserStore'); },
|
||||
get RelationshipStore() { return this._getModule('RelationshipStore'); },
|
||||
get RelationshipManager() { return this._getModule('RelationshipManager'); },
|
||||
get UserStatusStore() { return this._getModule('UserStatusStore'); },
|
||||
|
||||
get DiscordPermissions() { return this.DiscordConstants.Permissions; }
|
||||
};
|
||||
|
|
|
@ -47,6 +47,20 @@ export class User {
|
|||
return DiscordApi.guilds.filter(g => g.members.find(m => m.id === this.id));
|
||||
}
|
||||
|
||||
get status() {
|
||||
return Modules.UserStatusStore.getStatus(this.id);
|
||||
}
|
||||
|
||||
get activity() {
|
||||
// type can be either 0 (normal/rich presence game), 1 (streaming) or 2 (listening to Spotify)
|
||||
// (3 appears as watching but is undocumented)
|
||||
return Modules.UserStatusStore.getActivity(this.id);
|
||||
}
|
||||
|
||||
get direct_messages() {
|
||||
return DiscordApi.channels.find(c => c.type === 'DM' && c.recipient_id === this.id);
|
||||
}
|
||||
|
||||
async ensurePrivateChannel() {
|
||||
if (DiscordApi.currentUser.id === this.id)
|
||||
throw new Error('Cannot create a direct message channel to the current user.');
|
||||
|
|
Loading…
Reference in New Issue