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();