diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/moderation/purge.ts | 18 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushClientEvents.d.ts | 2 | ||||
-rw-r--r-- | src/listeners/custom/bushBan.ts | 10 | ||||
-rw-r--r-- | src/listeners/custom/bushKick.ts | 8 | ||||
-rw-r--r-- | src/listeners/custom/bushMute.ts | 10 | ||||
-rw-r--r-- | src/listeners/custom/bushPunishRole.ts | 10 | ||||
-rw-r--r-- | src/listeners/custom/bushPunishRoleRemove.ts | 10 | ||||
-rw-r--r-- | src/listeners/custom/bushPurge.ts | 13 | ||||
-rw-r--r-- | src/listeners/custom/bushUnban.ts | 8 | ||||
-rw-r--r-- | src/listeners/custom/bushUnmute.ts | 8 | ||||
-rw-r--r-- | src/listeners/custom/bushWarn.ts | 8 |
11 files changed, 53 insertions, 52 deletions
diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index 4ed1ee7..ace72f2 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -1,4 +1,5 @@ -import { Message } from 'discord.js'; +import Collection from '@discordjs/collection'; +import { Snowflake } from 'discord.js'; import { BushCommand, BushMessage } from '../../lib'; export default class PurgeCommand extends BushCommand { @@ -52,22 +53,25 @@ export default class PurgeCommand extends BushCommand { if (args.bot) { shouldFilter.push(filterMessage.author.bot); } - return shouldFilter.filter((bool) => bool === false).length === 0; + return shouldFilter.filter((bool) => bool === false).length === 0 && filterMessage.id !== message.id; }; - const messages = (await message.channel.messages.fetch({ limit: args.amount })).filter((message) => messageFilter(message)); + const _messages = (await message.channel.messages.fetch({ limit: 100, before: message.id })) + .filter((message) => messageFilter(message)) + .first(args.amount); + const messages = new Collection<Snowflake, BushMessage>(); + _messages.forEach((m) => messages.set(m.id, m)); const purged = await message.channel.bulkDelete(messages, true).catch(() => null); if (!purged) return message.util.reply(`${util.emojis.error} Failed to purge messages.`).catch(() => null); else { client.emit('bushPurge', message.author, message.guild!, message.channel, messages); - await message.util - .send(`${util.emojis.success} Successfully purged **${purged.size}** messages.`) - .then(async (purgeMessage) => { + await message.util.send(`${util.emojis.success} Successfully purged **${purged.size}** messages.`); + /* .then(async (purgeMessage) => { if (!message.util.isSlash) { await util.sleep(5); await (purgeMessage as Message).delete().catch(() => {}); } - }); + }); */ } } } diff --git a/src/lib/extensions/discord.js/BushClientEvents.d.ts b/src/lib/extensions/discord.js/BushClientEvents.d.ts index 8695e7a..b797698 100644 --- a/src/lib/extensions/discord.js/BushClientEvents.d.ts +++ b/src/lib/extensions/discord.js/BushClientEvents.d.ts @@ -118,7 +118,7 @@ export interface BushClientEvents extends ClientEvents { ]; threadMembersUpdate: [ oldMembers: Collection<Snowflake, BushThreadMember>, - mewMembers: Collection<Snowflake, BushThreadMember> + newMembers: Collection<Snowflake, BushThreadMember> ]; threadUpdate: [oldThread: BushThreadChannel, newThread: BushThreadChannel]; typingStart: [typing: Typing]; diff --git a/src/listeners/custom/bushBan.ts b/src/listeners/custom/bushBan.ts index a7f30a2..df784f2 100644 --- a/src/listeners/custom/bushBan.ts +++ b/src/listeners/custom/bushBan.ts @@ -23,11 +23,11 @@ export default class BushBanListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); - if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration), true); + .addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); + if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration)); if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushKick.ts b/src/listeners/custom/bushKick.ts index 3e586f1..f622eba 100644 --- a/src/listeners/custom/bushKick.ts +++ b/src/listeners/custom/bushKick.ts @@ -23,10 +23,10 @@ export default class BushKickListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${'Kick'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); + .addField('**Action**', `${'Kick'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushMute.ts b/src/listeners/custom/bushMute.ts index 9513c20..615d698 100644 --- a/src/listeners/custom/bushMute.ts +++ b/src/listeners/custom/bushMute.ts @@ -23,11 +23,11 @@ export default class BushMuteListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); - if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration), true); + .addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); + if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration)); if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushPunishRole.ts b/src/listeners/custom/bushPunishRole.ts index 3e7e98f..ee6c61a 100644 --- a/src/listeners/custom/bushPunishRole.ts +++ b/src/listeners/custom/bushPunishRole.ts @@ -23,11 +23,11 @@ export default class BushPunishRoleListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); - if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration), true); + .addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); + if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration)); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/custom/bushPunishRoleRemove.ts b/src/listeners/custom/bushPunishRoleRemove.ts index 04d7244..a9d2002 100644 --- a/src/listeners/custom/bushPunishRoleRemove.ts +++ b/src/listeners/custom/bushPunishRoleRemove.ts @@ -23,11 +23,11 @@ export default class BushPunishRoleRemoveListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${'Remove Punishment Role'}`, true) - .addField('**Role**', `${role}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); + .addField('**Action**', `${'Remove Punishment Role'}`) + .addField('**Role**', `${role}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushPurge.ts b/src/listeners/custom/bushPurge.ts index cc55fc4..240af96 100644 --- a/src/listeners/custom/bushPurge.ts +++ b/src/listeners/custom/bushPurge.ts @@ -20,7 +20,7 @@ export default class BushPurgeListener extends BushListener { author: `${m.author.tag} (${m.id})`, content: m.content, embeds: m.embeds, - attachments: m.attachments + attachments: [...m.attachments.values()] })); const haste = await util.inspectCleanRedactHaste(mappedMessages); @@ -28,15 +28,12 @@ export default class BushPurgeListener extends BushListener { .setColor(util.colors.discord.DARK_PURPLE) .setTimestamp() .setFooter(`${messages.size.toLocaleString()} Messages`) - .addField('**Action**', `${'Purge'}`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Channel**', `<#${channel.id}> (${channel.name})`, true) + .addField('**Action**', `${'Purge'}`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Channel**', `<#${channel.id}> (${channel.name})`) .addField( '**Messages**', - `${ - haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}` - }`, - true + `${haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}`}` ); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushUnban.ts b/src/listeners/custom/bushUnban.ts index ad82979..1b192f6 100644 --- a/src/listeners/custom/bushUnban.ts +++ b/src/listeners/custom/bushUnban.ts @@ -23,10 +23,10 @@ export default class BushUnbanListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${'Unban'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); + .addField('**Action**', `${'Unban'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushUnmute.ts b/src/listeners/custom/bushUnmute.ts index 8beb27b..9f5d929 100644 --- a/src/listeners/custom/bushUnmute.ts +++ b/src/listeners/custom/bushUnmute.ts @@ -23,10 +23,10 @@ export default class BushUnmuteListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${'Unmute'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); + .addField('**Action**', `${'Unmute'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/custom/bushWarn.ts b/src/listeners/custom/bushWarn.ts index 40c477c..d093144 100644 --- a/src/listeners/custom/bushWarn.ts +++ b/src/listeners/custom/bushWarn.ts @@ -23,10 +23,10 @@ export default class BushWarnListener extends BushListener { .setTimestamp() .setFooter(`CaseID: ${caseID}`) .setAuthor(user.tag, user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) - .addField('**Action**', `${'Warn'}`, true) - .addField('**User**', `${user} (${user.tag})`, true) - .addField('**Moderator**', `${moderator} (${moderator.tag})`, true) - .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`, true); + .addField('**Action**', `${'Warn'}`) + .addField('**User**', `${user} (${user.tag})`) + .addField('**Moderator**', `${moderator} (${moderator.tag})`) + .addField('**Reason**', `${reason ?? '[No Reason Provided]'}`); if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); return await logChannel.send({ embeds: [logEmbed] }); } |