mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-23 13:44:59 +05:00
add deleted by
This commit is contained in:
parent
54cfde2a05
commit
b2070ba6cb
4 changed files with 13 additions and 4 deletions
|
@ -20,13 +20,22 @@ class messageDelete extends BaseEvent {
|
||||||
const guildData = message.data.guild;
|
const guildData = message.data.guild;
|
||||||
|
|
||||||
if (guildData.plugins?.monitoring?.messageDelete) {
|
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({
|
const embed = client.embed({
|
||||||
author: {
|
author: {
|
||||||
name: message.author.getUsername(),
|
name: message.author.getUsername(),
|
||||||
iconURL: message.author.displayAvatarURL(),
|
iconURL: message.author.displayAvatarURL(),
|
||||||
},
|
},
|
||||||
title: message.translate("misc:MONITORING:DELETE:TITLE", { user: message.author.getUsername() }),
|
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({
|
message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"MONITORING": {
|
"MONITORING": {
|
||||||
"DELETE": {
|
"DELETE": {
|
||||||
"TITLE": "{{user}} deleted a message!",
|
"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": {
|
"UPDATE": {
|
||||||
"TITLE": "{{user}} updated a message!",
|
"TITLE": "{{user}} updated a message!",
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"MONITORING": {
|
"MONITORING": {
|
||||||
"DELETE": {
|
"DELETE": {
|
||||||
"TITLE": "{{user}} удалил сообщение!",
|
"TITLE": "{{user}} удалил сообщение!",
|
||||||
"DESCRIPTION": "Содержимое сообщения было: ```{{content}}```\nКанал: {{channel}}\nВремя создания: {{time}}"
|
"DESCRIPTION": "Удалил: {{deletedBy}}\nСодержимое сообщения было: ```{{content}}```\nКанал: {{channel}}\nВремя создания: {{time}}"
|
||||||
},
|
},
|
||||||
"UPDATE": {
|
"UPDATE": {
|
||||||
"TITLE": "{{user}} обновил сообщение!",
|
"TITLE": "{{user}} обновил сообщение!",
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"MONITORING": {
|
"MONITORING": {
|
||||||
"DELETE": {
|
"DELETE": {
|
||||||
"TITLE": "{{user}} видалив повідомлення!",
|
"TITLE": "{{user}} видалив повідомлення!",
|
||||||
"DESCRIPTION": "Вміст повідомлення було: ```{{content}}```\nКанал: {{channel}}\nЧас створення: {{time}}"
|
"DESCRIPTION": "Видалив: {{deletedBy}}\nВміст повідомлення було: ```{{content}}```\nКанал: {{channel}}\nЧас створення: {{time}}"
|
||||||
},
|
},
|
||||||
"UPDATE": {
|
"UPDATE": {
|
||||||
"TITLE": "{{user}} оновив повідомлення!",
|
"TITLE": "{{user}} оновив повідомлення!",
|
||||||
|
|
Loading…
Reference in a new issue