toogoodtogo-bot icon indicating copy to clipboard operation
toogoodtogo-bot copied to clipboard

"Bot was blocked by user"

Open BoredinBerlin opened this issue 10 months ago • 3 comments

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' } } }

BoredinBerlin avatar Apr 09 '24 18:04 BoredinBerlin

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 😁

stefanodelbosco avatar Apr 30 '24 20:04 stefanodelbosco

How can I tell what user that is by the chat_id? Is there some way to see that in Telegram?

BoredinBerlin avatar May 06 '24 17:05 BoredinBerlin

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.

stefanodelbosco avatar May 20 '24 17:05 stefanodelbosco