From 0ad5c2cc375a6cd9f697a02e8f6cded63629b51a Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Sat, 9 Mar 2024 17:40:40 +1100 Subject: [PATCH] Forward attachments too. --- src/events/messageCreate.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 6eacf28..2b68670 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -10,7 +10,12 @@ import MessageTool from '../helpers/MessageTool.js'; export default class MessageCreate { static async run(client:TClient, message:Discord.Message) { if (message.author.bot) return; - if (!message.inGuild()) return (client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({content: `${this.randomEmotes[Math.floor(Math.random()*this.randomEmotes.length)]} ${MessageTool.formatMention(client.config.whitelist[0], 'user')}\n**${message.author.username}** (\`${message.author.id}\`) sent me a DM, their message is:\`\`\`${message.content}\`\`\``, allowedMentions: {parse: ['users']}}); + if (!message.inGuild()) { + let fwdImages:string[] = []; + message.attachments.forEach(x=>fwdImages.push(x.url)); + (client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({content: `${this.randomEmotes[Math.floor(Math.random()*this.randomEmotes.length)]} ${MessageTool.formatMention(client.config.whitelist[0], 'user')}\n**${message.author.username}** (\`${message.author.id}\`) sent me a DM, their message is:\`\`\`${message.content.length < 1 ? '(No content)' : message.content}\`\`\``, files: fwdImages, allowedMentions: {parse: ['users']}}); + return; + } let automodded: boolean; if (client.config.botSwitches.automod && !message.member?.roles.cache.has(client.config.dcServer.roles.dcmod) && !message.member?.roles.cache.has(client.config.dcServer.roles.admin) && message.guildId === client.config.dcServer.id) {