fix(PermissionOverwriteManager): pass ID to API correctly (#6026)

This commit is contained in:
monbrey
2021-07-04 09:26:44 +10:00
committed by GitHub
parent 8c7cb0eff8
commit 8077e4f4f1

View File

@@ -136,10 +136,10 @@ class PermissionOverwriteManager extends CachedManager {
* @returns {GuildChannel}
*/
async delete(userOrRole, reason) {
userOrRole = this.channel.guild.roles.resolveID(userOrRole) ?? this.client.users.resolveID(userOrRole);
if (!userOrRole) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
const userOrRoleID = this.channel.guild.roles.resolveID(userOrRole) ?? this.client.users.resolveID(userOrRole);
if (!userOrRoleID) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
await this.client.api.channels(this.channel.id).permissions(userOrRole.id).delete({ reason });
await this.client.api.channels(this.channel.id).permissions(userOrRoleID).delete({ reason });
return this.channel;
}
}