fix: remove support for overriding caches that break functionality (#6282)

Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
ckohen
2021-08-04 14:04:40 -07:00
committed by GitHub
parent 5be471b47d
commit a6d4035176
7 changed files with 52 additions and 5 deletions

View File

@@ -7,6 +7,8 @@ const Role = require('../structures/Role');
const Permissions = require('../util/Permissions');
const { resolveColor, setPosition } = require('../util/Util');
let cacheWarningEmitted = false;
/**
* Manages API methods for roles and stores their cache.
* @extends {CachedManager}
@@ -14,6 +16,13 @@ const { resolveColor, setPosition } = require('../util/Util');
class RoleManager extends CachedManager {
constructor(guild, iterable) {
super(guild.client, Role, iterable);
if (!cacheWarningEmitted && this._cache.constructor.name !== 'Collection') {
cacheWarningEmitted = true;
process.emitWarning(
`Overriding the cache handling for ${this.constructor.name} is unsupported and breaks functionality.`,
'UnuspportedCacheOverwriteWarning',
);
}
/**
* The guild belonging to this manager