aboutsummaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-07-10 21:54:43 +0200
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-07-10 21:54:43 +0200
commit627979e836edd0801f9201a98e239bf697a211be (patch)
tree0cf2d347d4eb6f02bfcc714307c4e211664c53b9 /src/listeners
parent131b44f23be250aed2aeacdb51321b141d2ede4f (diff)
downloadtanzanite-627979e836edd0801f9201a98e239bf697a211be.tar.gz
tanzanite-627979e836edd0801f9201a98e239bf697a211be.tar.bz2
tanzanite-627979e836edd0801f9201a98e239bf697a211be.zip
allow more config options to be null / not set
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/message/directMessage.ts12
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] });
}
}