Closed tddaij closed 2 years ago
your account has been blocked for calling API too much. do not call API before checking if the message is the command to bot.
api.listenMqtt(function callback(err, message) {
if (message.body === "count") {
api.getThreadInfo(message.threadID, function (err, thread) {
if (err) {
// Blocked?
return console.error(err);
}
api.sendMessage(`Total: ${thread.messageCount}`, message.threadID);
});
}
}
api.listenMqtt(function callback(err, message) { api.getThreadInfo(message.threadID, function(err, thread) { if (message.body === "count") { api.sendMessage("Total: " + thread.messageCount, message.threadID); } }); });