danneu / telegram-chatgpt-bot

a Telegram ChatGPT bot that supports text prompts and two-way voice memos
33 stars 8 forks source link

Non-200 Telegram response crashes the bot #8

Closed danneu closed 1 year ago

danneu commented 1 year ago

Other people have been using the bot (cool) thus showing me how bad the bot handles errors. Every once in a while, the bot doesn't respond to me, and I know that little stinker is in a crashed state.

The most common cause right now is a non-200 response from the Telegram API.

I'm apparently throwing errors asynchronously without catching them. Off the top of my head, I'm probably not catching errors in the token streaming system's editLoop which gets run in setTimeout.