fix(PermissionOverwriteManager): mutates user

#8282 v13.9.0
This commit is contained in:
March 7th 2022-07-18 00:58:28 +07:00
parent d454853679
commit 110c8590a7

View File

@ -142,8 +142,9 @@ class PermissionOverwriteManager extends CachedManager {
* .catch(console.error); * .catch(console.error);
*/ */
edit(userOrRole, options, overwriteOptions) { edit(userOrRole, options, overwriteOptions) {
userOrRole = this.channel.guild.roles.resolveId(userOrRole) ?? this.client.users.resolveId(userOrRole); const existing = this.cache.get(
const existing = this.cache.get(userOrRole); this.channel.guild.roles.resolveId(userOrRole) ?? this.client.users.resolveId(userOrRole),
);
return this.upsert(userOrRole, options, overwriteOptions, existing); return this.upsert(userOrRole, options, overwriteOptions, existing);
} }