mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 08:41:29 +00:00
Add message.member if available
This commit is contained in:
parent
d249aa10cc
commit
0860d5210b
2 changed files with 12 additions and 1 deletions
File diff suppressed because one or more lines are too long
|
|
@ -46,6 +46,14 @@ class Message {
|
||||||
* The content of the message
|
* The content of the message
|
||||||
* @type {String}
|
* @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;
|
this.content = data.content;
|
||||||
/**
|
/**
|
||||||
* When the message was sent
|
* When the message was sent
|
||||||
|
|
@ -137,6 +145,9 @@ class Message {
|
||||||
patch(data) {
|
patch(data) {
|
||||||
if (data.author) {
|
if (data.author) {
|
||||||
this.author = this.client.users.get(data.author.id);
|
this.author = this.client.users.get(data.author.id);
|
||||||
|
if (this.guild) {
|
||||||
|
this.member = this.guild.member(this.author);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data.content) {
|
if (data.content) {
|
||||||
this.content = data.content;
|
this.content = data.content;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue