Fix the real problem part

This commit is contained in:
Helloyunho 2021-02-23 13:47:14 +09:00
parent ff80750ca4
commit 8e5a76dbe8
2 changed files with 13 additions and 2 deletions

View File

@ -219,6 +219,14 @@ client.on('messageCreate', async (msg: Message) => {
console.log(role)
})
}
} else if (msg.content === '!createAndAddRole') {
if (msg.guild !== undefined) {
const role = await msg.guild.roles.create({
name: 'asdf',
permissions: 0
})
await msg.member?.roles.add(role)
}
}
})

View File

@ -14,7 +14,10 @@ export class BitField {
#flags: { [name: string]: number | bigint } = {}
bitfield: bigint
constructor(flags: { [name: string]: number | bigint }, bits: any) {
constructor(
flags: { [name: string]: number | bigint },
bits: BitFieldResolvable
) {
this.#flags = flags
this.bitfield = BitField.resolve(this.#flags, bits)
}
@ -105,7 +108,7 @@ export class BitField {
if (Array.isArray(bit))
return (bit.map as any)((p: any) => this.resolve(flags, p)).reduce(
(prev: bigint, p: bigint) => prev | p,
0
0n
)
if (typeof bit === 'string' && typeof flags[bit] !== 'undefined')
return BigInt(flags[bit])