diff --git a/lib/Client.js b/lib/Client.js index 467651f1e..c11c5a19c 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -543,11 +543,9 @@ var Client = (function () { message = premessage + resolveMessage(message); var mentions = resolveMentions(); - destination = self.resolveDestination(destination); + self.resolveDestination(destination).then(send)["catch"](reject); - if (destination) send(); - - function send() { + function send(destination) { request.post(Endpoints.CHANNELS + "/" + destination + "/messages").set("authorization", self.token).send({ content: message, diff --git a/src/Client.js b/src/Client.js index 5cfd2e44a..bcaad81a7 100644 --- a/src/Client.js +++ b/src/Client.js @@ -555,12 +555,9 @@ class Client { message = premessage + resolveMessage(message); var mentions = resolveMentions(); - destination = self.resolveDestination(destination); + self.resolveDestination(destination).then(send).catch(reject); - if (destination) - send(); - - function send() { + function send(destination) { request .post(`${Endpoints.CHANNELS}/${destination}/messages`)