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:
ITOH
2021-01-20 12:31:48 +01:00
committed by GitHub
parent 11b68981f9
commit 16fab1b925
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -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;
}