diff options
Diffstat (limited to 'src/listeners')
-rw-r--r-- | src/listeners/message/directMessage.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index 91733a5..7278e63 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -14,7 +14,11 @@ export default class DirectMessageListener extends BushListener { if (message.channel.type === ChannelType.DM) { if (!(message.author.id == this.client.user!.id) && message.author.bot) return; if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) return; - const dmLogEmbed = new EmbedBuilder().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipientId}` }); + + const dmLogEmbed = new EmbedBuilder() + .setTimestamp() + .setFooter({ text: `User ID • ${message.channel.recipientId}` }) + .setDescription(`**DM:**\n${message.content}`); if (message.author.id != this.client.user!.id) { dmLogEmbed @@ -22,7 +26,6 @@ export default class DirectMessageListener extends BushListener { name: `From: ${message.author.username}`, iconURL: `${message.author.displayAvatarURL()}` }) - .setDescription(`**DM:**\n${message}`) .setColor(colors.blue); } else { dmLogEmbed @@ -30,9 +33,7 @@ export default class DirectMessageListener extends BushListener { name: `To: ${message.channel.recipient?.username}`, iconURL: `${message.channel.recipient?.displayAvatarURL()}` }) - .setDescription(`**DM:**\n${message}`) - .setColor(colors.red) - .setTimestamp(); + .setColor(colors.red); } if (message.attachments.filter((a) => typeof a.size == 'number').size == 1) { dmLogEmbed.setImage(message.attachments.filter((a) => typeof a.size == 'number').first()!.proxyURL); @@ -40,6 +41,7 @@ export default class DirectMessageListener extends BushListener { dmLogEmbed.addFields({ name: 'Attachments', value: message.attachments.map((a) => a.proxyURL).join('\n') }); } const dmChannel = await this.client.utils.getConfigChannel('dm'); + if (dmChannel === null) return; await dmChannel.send({ embeds: [dmLogEmbed] }); } } |