Make sendFile() use original file name by default

This commit is contained in:
Nicholas Tay
2016-01-24 21:23:09 +11:00
parent 76ab439033
commit 47f35a942c
4 changed files with 11 additions and 6 deletions

View File

@@ -190,7 +190,9 @@ export default class Client extends EventEmitter {
}
// def sendFile
sendFile(where, attachment, name = "image.png", callback = (/*err, m*/) => { }) {
sendFile(where, attachment, name, callback = (/*err, m*/) => { }) {
name = name ? name : require('path').basename(attachment);
return this.internal.sendFile(where, attachment, name)
.then(dataCallback(callback), errorCallback(callback));
}