diff options
author | Intevel ツ <59223342+Intevel@users.noreply.github.com> | 2021-05-08 13:49:19 +0200 |
---|---|---|
committer | Intevel ツ <59223342+Intevel@users.noreply.github.com> | 2021-05-08 13:49:19 +0200 |
commit | cbf02c67ecdf9cca61bfc100f703a85e2ca409c0 (patch) | |
tree | c6f569227ee9d77c878dbbc18db5c98a78b826b8 /src | |
parent | Update members.ts (diff) | |
download | server-cbf02c67ecdf9cca61bfc100f703a85e2ca409c0.tar.xz |
Update members.ts
Diffstat (limited to 'src')
-rw-r--r-- | src/routes/guilds/#guild_id/members.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/routes/guilds/#guild_id/members.ts b/src/routes/guilds/#guild_id/members.ts index 5aaf3ec0..c8dddfe5 100644 --- a/src/routes/guilds/#guild_id/members.ts +++ b/src/routes/guilds/#guild_id/members.ts @@ -2,7 +2,7 @@ import { Request, Response, Router } from "express"; import { GuildModel, MemberModel, UserModel, toObject, GuildMemberAddEvent, getPermission } from "@fosscord/server-util"; import { HTTPError } from "lambert-server"; import { instanceOf, Length } from "../../../util/instanceOf"; -import { PublicMemberProjection, addMember, removeMember, addRole, removeRole } from "../../../util/Member"; +import { PublicMemberProjection, addMember, removeMember, addRole, removeRole, changeNickname } from "../../../util/Member"; import { emitEvent } from "../../../util/Event"; import { getPublicUser } from "../../../util/User"; @@ -81,13 +81,14 @@ router.put("/:member_id/roles/:role_id", async (req: Request, res: Response) => res.sendStatus(204); }); -router.patch("/:member_id/@me/nick", async (req: Request, res: Response) => { +router.patch("/:member_id/nick", async (req: Request, res: Response) => { const { guild_id, member_id } = req.params; + if(!req.body.nickname) throw new HTTPError("No nickname defined", 404); const perms = await getPermission(member_id, guild_id); perms.hasThrow("CHANGE_NICKNAME"); - //await addRole(member_id, guild_id, role_id); + await changeNickname(member_id, guild_id, req.body.nickname); res.status(204); }); |