update webhook cache and message cache stuff (#1910)

This commit is contained in:
Gus Caplan
2017-09-08 16:19:30 -05:00
committed by Crawl
parent dd085ceaee
commit 67c239b33f
2 changed files with 3 additions and 3 deletions

View File

@@ -5,12 +5,12 @@ class MessageCreateAction extends Action {
handle(data) { handle(data) {
const client = this.client; const client = this.client;
const channel = client.channels.get(data.channel_id); const channel = client.channels.get(data.channel_id);
const user = client.users.get(data.author.id);
if (channel) { if (channel) {
const existing = channel.messages.get(data.id); const existing = channel.messages.get(data.id);
if (existing) return { message: existing }; if (existing) return { message: existing };
const member = channel.guild ? channel.guild.member(user) : null;
const message = channel.messages.create(data); const message = channel.messages.create(data);
const user = message.author;
const member = channel.guild ? channel.guild.member(user) : null;
channel.lastMessageID = data.id; channel.lastMessageID = data.id;
channel.lastMessage = message; channel.lastMessage = message;
if (user) { if (user) {

View File

@@ -52,7 +52,7 @@ class Message extends Base {
* The author of the message * The author of the message
* @type {User} * @type {User}
*/ */
this.author = this.client.users.create(data.author); this.author = this.client.users.create(data.author, !data.webhook_id);
/** /**
* Represents the author of the message as a guild member * Represents the author of the message as a guild member