Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Bot was blocked by user" #27

Open
BoredinBerlin opened this issue Apr 9, 2024 · 3 comments
Open

"Bot was blocked by user" #27

BoredinBerlin opened this issue Apr 9, 2024 · 3 comments

Comments

@BoredinBerlin
Copy link

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/telegraf@4.15.3/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'
}
}
}

@stefanodelbosco
Copy link

stefanodelbosco commented Apr 30, 2024

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 😁

@BoredinBerlin
Copy link
Author

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

@stefanodelbosco
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants