Fix bitfield type error

This commit is contained in:
Helloyunho 2021-02-23 13:07:27 +09:00
parent 548b6bf2ad
commit ff80750ca4
2 changed files with 10 additions and 2 deletions

View File

@ -211,6 +211,14 @@ client.on('messageCreate', async (msg: Message) => {
msg.member as Member
)
msg.channel.send(`Your permissions:\n${permissions.toArray().join('\n')}`)
} else if (msg.content === '!addAllRoles') {
const roles = await msg.guild?.roles.array()
if (roles !== undefined) {
roles.forEach(async (role) => {
await msg.member?.roles.add(role)
console.log(role)
})
}
}
})

View File

@ -104,11 +104,11 @@ export class BitField {
if (bit instanceof BitField) return this.resolve(flags, bit.bitfield)
if (Array.isArray(bit))
return (bit.map as any)((p: any) => this.resolve(flags, p)).reduce(
(prev: any, p: any) => prev | p,
(prev: bigint, p: bigint) => prev | p,
0
)
if (typeof bit === 'string' && typeof flags[bit] !== 'undefined')
return flags[bit]
return BigInt(flags[bit])
const error = new RangeError('BITFIELD_INVALID')
throw error
}