Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
izy521 committed Feb 29, 2016
1 parent 7af453e commit 1edb70a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ function sendMessages(ID, messageArr, interval) {
bot.sendMessage({
to: ID,
message: messageArr.shift()
}, function(res) {
resArr.push(res);
}, function(err, res) {
if (err) {
resArr.push(err);
} else {
resArr.push(res);
}
if (resArr.length === len) if (typeof(callback) === 'function') callback(resArr);
});
_sendMessages();
Expand All @@ -77,8 +81,12 @@ function sendFiles(channelID, fileArr, interval) {
bot.uploadFile({
to: channelID,
file: fileArr.shift()
}, function(res) {
resArr.push(res);
}, function(err, res) {
if (err) {
resArr.push(err);
} else {
resArr.push(res);
}
if (resArr.length === len) if (typeof(callback) === 'function') callback(resArr);
});
_sendFiles();
Expand Down

0 comments on commit 1edb70a

Please sign in to comment.