mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
feat(handlers): add editBotNickname() (#415)
* feat(handlers): add editBotNickname * return a var * Update member.ts * Update src/api/handlers/member.ts Co-authored-by: Ayyan <ayyantee@gmail.com> * Update member.ts * Update member.ts Co-authored-by: Ayyan <ayyantee@gmail.com>
This commit is contained in:
@@ -276,3 +276,19 @@ export async function editBotProfile(username?: string, botAvatarURL?: string) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** Edit the nickname of the bot in this guild */
|
||||
export async function editBotNickname(
|
||||
guildID: string,
|
||||
nickname: string | null,
|
||||
) {
|
||||
const hasPerm = await botHasPermission(guildID, ["CHANGE_NICKNAME"]);
|
||||
if (!hasPerm) throw new Error(Errors.MISSING_CHANGE_NICKNAME);
|
||||
|
||||
const response = await RequestManager.patch(
|
||||
endpoints.USER_NICK(guildID),
|
||||
{ nick: nickname },
|
||||
) as { nick: string };
|
||||
|
||||
return response.nick;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user