atipugin / telegram-bot-ruby

Ruby wrapper for Telegram's Bot API
https://core.telegram.org/bots/api
Do What The F*ck You Want To Public License
1.35k stars 218 forks source link

Bot crashed after creating a poll in it #217

Closed Andrekick closed 4 years ago

Andrekick commented 4 years ago

Hi, I'm fairly new to programming. I created a bot that gives a random answer from array, made few ReplyKeyboardMarkup's in it. It was working fine but after creating a poll in telegram itself( in the bot, not in the code) and sharing this poll with a user, my bot crashes everytime. Logs from heroku give me this: INFO -- : Incoming message: text="#" uid=

over and over, just different numbers.

Could you please help me out because it was working fine before this poll.

ivanovaleksey commented 4 years ago

It seems that your bot can handle only certain kinds of messages and can't handle poll message. I guess your bot just fetches the same message from Telegram Bot API every time because it crashes on handling and doesn't send acknowledgment to the API. You can remove any handling logic that forces your bot to crash and redeploy it to Heroku. This way your bot will correctly receive the message and acknowledge it to the API.

Andrekick commented 4 years ago

I guess your bot just fetches the same message from Telegram Bot API every time because it crashes on handling and doesn't send acknowledgment to the API.

That's what I thought but couldn't explain myself. Thanks!

You can remove any handling logic that forces your bot to crash and redeploy it to Heroku. This way your bot will correctly receive the message and acknowledge it to the API.

I will leave basic stuff like /start and /stop, I guess it should work. Thanks, I'll try it and get back to you.

Andrekick commented 4 years ago

It helped! I removed most of the code, left simple stuff. Then redeployed everything, fixed few bugs and all good.

Thanks a lot!