Backporting, doc/bug fixes as well deprecation (#1826)

* Backporting, doc/bug fixes as well deprecation

* Adress issue with not resettable icons/images
This commit is contained in:
SpaceEEC
2017-08-25 15:14:05 +02:00
committed by Crawl
parent bce5b677ad
commit 1fe201ae90
19 changed files with 125 additions and 89 deletions

View File

@@ -60,7 +60,7 @@ class TextChannel extends GuildChannel {
/**
* Create a webhook for the channel.
* @param {string} name The name of the webhook
* @param {BufferResolvable|Base64Resolvable} avatar The avatar for the webhook
* @param {BufferResolvable|Base64Resolvable} [avatar] The avatar for the webhook
* @param {string} [reason] Reason for creating this webhook
* @returns {Promise<Webhook>} webhook The created webhook
* @example
@@ -69,15 +69,13 @@ class TextChannel extends GuildChannel {
* .catch(console.error)
*/
createWebhook(name, avatar, reason) {
return new Promise(resolve => {
if (typeof avatar === 'string' && avatar.startsWith('data:')) {
resolve(this.client.rest.methods.createWebhook(this, name, avatar, reason));
} else {
this.client.resolver.resolveFile(avatar).then(data =>
resolve(this.client.rest.methods.createWebhook(this, name, data, reason))
);
}
});
if (typeof avatar === 'string' && avatar.startsWith('data:')) {
return this.client.rest.methods.createWebhook(this, name, avatar, reason);
} else {
return this.client.resolver.resolveImage(avatar).then(data =>
this.client.rest.methods.createWebhook(this, name, data, reason)
);
}
}
// These are here only for documentation purposes - they are implemented by TextBasedChannel