mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
fix: resolving string bitfield (#9262)
fix: resolving bitfield Co-authored-by: space <spaceeec@yahoo.com>
This commit is contained in:
@@ -164,8 +164,8 @@ class BitField {
|
|||||||
if (bit instanceof BitField) return bit.bitfield;
|
if (bit instanceof BitField) return bit.bitfield;
|
||||||
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, DefaultBit);
|
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, DefaultBit);
|
||||||
if (typeof bit === 'string') {
|
if (typeof bit === 'string') {
|
||||||
if (this.Flags[bit] !== undefined) return this.Flags[bit];
|
|
||||||
if (!isNaN(bit)) return typeof DefaultBit === 'bigint' ? BigInt(bit) : Number(bit);
|
if (!isNaN(bit)) return typeof DefaultBit === 'bigint' ? BigInt(bit) : Number(bit);
|
||||||
|
if (this.Flags[bit] !== undefined) return this.Flags[bit];
|
||||||
}
|
}
|
||||||
throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit);
|
throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user