diff --git a/events/Monitoring/messageDelete.js b/events/Monitoring/messageDelete.js index 8539e447..a60d9568 100644 --- a/events/Monitoring/messageDelete.js +++ b/events/Monitoring/messageDelete.js @@ -20,13 +20,22 @@ class messageDelete extends BaseEvent { const guildData = message.data.guild; if (guildData.plugins?.monitoring?.messageDelete) { + await client.wait(1000); + + const logs = await message.guild.fetchAuditLogs({ + limit: 5, + type: "MESSAGE_DELETE", + }); + + const deletedMessage = logs.entries.find(e => e.targetId === message.author.id && e.extra.channel.id && Date.now() - e.createdTimestamp < 20000); + const embed = client.embed({ author: { name: message.author.getUsername(), iconURL: message.author.displayAvatarURL(), }, title: message.translate("misc:MONITORING:DELETE:TITLE", { user: message.author.getUsername() }), - description: message.translate("misc:MONITORING:DELETE:DESCRIPTION", { content: message.content, channel: message.channel.toString(), time: `` }), + description: message.translate("misc:MONITORING:DELETE:DESCRIPTION", { deletedBy: deletedMessage.executor ? deletedMessage.executor.toString() : "Unknown", content: message.content, channel: message.channel.toString(), time: `` }), }); message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({ diff --git a/languages/en-US/misc.json b/languages/en-US/misc.json index 992fbc90..238a2fd2 100644 --- a/languages/en-US/misc.json +++ b/languages/en-US/misc.json @@ -24,7 +24,7 @@ "MONITORING": { "DELETE": { "TITLE": "{{user}} deleted a message!", - "DESCRIPTION": "Message content was: ```{{content}}```\nChannel: {{channel}}\nTime created: {{time}}" + "DESCRIPTION": "Deleted by: {{deletedBy}}\nMessage content was: ```{{content}}```\nChannel: {{channel}}\nTime created: {{time}}" }, "UPDATE": { "TITLE": "{{user}} updated a message!", diff --git a/languages/ru-RU/misc.json b/languages/ru-RU/misc.json index b8715eb9..4658461d 100644 --- a/languages/ru-RU/misc.json +++ b/languages/ru-RU/misc.json @@ -24,7 +24,7 @@ "MONITORING": { "DELETE": { "TITLE": "{{user}} удалил сообщение!", - "DESCRIPTION": "Содержимое сообщения было: ```{{content}}```\nКанал: {{channel}}\nВремя создания: {{time}}" + "DESCRIPTION": "Удалил: {{deletedBy}}\nСодержимое сообщения было: ```{{content}}```\nКанал: {{channel}}\nВремя создания: {{time}}" }, "UPDATE": { "TITLE": "{{user}} обновил сообщение!", diff --git a/languages/uk-UA/misc.json b/languages/uk-UA/misc.json index e7f35961..5d39b3c2 100644 --- a/languages/uk-UA/misc.json +++ b/languages/uk-UA/misc.json @@ -24,7 +24,7 @@ "MONITORING": { "DELETE": { "TITLE": "{{user}} видалив повідомлення!", - "DESCRIPTION": "Вміст повідомлення було: ```{{content}}```\nКанал: {{channel}}\nЧас створення: {{time}}" + "DESCRIPTION": "Видалив: {{deletedBy}}\nВміст повідомлення було: ```{{content}}```\nКанал: {{channel}}\nЧас створення: {{time}}" }, "UPDATE": { "TITLE": "{{user}} оновив повідомлення!",