fix: Webhook#edit attempting to use client.channels always

This commit is contained in:
Lewdcario
2018-05-02 21:18:47 -05:00
committed by Isabella
parent bd83bb9fd6
commit f293dddc29

View File

@@ -1,4 +1,5 @@
const DataResolver = require('../util/DataResolver');
const { Channel } = require('./Channel');
const { createMessage } = require('./shared');
/**
@@ -200,7 +201,7 @@ class Webhook {
if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) {
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({
data: { name, avatar, channel_id: channel },
reason,