Add message.member if available

This commit is contained in:
Amish Shah
2016-08-30 13:40:39 +01:00
parent d249aa10cc
commit 0860d5210b
2 changed files with 12 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -46,6 +46,14 @@ class Message {
* The content of the message
* @type {String}
*/
if (this.guild) {
/**
* Represents the Author of the message as a Guild Member. Only available if the message comes from a Guild
* where the author is still a member.
* @type {GuildMember}
*/
this.member = this.guild.member(this.author);
}
this.content = data.content;
/**
* When the message was sent
@@ -137,6 +145,9 @@ class Message {
patch(data) {
if (data.author) {
this.author = this.client.users.get(data.author.id);
if (this.guild) {
this.member = this.guild.member(this.author);
}
}
if (data.content) {
this.content = data.content;