From 6fc18624e212b7c695e69824462d615e326fa119 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Mon, 5 Feb 2024 17:32:33 -0500 Subject: [PATCH] Handle attachments --- main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 49c121d..a891675 100644 --- a/main.js +++ b/main.js @@ -20,8 +20,13 @@ client.on('messageCreate', async message => { if (message.author.id === client.user.id) return; const timestamp = new Date(message.createdTimestamp).toISOString(); + let attachmentUrls = message.attachments.map(a => a.url).join(' '); + if (attachmentUrls) { + attachmentUrls = ' ' + attachmentUrls; + } + const formattedMessage = { - content: `<@${message.author.id}> / **${message.author.tag}**: ${message.content} \`${timestamp}\``, + content: `<@${message.author.id}> / **${message.author.tag}**: ${message.content}${attachmentUrls} \`${timestamp}\``, target: channelMappings[message.channel.id] };