1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-27 04:15:38 -05:00

revise messageDelete to hide content field if empty

This commit is contained in:
toast-ts 2022-12-24 22:13:22 +11:00
parent 04ea199cfb
commit 4b99e06644

View File

@ -8,7 +8,12 @@ export default {
if (msg.guild?.id != client.config.mainServer.id) return;
if (msg.partial) return;
if (msg.author.bot) return;
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.tag} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted').setDescription(`<@${msg.author.id}>\nContent:\n\`\`\`\n${msg?.content}\n\`\`\`\nChannel: <#${msg.channelId}>`)
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.tag} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted').setDescription(`<@${msg.author.id}>\n\`${msg.author.id}\``);
if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${msg.content.slice(0,1020)}\n\`\`\``});
embed.addFields(
{ name: 'Channel', value: `<#${msg.channelId}>` },
{ name: 'Sent at', value: `<t:${Math.round(msg.createdTimestamp/1000)}>\n<t:${Math.round(msg.createdTimestamp/1000)}:R>` }
)
const attachments: Array<string> = [];
msg.attachments.forEach((x) => attachments.push(x.url));
channel.send({embeds: [embed], files: attachments})