mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
feat: set bot's nickname
This commit is contained in:
parent
71aa75c660
commit
44a9f11fd6
@ -90,6 +90,20 @@ export class Guild extends BaseGuild implements Model {
|
|||||||
roles: Role[];
|
roles: Role[];
|
||||||
emojis: GuildEmoji[];
|
emojis: GuildEmoji[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'null' would reset the nickname
|
||||||
|
* */
|
||||||
|
async editBotNickname(options: { nick: string | null; reason?: string }) {
|
||||||
|
const result = await this.session.rest.runMethod<{ nick?: string } | undefined>(
|
||||||
|
this.session.rest,
|
||||||
|
"PATCH",
|
||||||
|
Routes.USER_NICK(this.id),
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return result?.nick;
|
||||||
|
}
|
||||||
|
|
||||||
async createEmoji(options: CreateGuildEmoji): Promise<GuildEmoji> {
|
async createEmoji(options: CreateGuildEmoji): Promise<GuildEmoji> {
|
||||||
if (options.image && !options.image.startsWith("data:image/")) {
|
if (options.image && !options.image.startsWith("data:image/")) {
|
||||||
options.image = await urlToBase64(options.image);
|
options.image = await urlToBase64(options.image);
|
||||||
|
@ -154,3 +154,7 @@ export function WEBHOOK(webhookId: Snowflake, token: string, options?: { wait?:
|
|||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function USER_NICK(guildId: Snowflake) {
|
||||||
|
return `/guilds/${guildId}/members/@me`;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user