From 3b67b4b2278ec830dc51e3ff71b316a168802d04 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 16 Sep 2022 18:05:25 +0300 Subject: [PATCH] prune debugging --- src/structure/infractions/Prune.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/structure/infractions/Prune.js b/src/structure/infractions/Prune.js index 26c396b..0cb2608 100644 --- a/src/structure/infractions/Prune.js +++ b/src/structure/infractions/Prune.js @@ -40,17 +40,21 @@ class PruneInfraction extends Infraction { // +1 to so we can avoid deleting the command interaction let messages = await this.fetchMessages(message, amount < 100 ? amount + 1 : amount); //Collection, not array. if (messages.size === 0) return this._fail('C_PRUNE_NOTFETCHED'); + this.client.logger.debug(`Pruning ${messages.size} in ${this.guild.name}`); const hasOld = messages.some((m) => m.createdTimestamp >= Date.now() + 1209600000); //I hope Node.js can handle these large of numbers.. e_e (2 weeks) const hasUndeletable = messages.some((m) => m.deletable); + this.client.logger.debug(`Has old: ${hasOld}, has undeletable: ${hasUndeletable}`); messages = messages.filter((m) => m.deletable && m.type !== MessageType.ChatInputCommand); if (messages.size === 0) return this._fail('C_PRUNE_NOTDELETABLE'); const filtered = await this.filterMessages(messages); + this.client.logger.debug(`After filter: ${filtered.size}, pre filter: ${messages.size}`); if (filtered.size === 0) return this._fail('C_PRUNE_NOFILTERRESULTS'); const deleted = await this.deleteMessages(filtered); + this.client.logger.debug(`Deleted ${deleted} messages`); if (deleted === 0) return this._fail('C_PRUNE_NODELETE'); await this.handle(); @@ -68,7 +72,7 @@ class PruneInfraction extends Infraction { const bulkDelete = async (messages) => { try { const deleteThese = messages.splice(0, 100); - const result = await this.target.bulkDelete(deleteThese, true); //Filtering old just incase, d.js uses Snowflake times instead of our Client's timestamp. + const result = await this.channel.bulkDelete(deleteThese, true); //Filtering old just incase, d.js uses Snowflake times instead of our Client's timestamp. if (result && result.size > 0) amount += result.size; } catch (error) { this.client.logger.error(error.stack);