add deleted by

This commit is contained in:
Jonny_Bro (Nikita) 2024-07-17 20:30:01 +05:00
parent 54cfde2a05
commit b2070ba6cb
Signed by: jonny_bro
GPG key ID: 3F1ECC04147E9BD8
4 changed files with 13 additions and 4 deletions

View file

@ -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: `<t:${Math.floor(message.createdTimestamp / 1000)}:f>` }),
description: message.translate("misc:MONITORING:DELETE:DESCRIPTION", { deletedBy: deletedMessage.executor ? deletedMessage.executor.toString() : "Unknown", content: message.content, channel: message.channel.toString(), time: `<t:${Math.floor(message.createdTimestamp / 1000)}:f>` }),
});
message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({

View file

@ -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!",

View file

@ -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}} обновил сообщение!",

View file

@ -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}} оновив повідомлення!",