From d26c808d9acc33ba7fd39c33582df0c10867654a Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sun, 3 Jul 2022 01:23:54 +1000 Subject: Allow nicknames through MemberChangeSchema --- api/src/routes/guilds/#guild_id/members/#member_id/index.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'api/src') diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts index c285abb3..2ff89eae 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts @@ -7,6 +7,7 @@ const router = Router(); export interface MemberChangeSchema { roles?: string[]; + nick?: string; } router.get("/", route({}), async (req: Request, res: Response) => { @@ -34,6 +35,8 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist } + if (body.nick) member.nick = body.nick; + await member.save(); member.roles = member.roles.filter((x) => x.id !== everyone.id); -- cgit 1.4.1