mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
Update Member.ts
This commit is contained in:
parent
cbf02c67ec
commit
94c1f9f74b
@ -173,4 +173,27 @@ export async function removeRole(user_id: string, guild_id: string, role_id: str
|
||||
|
||||
}
|
||||
|
||||
export async function changeNickname(user_id: string, guild_id: string, nickname: string) {
|
||||
const user = await getPublicUser(user_id);
|
||||
|
||||
var memberObj = await MemberModel.findOneAndUpdate({
|
||||
id: user_id,
|
||||
guild_id: guild_id,
|
||||
}, { nick: nickname } ).exec();
|
||||
|
||||
if(!memberObj) throw new HTTPError("Member not found", 404);
|
||||
|
||||
await emitEvent({
|
||||
event: "GUILD_MEMBER_UPDATE",
|
||||
data: {
|
||||
guild_id: guild_id,
|
||||
user: user,
|
||||
nick: nickname
|
||||
|
||||
},
|
||||
guild_id: guild_id,
|
||||
} as GuildMemberUpdateEvent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user