mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Simplified image resolving and used an options object when creating webhooks (#1843)
This commit is contained in:
@@ -254,10 +254,9 @@ class Webhook {
|
||||
*/
|
||||
edit({ name = this.name, avatar }, reason) {
|
||||
if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) {
|
||||
return this.client.resolver.resolveFile(avatar).then(file => {
|
||||
const dataURI = this.client.resolver.resolveBase64(file);
|
||||
return this.edit({ name, avatar: dataURI }, reason);
|
||||
});
|
||||
return this.client.resolver.resolveImage(avatar).then(image =>
|
||||
this.edit({ name, avatar: image }, reason)
|
||||
);
|
||||
}
|
||||
return this.client.api.webhooks(this.id, this.token).patch({
|
||||
data: { name, avatar },
|
||||
|
||||
Reference in New Issue
Block a user