Handle attachments
This commit is contained in:
parent
be83e1361f
commit
6fc18624e2
7
main.js
7
main.js
|
@ -20,8 +20,13 @@ client.on('messageCreate', async message => {
|
||||||
if (message.author.id === client.user.id) return;
|
if (message.author.id === client.user.id) return;
|
||||||
|
|
||||||
const timestamp = new Date(message.createdTimestamp).toISOString();
|
const timestamp = new Date(message.createdTimestamp).toISOString();
|
||||||
|
let attachmentUrls = message.attachments.map(a => a.url).join(' ');
|
||||||
|
if (attachmentUrls) {
|
||||||
|
attachmentUrls = ' ' + attachmentUrls;
|
||||||
|
}
|
||||||
|
|
||||||
const formattedMessage = {
|
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]
|
target: channelMappings[message.channel.id]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue