mast / telegram-bot-api

First Telegram Bot API node.js library
http://mast.github.io/telegram-bot-api/
MIT License
246 stars 64 forks source link

Exception StatusCodeError: 403 #49

Closed payanthe closed 4 years ago

payanthe commented 6 years ago

I think when users block the bot and we try to send message to him throw exception StatusCodeError: 403 - [object Object] at new StatusCodeError (C:\Users\parsa\node_modules\telegram-bot-api\node_modules\request-promise\lib\errors.js:26:15) at Request.RP$callback [as _callback] (C:\Users\parsa\node_modules\telegram-bot-api\node_modules\request-promise\lib\rp.js:68:32) at Request.self.callback (C:\Users\parsa\node_modules\request\request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (C:\Users\parsa\node_modules\request\request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage. (C:\Users\parsa\node_modules\request\request.js:1091:12) at IncomingMessage.g (events.js:291:16) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) how to handle it?

mast commented 4 years ago

You can't send messages if telegram forbids it. You can catch exception in your bot and react properly.