mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
fix: Webhook#edit attempting to use client.channels always
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
const DataResolver = require('../util/DataResolver');
|
const DataResolver = require('../util/DataResolver');
|
||||||
|
const { Channel } = require('./Channel');
|
||||||
const { createMessage } = require('./shared');
|
const { createMessage } = require('./shared');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,7 +201,7 @@ class Webhook {
|
|||||||
if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) {
|
if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) {
|
||||||
return DataResolver.resolveImage(avatar).then(image => this.edit({ name, avatar: image }, reason));
|
return DataResolver.resolveImage(avatar).then(image => this.edit({ name, avatar: image }, reason));
|
||||||
}
|
}
|
||||||
if (channel) channel = this.client.channels.resolveID(channel);
|
if (channel) channel = channel instanceof Channel ? channel.id : channel;
|
||||||
return this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({
|
return this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({
|
||||||
data: { name, avatar, channel_id: channel },
|
data: { name, avatar, channel_id: channel },
|
||||||
reason,
|
reason,
|
||||||
|
|||||||
Reference in New Issue
Block a user