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:
@@ -58,6 +58,22 @@ export default class Message extends Equality{
|
||||
return this.author;
|
||||
}
|
||||
|
||||
toObject() {
|
||||
let keys = ['id', 'timestamp', 'everyoneMentioned', 'pinned', 'editedTimestamp', 'content', 'cleanContent', 'tts', 'attachments', 'embeds'],
|
||||
obj = {};
|
||||
|
||||
for (let k of keys) {
|
||||
obj[k] = this[k];
|
||||
}
|
||||
|
||||
obj.channelID = this.channel ? this.channel.id : null;
|
||||
obj.serverID = this.server ? this.server.id : null;
|
||||
obj.author = this.author.toObject();
|
||||
obj.mentions = this.mentions.map(m => m.toObject());
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
isMentioned(user){
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (!user) {
|
||||
|
||||
Reference in New Issue
Block a user