mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
Fix other BufferResolvables with base64
This commit is contained in:
parent
2ea744c9d1
commit
4447e367f6
3 changed files with 5 additions and 5 deletions
|
|
@ -268,7 +268,7 @@ class ClientUser extends User {
|
||||||
*/
|
*/
|
||||||
createGuild(name, region, icon = null) {
|
createGuild(name, region, icon = null) {
|
||||||
if (!icon) return this.client.rest.methods.createGuild({ name, icon, region });
|
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 });
|
return this.client.rest.methods.createGuild({ name, icon, region });
|
||||||
} else {
|
} else {
|
||||||
return this.client.resolver.resolveBuffer(icon).then(data =>
|
return this.client.resolver.resolveBuffer(icon).then(data =>
|
||||||
|
|
|
||||||
|
|
@ -660,7 +660,7 @@ class Guild {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new custom emoji in the 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.
|
* @param {string} name The name for the emoji.
|
||||||
* @returns {Promise<Emoji>} The created emoji.
|
* @returns {Promise<Emoji>} The created emoji.
|
||||||
* @example
|
* @example
|
||||||
|
|
@ -676,7 +676,7 @@ class Guild {
|
||||||
*/
|
*/
|
||||||
createEmoji(attachment, name) {
|
createEmoji(attachment, name) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (attachment.startsWith('data:')) {
|
if (typeof attachment === 'string' && attachment.startsWith('data:')) {
|
||||||
resolve(this.client.rest.methods.createEmoji(this, attachment, name));
|
resolve(this.client.rest.methods.createEmoji(this, attachment, name));
|
||||||
} else {
|
} else {
|
||||||
this.client.resolver.resolveBuffer(attachment).then(data =>
|
this.client.resolver.resolveBuffer(attachment).then(data =>
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class TextChannel extends GuildChannel {
|
||||||
/**
|
/**
|
||||||
* Create a webhook for the channel.
|
* Create a webhook for the channel.
|
||||||
* @param {string} name The name of the webhook.
|
* @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>} webhook The created webhook.
|
* @returns {Promise<Webhook>} webhook The created webhook.
|
||||||
* @example
|
* @example
|
||||||
* channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png')
|
* channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png')
|
||||||
|
|
@ -62,7 +62,7 @@ class TextChannel extends GuildChannel {
|
||||||
*/
|
*/
|
||||||
createWebhook(name, avatar) {
|
createWebhook(name, avatar) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (avatar.startsWith('data:')) {
|
if (typeof avatar === 'string' && avatar.startsWith('data:')) {
|
||||||
resolve(this.client.rest.methods.createWebhook(this, name, avatar));
|
resolve(this.client.rest.methods.createWebhook(this, name, avatar));
|
||||||
} else {
|
} else {
|
||||||
this.client.resolver.resolveBuffer(avatar).then(data =>
|
this.client.resolver.resolveBuffer(avatar).then(data =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue