mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Updated tests and added file sending
This commit is contained in:
@@ -551,7 +551,20 @@ var Client = (function () {
|
||||
self.resolveDestination(destination).then(send)["catch"](error);
|
||||
|
||||
function send(destination) {
|
||||
request.post(Endpoints.CHANNELS + "/" + destination + "/messages");
|
||||
request.post(Endpoints.CHANNELS + "/" + destination + "/messages").set("authorization", self.token).attach("file", fstream, fileName).end(function (err, res) {
|
||||
|
||||
if (err) {
|
||||
error(err);
|
||||
} else {
|
||||
|
||||
var chann = self.getChannel("id", destination);
|
||||
if (chann) {
|
||||
var msg = chann.addMessage(new Message(res.body, chann, [], self.user));
|
||||
callback(null, msg);
|
||||
resolve(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function error(err) {
|
||||
|
||||
Reference in New Issue
Block a user