fix(GuildChannelManager): properly resolve avatar for createWebhook

backport #10772
This commit is contained in:
Elysia
2025-09-13 14:03:12 +07:00
parent 683b280067
commit f68b37a514

View File

@@ -216,13 +216,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 TypeError('INVALID_TYPE', 'channel', 'GuildChannelResolvable'); if (!id) throw new TypeError('INVALID_TYPE', 'channel', 'GuildChannelResolvable');
if (typeof avatar === 'string' && !avatar.startsWith('data:')) {
avatar = await DataResolver.resolveImage(avatar); const resolvedImage = await DataResolver.resolveImage(avatar);
}
const data = await this.client.api.channels[id].webhooks.post({ const data = await this.client.api.channels[id].webhooks.post({
data: { data: {
name, name,
avatar, avatar: resolvedImage,
}, },
reason, reason,
}); });