mirror of
https://github.com/danbulant/Shasha
synced 2026-06-19 22:31:31 +00:00
fix (?) audit filter
This commit is contained in:
parent
1a2a9f3e1d
commit
c6524d7320
1 changed files with 5 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ const getColor = require("../getColor");
|
|||
*/
|
||||
module.exports = async (msg) => {
|
||||
if (msg.partial) return;
|
||||
const dateNow = new Date();
|
||||
if (msg.guild) {
|
||||
if (!msg.guild.DB) await msg.guild.dbLoad();
|
||||
msg.guild.updateCached("systemChannelID", msg.guild.systemChannelID);
|
||||
|
|
@ -25,8 +26,10 @@ module.exports = async (msg) => {
|
|||
const emb = defaultEventLogEmbed(msg.guild);
|
||||
let audit = {};
|
||||
if (msg.guild.member(msg.client.user).hasPermission("VIEW_AUDIT_LOG")) {
|
||||
const the = (await msg.guild.fetchAuditLogs({ limit: 1, type: "MESSAGE_DELETE" })).entries.first();
|
||||
if (the.target.id === msg.id) audit = the;
|
||||
const col = await msg.guild.fetchAuditLogs({ type: "MESSAGE_DELETE" });
|
||||
const colFilter = col.entries.filter((r) => r.target.id === msg.author.id && r.extra.channel.id === msg.channel.id);
|
||||
audit = colFilter.first() || {};
|
||||
// console.log();
|
||||
}
|
||||
emb.setColor(getColor("yellow"))
|
||||
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted" + (audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
||||
|
|
|
|||
Loading…
Reference in a new issue