lockdown bugfix?

This commit is contained in:
Erik 2022-05-11 14:53:15 +03:00
parent 754a616d01
commit 8bacc0bf25
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -29,10 +29,10 @@ class LockdownInfraction extends Infraction {
async execute() { async execute() {
const permissions = this.target.permissionOverwrites.cache; const permissions = this.target.permissionOverwrites;
this.data.oldPermissions = {}; this.data.oldPermissions = {};
for (const permission of permissions.values()) { for (const permission of permissions.cache.values()) {
const roleOrMember = permission.type === 'role' ? const roleOrMember = permission.type === 'role' ?
await this.guild.roles.fetch(permission.id) : await this.guild.roles.fetch(permission.id) :
await this.guild.members.fetch(permission.id); await this.guild.members.fetch(permission.id);
@ -52,19 +52,19 @@ class LockdownInfraction extends Infraction {
if (permission.deny.has('ADD_REACTIONS')) this.data.oldPermissions[permission.id].permissions.ADD_REACTIONS = false; if (permission.deny.has('ADD_REACTIONS')) this.data.oldPermissions[permission.id].permissions.ADD_REACTIONS = false;
try { try {
await this.target.updateOverwrite(permission.id, { await permissions.edit(permission.id, {
SEND_MESSAGES: false, SEND_MESSAGES: false,
ADD_REACTIONS: false ADD_REACTIONS: false
}, this._reason); }, { type: permission.type === 'role' ? 0 : 1, reason: this._reason });
} catch (error) { } catch (error) {
this._fail(); this._fail();
} }
} }
await this.target.updateOverwrite(this.client.user.id, { await permissions.edit(this.client.user.id, {
SEND_MESSAGES: true, SEND_MESSAGES: true,
ADD_REACTIONS: true ADD_REACTIONS: true
}); }, { type: 1 });
await this.handle(); await this.handle();
return this._succeed(); return this._succeed();