mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix(GuildChannelManager): properly resolve avatar for createWebhook (#10772)
fix(GuildChannelManager): properly resolve avatr for createWebhook
This commit is contained in:
@@ -230,13 +230,13 @@ class GuildChannelManager extends CachedManager {
|
|||||||
async createWebhook({ channel, name, avatar, reason }) {
|
async createWebhook({ channel, name, avatar, reason }) {
|
||||||
const id = this.resolveId(channel);
|
const id = this.resolveId(channel);
|
||||||
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
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), {
|
const data = await this.client.rest.post(Routes.channelWebhooks(id), {
|
||||||
body: {
|
body: {
|
||||||
name,
|
name,
|
||||||
avatar,
|
avatar: resolvedImage,
|
||||||
},
|
},
|
||||||
reason,
|
reason,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user