mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(BitField): throw when resolving invalid string constant
Checked to see if the permission actually exists.
This commit is contained in:
@@ -146,7 +146,7 @@ class BitField {
|
||||
if (typeof bit === 'number' && bit >= 0) return bit;
|
||||
if (bit instanceof BitField) return bit.bitfield;
|
||||
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
|
||||
if (typeof bit === 'string') return this.FLAGS[bit];
|
||||
if (typeof bit === 'string' && typeof this.FLAGS[bit] !== 'undefined') return this.FLAGS[bit];
|
||||
throw new RangeError('BITFIELD_INVALID');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user