Added filenamesand fixed sendMessage error handling

This commit is contained in:
hydrabolt
2015-08-26 13:14:20 +01:00
parent 206f8cfe1f
commit 20b970ee9d
2 changed files with 17 additions and 4 deletions

View File

@@ -544,7 +544,7 @@ class Client {
}
sendFile(destination, file, callback = function (err, msg) { }) {
sendFile(destination, file, fileName = "image.png", callback = function (err, msg) { }) {
var self = this;
@@ -554,6 +554,7 @@ class Client {
if (typeof file === "string" || file instanceof String) {
fstream = fs.createReadStream(file);
fileName = file;
} else {
fstream = file;
}
@@ -582,7 +583,12 @@ class Client {
message = premessage + resolveMessage(message);
var mentions = resolveMentions();
self.resolveDestination(destination).then(send).catch(reject);
self.resolveDestination(destination).then(send).catch(error);
function error(err){
callback(err);
reject(err);
}
function send(destination) {