Skip to content

Commit

Permalink
Fix PermissionOverwriteManager changing userOrRole
Browse files Browse the repository at this point in the history
Since it's mutated the original Member object won't be passed to upset and will be seen as invalid if User cache is disabled.

Functions normally even with User cache disabled after the fix.
  • Loading branch information
AppEternal authored and iCrawl committed Jul 17, 2022
1 parent e3cbd45 commit 22fe08c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/managers/PermissionOverwriteManager.js
Expand Up @@ -142,8 +142,9 @@ class PermissionOverwriteManager extends CachedManager {
* .catch(console.error);
*/
edit(userOrRole, options, overwriteOptions) {
userOrRole = this.channel.guild.roles.resolveId(userOrRole) ?? this.client.users.resolveId(userOrRole);
const existing = this.cache.get(userOrRole);
const existing = this.cache.get(
this.channel.guild.roles.resolveId(userOrRole) ?? this.client.users.resolveId(userOrRole),
);
return this.upsert(userOrRole, options, overwriteOptions, existing);
}

Expand Down

0 comments on commit 22fe08c

Please sign in to comment.