aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:56:23 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:56:23 -0400
commitc8a5bfe694ee6e784a0c5cbe1a7076b1c055249a (patch)
tree30a7020bb1dd339348117dffe23c84c17bf50b8a /src/commands
parentc4c1d9ffeb179e208792c88dd099caea5030581b (diff)
downloadtanzanite-c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a.tar.gz
tanzanite-c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a.tar.bz2
tanzanite-c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a.zip
remove inline from log fields and fix purge
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/moderation/purge.ts18
1 files changed, 11 insertions, 7 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(() => {});
}
- });
+ }); */
}
}
}