mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
sendFile and fix deleteMessage
This commit is contained in:
@@ -161,7 +161,7 @@ var Client = (function (_EventEmitter) {
|
||||
callback = options;
|
||||
}
|
||||
|
||||
self.internal.deleteMessage(msg).then(function () {
|
||||
self.internal.deleteMessage(msg, options).then(function () {
|
||||
callback();
|
||||
resolve();
|
||||
})["catch"](function (e) {
|
||||
@@ -217,6 +217,24 @@ var Client = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
// def sendFile
|
||||
|
||||
Client.prototype.sendFile = function sendFile(where, attachment) {
|
||||
var name = arguments.length <= 2 || arguments[2] === undefined ? "image.png" : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function (err, m) {} : arguments[3];
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
self.internal.sendFile(where, attachment, name).then(function (m) {
|
||||
callback(null, m);
|
||||
resolve(m);
|
||||
})["catch"](function (e) {
|
||||
callback(e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return Client;
|
||||
})(EventEmitter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user