Fix the crash on the not-admin warning #72

Merged
backmeupplz merged 1 commit from fix-admin-error-crash into master 2026-10-22 19:31:28 +00:00
backmeupplz commented 2026-10-22 19:21:38 +00:00 (Migrated from github.com)

When someone starts a ban vote in a chat where @banofbot isn't an admin, sendAdminError called bot.sendMessage(chat.id, chat.language, text). node-telegram-bot-api then tried to set chat_id on the text string, threw TypeError: Cannot create property 'chat_id' on string '🔥 Oops! …', and the whole bot exited and was restarted (seen in prod at 2026-10-22 18:51 UTC). The fix sends the translated text in the chat's language.

Tested with the real node-telegram-bot-api (only _request stubbed) against MongoDB 3.6.23: master reproduces the crash; this branch sends "🔥 Oops! Looks like @banofbot is not an admin here…".

🤖 Generated with Claude Code

When someone starts a ban vote in a chat where @banofbot isn't an admin, `sendAdminError` called `bot.sendMessage(chat.id, chat.language, text)`. node-telegram-bot-api then tried to set `chat_id` on the text string, threw `TypeError: Cannot create property 'chat_id' on string '🔥 Oops! …'`, and the whole bot exited and was restarted (seen in prod at 2026-10-22 18:51 UTC). The fix sends the translated text in the chat's language. Tested with the real node-telegram-bot-api (only `_request` stubbed) against MongoDB 3.6.23: master reproduces the crash; this branch sends "🔥 Oops! Looks like @banofbot is not an admin here…". 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
backmeupplz/banofbot!72
No description provided.