From 9a879a64e71baa0f52d428f49ecf5003ba0b90ad Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 12 Jul 2022 13:11:26 +0300 Subject: [PATCH] unlockdown fix --- src/structure/components/infractions/Unlockdown.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/structure/components/infractions/Unlockdown.js b/src/structure/components/infractions/Unlockdown.js index c0b7d55..71553d8 100644 --- a/src/structure/components/infractions/Unlockdown.js +++ b/src/structure/components/infractions/Unlockdown.js @@ -32,18 +32,22 @@ class UnlockdownInfraction extends Infraction { // }).first(); let latest = null; - if (!this.data) { + // console.log(this.data); + if (!this.data || !Object.keys(this.data).length) { latest = await this.client.moderationManager.findLatestInfraction('LOCKDOWN', this.target); if (latest._callbacked || latest.resolved) return this._fail({ message: this.guild.format('INFRACTION_UNLOCKDOWN_NOTLOCKED') }); } + // console.log(latest); const data = latest?.data || this.data; const oldPerms = data.oldPermissions; const permissions = this.target.permissionOverwrites; const overwrites = [...permissions.cache.values()]; const newOverwrites = []; + // console.log(data, oldPerms); for (const permission of overwrites) { + // console.log(permission); if (!oldPerms[permission.id]) { newOverwrites.push(permission); @@ -79,7 +83,7 @@ class UnlockdownInfraction extends Infraction { if (latest) { const callback = this.client.moderationManager.callbacks.get(latest.id); - await this.client.moderationManager.removeCallback(callback, true); + if(callback) await this.client.moderationManager.removeCallback(callback, true); } await this.handle();