fix(GuildChannelManager): properly resolve avatar for createWebhook (#10772)

fix(GuildChannelManager): properly resolve avatr for createWebhook
This commit is contained in:
Naiyar
2025-02-21 16:44:38 +05:30
committed by GitHub
parent 0e7bdb0728
commit c4fbe89f48

View File

@@ -237,13 +237,13 @@ class GuildChannelManager extends CachedManager {
async createWebhook({ channel, name, avatar, reason }) {
const id = this.resolveId(channel);
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
if (typeof avatar === 'string' && !avatar.startsWith('data:')) {
avatar = await resolveImage(avatar);
}
const resolvedImage = await resolveImage(avatar);
const data = await this.client.rest.post(Routes.channelWebhooks(id), {
body: {
name,
avatar,
avatar: resolvedImage,
},
reason,
});