toogoodtogo-bot
toogoodtogo-bot copied to clipboard
"Bot was blocked by user"
Started seeing these errors today -- not sure what it means exactly....I seem to be getting these alerts, just never noticed this behaviour before. Is it something on Telegram's end?
TelegramError: 403: Forbidden: bot was blocked by the user at Telegram.callApi (/Users/xxxxx/xxxx/toogoodtogo-bot/node_modules/.pnpm/[email protected]/node_modules/telegraf/lib/core/network/client.js:302:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { response: { ok: false, error_code: 403, description: 'Forbidden: bot was blocked by the user' }, on: { method: 'sendMessage', payload: { chat_id: 1297094036, parse_mode: 'HTML', text: 'Original Unverpackt\nAvailable: 1\n3,00 €\nToday 19:15 - 19:45' } } }
Hello, 403 this error is when your script send a message to a user that delete and block the bot.
The chat_id indicated in the error message is the user
I hope, it can help you 😁
How can I tell what user that is by the chat_id? Is there some way to see that in Telegram?
I don't think there is a way to get this info.. Reading the code, i see the file where the 'chat_id' are stored after the '/start' command.
const file = path.join(__dirname, '..', '..', 'store', 'data.json');
I think you can:
- stop the bot
- cleanup the file
- restart the bot again
- 'restart' your chat with a new /start
I think with this steps it will be fix the problem (the bot will restart without knowing the previous chat_id) :)
In this program you cannot set an 'admin chat_id' to filter the casual people when they 'start' the bot randomally.