mirror of
https://github.com/danbulant/Shasha
synced 2026-06-20 06:41:19 +00:00
getAudit moved to functions.js
This commit is contained in:
parent
639e15e95a
commit
901b7013aa
2 changed files with 17 additions and 17 deletions
|
|
@ -3,7 +3,7 @@
|
|||
const { GuildChannel, Guild, GuildAuditLogsEntry, Role } = require("discord.js");
|
||||
const { Interval } = require("luxon");
|
||||
const { intervalToDuration } = require("../../cmds/moderation/src/duration");
|
||||
const { defaultEventLogEmbed, changed, trySend, wait } = require("../functions");
|
||||
const { defaultEventLogEmbed, changed, trySend, wait, getAudit } = require("../functions");
|
||||
const getColor = require("../getColor");
|
||||
let blockChannelUpdate = false;
|
||||
|
||||
|
|
@ -301,20 +301,6 @@ async function run(oldChannel, newChannel) {
|
|||
return trySend(newChannel.client, logChannel, emb);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Guild} guild Get audit from
|
||||
* @param {Date} dateNow
|
||||
* @param {string} id Target ID
|
||||
* @param {import("discord.js").GuildAuditLogsFetchOptions} option
|
||||
* @returns {Promise<GuildAuditLogsEntry>}
|
||||
*/
|
||||
async function getAudit(guild, dateNow, id, option, filter = (value, key, collection) =>
|
||||
value.target.id === id && (dateNow.valueOf() - value.createdTimestamp) < 60000) {
|
||||
const col = await guild.fetchAuditLogs(option);
|
||||
const fil = col.entries.filter(filter);
|
||||
return fil.first();
|
||||
};
|
||||
|
||||
function blockChannelUpdateEvents() {
|
||||
blockChannelUpdate = true;
|
||||
console.log("CHANNEL UPDATE EVENTS BLOCKED. STATE:", blockChannelUpdate);
|
||||
|
|
@ -325,4 +311,4 @@ function unblockChannelUpdateEvents() {
|
|||
console.log("CHANNEL UPDATE EVENTS UNBLOCKED. STATE:", blockChannelUpdate);
|
||||
};
|
||||
|
||||
module.exports = { run, blockChannelUpdateEvents, unblockChannelUpdateEvents, getAudit }
|
||||
module.exports = { run, blockChannelUpdateEvents, unblockChannelUpdateEvents }
|
||||
|
|
@ -565,11 +565,25 @@ function changed(oldObj, newObj) {
|
|||
return { oldObj: diffOld, newObj: diffNew };
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Guild} guild Get audit from
|
||||
* @param {Date} dateNow
|
||||
* @param {string} id Target ID
|
||||
* @param {import("discord.js").GuildAuditLogsFetchOptions} option
|
||||
* @returns {Promise<GuildAuditLogsEntry>}
|
||||
*/
|
||||
async function getAudit(guild, dateNow, id, option, filter = (value, key, collection) =>
|
||||
value.target.id === id && (dateNow.valueOf() - value.createdTimestamp) < 60000) {
|
||||
const col = await guild.fetchAuditLogs(option);
|
||||
const fil = col.entries.filter(filter);
|
||||
return fil.first();
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
cleanMentionID, defaultEventLogEmbed,
|
||||
multipleMembersFound, multipleRolesFound, multipleChannelsFound,
|
||||
findMemberRegEx, findChannelRegEx, findRoleRegEx,
|
||||
getChannelMessage, errLog, changed,
|
||||
getChannelMessage, errLog, changed, getAudit,
|
||||
execCB, ranLog, noPerm, getUTCComparison,
|
||||
trySend, tryDelete, tryReact, defaultDateFormat,
|
||||
adCheck, defaultImageEmbed, getChannel,
|
||||
|
|
|
|||
Loading…
Reference in a new issue