From 57c9813f2fca9b8f4e02f09d71515bc7f59b4010 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 10 Oct 2021 11:08:55 +0200 Subject: :bug: convert bigint literal to object --- api/src/routes/channels/#channel_id/permissions.ts | 4 ++-- api/src/routes/guilds/#guild_id/roles.ts | 9 +++++++-- api/src/routes/guilds/templates/index.ts | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'api/src') diff --git a/api/src/routes/channels/#channel_id/permissions.ts b/api/src/routes/channels/#channel_id/permissions.ts index 6ebf721a..2eded853 100644 --- a/api/src/routes/channels/#channel_id/permissions.ts +++ b/api/src/routes/channels/#channel_id/permissions.ts @@ -44,8 +44,8 @@ router.put( }; channel.permission_overwrites!.push(overwrite); } - overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || 0n)); - overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || 0n)); + overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || BigInt("0"))); + overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || BigInt("0"))); await Promise.all([ channel.save(), diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts index d1d60906..0a57c6a2 100644 --- a/api/src/routes/guilds/#guild_id/roles.ts +++ b/api/src/routes/guilds/#guild_id/roles.ts @@ -57,7 +57,7 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" }) ...body, guild_id: guild_id, managed: false, - permissions: String(req.permission!.bitfield & (body.permissions || 0n)), + permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))), tags: undefined }); @@ -105,7 +105,12 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_ const { role_id, guild_id } = req.params; 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([ role.save(), diff --git a/api/src/routes/guilds/templates/index.ts b/api/src/routes/guilds/templates/index.ts index b5e243e9..86316d23 100644 --- a/api/src/routes/guilds/templates/index.ts +++ b/api/src/routes/guilds/templates/index.ts @@ -47,7 +47,7 @@ router.post("/:code", route({ body: "GuildTemplateCreateSchema" }), async (req: managed: true, mentionable: true, name: "@everyone", - permissions: 2251804225n, + permissions: BigInt("2251804225"), position: 0, tags: null }).save() -- cgit 1.4.1