🐛 convert bigint literal to object

This commit is contained in:
Flam3rboy 2021-10-10 11:08:55 +02:00
parent dc85a79498
commit a61cbbe40c
5 changed files with 12 additions and 7 deletions

View File

@ -44,8 +44,8 @@ router.put(
}; };
channel.permission_overwrites!.push(overwrite); channel.permission_overwrites!.push(overwrite);
} }
overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || 0n)); overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || BigInt("0")));
overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || 0n)); overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || BigInt("0")));
await Promise.all([ await Promise.all([
channel.save(), channel.save(),

View File

@ -57,7 +57,7 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" })
...body, ...body,
guild_id: guild_id, guild_id: guild_id,
managed: false, managed: false,
permissions: String(req.permission!.bitfield & (body.permissions || 0n)), permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))),
tags: undefined tags: undefined
}); });
@ -105,7 +105,12 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_
const { role_id, guild_id } = req.params; const { role_id, guild_id } = req.params;
const body = req.body as RoleModifySchema; const body = req.body as RoleModifySchema;
const role = new Role({ ...body, id: role_id, guild_id, permissions: String(req.permission!.bitfield & (body.permissions || 0n)) }); const role = new Role({
...body,
id: role_id,
guild_id,
permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0")))
});
await Promise.all([ await Promise.all([
role.save(), role.save(),

View File

@ -47,7 +47,7 @@ router.post("/:code", route({ body: "GuildTemplateCreateSchema" }), async (req:
managed: true, managed: true,
mentionable: true, mentionable: true,
name: "@everyone", name: "@everyone",
permissions: 2251804225n, permissions: BigInt("2251804225"),
position: 0, position: 0,
tags: null tags: null
}).save() }).save()

View File

@ -41,7 +41,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
return this.close(CLOSECODES.Authentication_failed); return this.close(CLOSECODES.Authentication_failed);
} }
this.user_id = decoded.id; this.user_id = decoded.id;
if (!identify.intents) identify.intents = 0b11111111111111n; if (!identify.intents) identify.intents = BigInt("0b11111111111111");
this.intents = new Intents(identify.intents); this.intents = new Intents(identify.intents);
if (identify.shard) { if (identify.shard) {
this.shard_id = identify.shard[0]; this.shard_id = identify.shard[0];