depoio / node-telegram-bot

Client wrapper for Telegram Bot API (Under heavy development)
MIT License
136 stars 30 forks source link

"/error" crashes the bot #63

Closed trashbytes closed 8 years ago

trashbytes commented 8 years ago

When you send "/error" the bot crashes with following error message:

Error: Uncaught, unspecified "error" event. ([object Object])
    at Bot.emit (events.js:144:17)
    at /home/tobias/gem-dev/node_modules/node-telegram-bot/lib/Bot.js:238:24
    at Array.forEach (native)
    at Request._callback (/home/tobias/gem-dev/node_modules/node-telegram-bot/lib/Bot.js:216:23)
    at Request.self.callback (/home/tobias/gem-dev/node_modules/node-telegram-bot/node_modules/request/request.js:198:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/home/tobias/gem-dev/node_modules/node-telegram-bot/node_modules/request/request.js:1035:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
shernshiou commented 8 years ago

@trashbytes I am sorry its hard to debug. Can you give me more clue?

trashbytes commented 8 years ago

Every time a message the bot receives starts with "/error" it crashes. Simple as that. This also happens with the echo bot and I think even before

bot.on('message', function(message) {
    //code
});

is even executed.

longstone commented 8 years ago

I can confirm this error. By adding an .on('error') I can prevent this crash. If I send an other unknown command eq '/foobar'. Bot is still working.

shernshiou commented 8 years ago

yup thanks what I did too.