order of operations fix to channel loading

This commit is contained in:
Erik 2021-06-21 17:54:20 +03:00
parent 47e2f83708
commit 30df50614d
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -46,9 +46,9 @@ class ChannelHandler {
error: true, error: true,
msg: `Internal error, this has been logged.` msg: `Internal error, this has been logged.`
}; };
history.push(newEntry);
const channel = await this.load(target, history).catch(this.client.logger.error.bind(this.client.logger)); const channel = await this.load(target, history).catch(this.client.logger.error.bind(this.client.logger));
history.push(newEntry);
const sent = await channel.send({ embed }).catch((err) => { const sent = await channel.send({ embed }).catch((err) => {
this.client.logger.error(`channel.send errored:\n${err.stack}\nContent: "${embed}"`); this.client.logger.error(`channel.send errored:\n${err.stack}\nContent: "${embed}"`);
}); });
@ -161,7 +161,8 @@ class ChannelHandler {
text: user.id text: user.id
}, },
author: { author: {
name: user.tag + (entry.anon ? ' (ANONYMOUS REPLY)' : ''), // eslint-disable-next-line no-nested-ternary
name: user.tag + (entry.anon ? ' (ANON)' : entry.isReply ? ' (STAFF)' : ''),
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
icon_url: user.displayAvatarURL({ dynamic: true }) icon_url: user.displayAvatarURL({ dynamic: true })
}, },