update clientUser#setAvatar (#819)

* WHO DID THIS

* e

* some people have base64 fetishes i guess

Signed-off-by: Gus Caplan <fluffyrobotcheese@gmail.com>
This commit is contained in:
Gus Caplan
2016-10-24 00:09:38 -05:00
committed by Schuyler Cebulskie
parent 478377ac52
commit 44bae385c2
3 changed files with 14 additions and 7 deletions

View File

@@ -176,12 +176,11 @@ class Webhook {
* @param {FileResolvable} avatar The new avatar for the Webhook.
* @returns {Promise<Webhook>}
*/
edit(name, avatar) {
edit(name = this.name, avatar) {
return new Promise((resolve, reject) => {
if (avatar) {
this.client.resolver.resolveFile(avatar).then(file => {
let base64 = new Buffer(file, 'binary').toString('base64');
let dataURI = `data:;base64,${base64}`;
const dataURI = this.client.resolver.resolveBase64(file);
this.client.rest.methods.editWebhook(this, name, dataURI)
.then(resolve).catch(reject);
}).catch(reject);