mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
add .toObject() method to structures (#522)
* add .toObject() method to structures * add compiled PMChannel change from last commit * uncomment members in VoiceChannel toObject method
This commit is contained in:
@@ -132,6 +132,22 @@ export default class Server extends Equality {
|
||||
return new Date((+this.id / 4194304) + 1420070400000);
|
||||
}
|
||||
|
||||
toObject() {
|
||||
var keys = ['id', 'name', 'region', 'ownerID', 'icon', 'afkTimeout', 'afkChannelID', 'large', 'memberCount'],
|
||||
obj = {};
|
||||
|
||||
for (let k of keys) {
|
||||
obj[k] = this[k];
|
||||
}
|
||||
|
||||
obj.members = this.members.map(member => member.toObject());
|
||||
obj.channels = this.channels.map(channel => channel.toObject());
|
||||
obj.roles = this.roles.map(role => role.toObject());
|
||||
obj.emojis = this.emojis.map(emoji => emoji.toObject());
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
detailsOf(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
|
||||
Reference in New Issue
Block a user