mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(GuildChannelManager): properly resolve avatar for createWebhook (#10772)
fix(GuildChannelManager): properly resolve avatr for createWebhook
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user