Skip to content
This repository was archived by the owner on Jul 9, 2022. It is now read-only.

Unhandled rejection TypeError: Cannot read properties of undefined (reading 'messageCount') #900

Closed
tddaij opened this issue Jan 30, 2022 · 1 comment

Comments

@tddaij
Copy link

tddaij commented Jan 30, 2022

api.listenMqtt(function callback(err, message) {
api.getThreadInfo(message.threadID, function(err, thread) {
if (message.body === "count") {
api.sendMessage("Total: " + thread.messageCount, message.threadID);
}
});
});

@BadAimWeeb
Copy link
Contributor

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);
        });
    }
}

@tddaij tddaij closed this as completed Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants