mirror of
https://github.com/danbulant/Shasha
synced 2026-07-07 12:01:22 +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) => {
|
module.exports = async (msg) => {
|
||||||
if (msg.partial) return;
|
if (msg.partial) return;
|
||||||
|
const dateNow = new Date();
|
||||||
if (msg.guild) {
|
if (msg.guild) {
|
||||||
if (!msg.guild.DB) await msg.guild.dbLoad();
|
if (!msg.guild.DB) await msg.guild.dbLoad();
|
||||||
msg.guild.updateCached("systemChannelID", msg.guild.systemChannelID);
|
msg.guild.updateCached("systemChannelID", msg.guild.systemChannelID);
|
||||||
|
|
@ -25,8 +26,10 @@ module.exports = async (msg) => {
|
||||||
const emb = defaultEventLogEmbed(msg.guild);
|
const emb = defaultEventLogEmbed(msg.guild);
|
||||||
let audit = {};
|
let audit = {};
|
||||||
if (msg.guild.member(msg.client.user).hasPermission("VIEW_AUDIT_LOG")) {
|
if (msg.guild.member(msg.client.user).hasPermission("VIEW_AUDIT_LOG")) {
|
||||||
const the = (await msg.guild.fetchAuditLogs({ limit: 1, type: "MESSAGE_DELETE" })).entries.first();
|
const col = await msg.guild.fetchAuditLogs({ type: "MESSAGE_DELETE" });
|
||||||
if (the.target.id === msg.id) audit = the;
|
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"))
|
emb.setColor(getColor("yellow"))
|
||||||
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted" + (audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted" + (audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue