mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-02 17:10:08 +00:00
Rewrite presence a little bit (#1853)
* such presence many good * Update PresenceStore.js * Update index.js * Update ClientPresenceStore.js * Update Presence.js * Update ClientPresenceStore.js * Update ClientUser.js * Update Presence.js * add timestamps and party * Update Presence.js * Update PresenceStore.js * Update ClientPresenceStore.js * Update ClientPresenceStore.js
This commit is contained in:
@@ -4,7 +4,6 @@ const Emoji = require('./Emoji');
|
||||
const Invite = require('./Invite');
|
||||
const GuildAuditLogs = require('./GuildAuditLogs');
|
||||
const Webhook = require('./Webhook');
|
||||
const { Presence } = require('./Presence');
|
||||
const GuildChannel = require('./GuildChannel');
|
||||
const GuildMember = require('./GuildMember');
|
||||
const VoiceRegion = require('./VoiceRegion');
|
||||
@@ -18,6 +17,7 @@ const GuildMemberStore = require('../stores/GuildMemberStore');
|
||||
const RoleStore = require('../stores/RoleStore');
|
||||
const EmojiStore = require('../stores/EmojiStore');
|
||||
const GuildChannelStore = require('../stores/GuildChannelStore');
|
||||
const PresenceStore = require('../stores/PresenceStore');
|
||||
const Base = require('./Base');
|
||||
const { Error, TypeError } = require('../errors');
|
||||
|
||||
@@ -51,9 +51,9 @@ class Guild extends Base {
|
||||
|
||||
/**
|
||||
* A collection of presences in this guild
|
||||
* @type {Collection<Snowflake, Presence>}
|
||||
* @type {PresenceStore<Snowflake, Presence>}
|
||||
*/
|
||||
this.presences = new Collection();
|
||||
this.presences = new PresenceStore(this.client);
|
||||
|
||||
if (!data) return;
|
||||
if (data.unavailable) {
|
||||
@@ -201,7 +201,7 @@ class Guild extends Base {
|
||||
|
||||
if (data.presences) {
|
||||
for (const presence of data.presences) {
|
||||
this._setPresence(presence.user.id, presence);
|
||||
this.presences.create(presence);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ class Guild extends Base {
|
||||
*/
|
||||
iconURL({ format, size } = {}) {
|
||||
if (!this.icon) return null;
|
||||
return Constants.Endpoints.CDN(this.client.options.http.cdn).Icon(this.id, this.icon, format, size);
|
||||
return this.client.rest.cdn.Icon(this.id, this.icon, format, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,7 +282,7 @@ class Guild extends Base {
|
||||
*/
|
||||
splashURL({ format, size } = {}) {
|
||||
if (!this.splash) return null;
|
||||
return Constants.Endpoints.CDN(this.client.options.http.cdn).Splash(this.id, this.splash, format, size);
|
||||
return this.client.rest.cdn.Splash(this.id, this.splash, format, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1159,14 +1159,6 @@ class Guild extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
_setPresence(id, presence) {
|
||||
if (this.presences.get(id)) {
|
||||
this.presences.get(id).update(presence);
|
||||
return;
|
||||
}
|
||||
this.presences.set(id, new Presence(presence));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position of a role in this guild.
|
||||
* @param {RoleResolvable} role The role to edit, can be a role object or a role ID
|
||||
|
||||
Reference in New Issue
Block a user