From dc4937f4f6fa5fe566e7d1972191ca2309f6606f Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 17 Jun 2021 15:34:18 +0200 Subject: [PATCH] fix: botAvatarURL is nullable null shall be passed to reset the bots avatar --- src/helpers/misc/edit_bot_profile.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/misc/edit_bot_profile.ts b/src/helpers/misc/edit_bot_profile.ts index 36404ddfe..886de902f 100644 --- a/src/helpers/misc/edit_bot_profile.ts +++ b/src/helpers/misc/edit_bot_profile.ts @@ -7,9 +7,9 @@ import { urlToBase64 } from "../../util/utils.ts"; /** Modifies the bot's username or avatar. * NOTE: username: if changed may cause the bot's discriminator to be randomized. */ -export async function editBotProfile(options: { username?: string; botAvatarURL?: string }) { +export async function editBotProfile(options: { username?: string; botAvatarURL?: string | null }) { // Nothing was edited - if (!options.username && !options.botAvatarURL) return; + if (!options.username && options.botAvatarURL === undefined) return; // Check username requirements if username was provided if (options.username) { if (options.username.length > 32) { @@ -26,7 +26,7 @@ export async function editBotProfile(options: { username?: string; botAvatarURL? } } - const avatar = options?.botAvatarURL ? await urlToBase64(options?.botAvatarURL) : undefined; + const avatar = options?.botAvatarURL ? await urlToBase64(options?.botAvatarURL) : options?.botAvatarURL; return await rest.runMethod("patch", endpoints.USER_BOT, { username: options.username?.trim(),