summary refs log tree commit diff
path: root/api/src/routes/guilds
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-01-24 10:22:46 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-01-24 10:22:46 +1100
commitba79fe858ce487de6138893be6834309085bedbb (patch)
treed7d03791adebf2c44f2b941fe70d12aa7ba4e226 /api/src/routes/guilds
parentAdded `typescript-cached-transpile` package to help improve performance (diff)
parent* Replaced list of invisible characters with unicode codepoints (diff)
downloadserver-ts-ba79fe858ce487de6138893be6834309085bedbb.tar.xz
Merge branch 'master' into tsnode
Diffstat (limited to 'api/src/routes/guilds')
-rw-r--r--api/src/routes/guilds/#guild_id/roles.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts

index b1875598..b6894e3f 100644 --- a/api/src/routes/guilds/#guild_id/roles.ts +++ b/api/src/routes/guilds/#guild_id/roles.ts
@@ -8,7 +8,8 @@ import { GuildRoleDeleteEvent, emitEvent, Config, - DiscordApiErrors + DiscordApiErrors, + handleFile } from "@fosscord/util"; import { HTTPError } from "lambert-server"; import { route } from "@fosscord/api"; @@ -22,6 +23,8 @@ export interface RoleModifySchema { hoist?: boolean; // whether the role should be displayed separately in the sidebar mentionable?: boolean; // whether the role should be mentionable position?: number; + icon?: string; + unicode_emoji?: string; } export type RolePositionUpdateSchema = { @@ -58,7 +61,9 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" }) guild_id: guild_id, managed: false, permissions: String(req.permission!.bitfield & BigInt(body.permissions || "0")), - tags: undefined + tags: undefined, + icon: null, + unicode_emoji: null }); await Promise.all([ @@ -105,6 +110,8 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_ const { role_id, guild_id } = req.params; const body = req.body as RoleModifySchema; + if (body.icon) body.icon = await handleFile(`/role-icons/${role_id}`, body.icon as string); + const role = new Role({ ...body, id: role_id,