From 4447e367f6ff453d499288b63da2ef913f3bc4d6 Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Fri, 30 Dec 2016 16:22:29 -0500 Subject: [PATCH] Fix other BufferResolvables with base64 --- src/structures/ClientUser.js | 2 +- src/structures/Guild.js | 4 ++-- src/structures/TextChannel.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index 6a8532141..67e19f9c2 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -268,7 +268,7 @@ class ClientUser extends User { */ createGuild(name, region, icon = null) { if (!icon) return this.client.rest.methods.createGuild({ name, icon, region }); - if (icon.startsWith('data:')) { + if (typeof icon === 'string' && icon.startsWith('data:')) { return this.client.rest.methods.createGuild({ name, icon, region }); } else { return this.client.resolver.resolveBuffer(icon).then(data => diff --git a/src/structures/Guild.js b/src/structures/Guild.js index b3b3ad1bf..aa0f717ab 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -660,7 +660,7 @@ class Guild { /** * Creates a new custom emoji in the guild. - * @param {BufferResolvable} attachment The image for the emoji. + * @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji. * @param {string} name The name for the emoji. * @returns {Promise} The created emoji. * @example @@ -676,7 +676,7 @@ class Guild { */ createEmoji(attachment, name) { return new Promise(resolve => { - if (attachment.startsWith('data:')) { + if (typeof attachment === 'string' && attachment.startsWith('data:')) { resolve(this.client.rest.methods.createEmoji(this, attachment, name)); } else { this.client.resolver.resolveBuffer(attachment).then(data => diff --git a/src/structures/TextChannel.js b/src/structures/TextChannel.js index 0484c9716..6e98e9e89 100644 --- a/src/structures/TextChannel.js +++ b/src/structures/TextChannel.js @@ -53,7 +53,7 @@ class TextChannel extends GuildChannel { /** * Create a webhook for the channel. * @param {string} name The name of the webhook. - * @param {BufferResolvable} avatar The avatar for the webhook. + * @param {BufferResolvable|Base64Resolvable} avatar The avatar for the webhook. * @returns {Promise} webhook The created webhook. * @example * channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png') @@ -62,7 +62,7 @@ class TextChannel extends GuildChannel { */ createWebhook(name, avatar) { return new Promise(resolve => { - if (avatar.startsWith('data:')) { + if (typeof avatar === 'string' && avatar.startsWith('data:')) { resolve(this.client.rest.methods.createWebhook(this, name, avatar)); } else { this.client.resolver.resolveBuffer(avatar).then(data =>