Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

telegram.error.BadRequest: Chat not found#3047

Unanswered
nghlt asked this question inQ&A
May 19, 2022· 6 comments· 2 replies
Discussion options

After installedpython-telegram-bot, I ran a simple script as bellow:

from telegram import Botmy_token = '534*******:AAF*************'channel_id = -10016********def push_message(msg, chat_id=channel_id) -> None:    bot = Bot(my_token)    bot.sendMessage(chat_id, msg)push_message('Hello channel')

I got an errortelegram.error.BadRequest: Chat not found
Someone please help me.
I checked the channel ID and I think it's correct. I copied the message link from the channel then got the channel ID from this URL.

You must be logged in to vote

Replies: 6 comments 2 replies

Comment options

Hi. Please double check that your bot is a member of that chat. Note that bots can only be members of a channel if they are admin in that channel. To double check thechat_id, you can also extract it from the updates that your bot gets from that chat.

You must be logged in to vote
0 replies
Comment options

Hi, you need to add "-" as prefix for your chat id, for example if chat id is 12345, you need to add -12345

You must be logged in to vote
0 replies
Comment options

@Bibo-Joshi
My bot is gettingtelegram.error.BadRequest: User not found in a group when usedbot.getChatMember.
It has the right of sending messages in the chat.

  1. It doesn't happen once in the blue moon. It is consistent.
  2. It happens for all the users, I tried it out manually.
  3. In other groups, it works fine. ( even when with just sending message right )
  4. The group is a public supergroup
You must be logged in to vote
2 replies
@Bibo-Joshi
Comment options

Please don't Tag people just to get attention.
Please also don't ask the same question in multiple places at the same time
https://t.me/pythontelegrambotgroup/737228

@Nusab19
Comment options

I thought this should be placed as an issue rather than just asking in Telegram. So, I sent it here so in future, someone with the same issue can find this

Comment options

Please don't Tag people just to get attention.

You are one of the participants in this issue. That's the reason of me mentioning you.

You must be logged in to vote
0 replies
Comment options

After installedpython-telegram-bot, I ran a simple script as bellow:

from telegram import Botmy_token = '534*******:AAF*************'channel_id = -10016********def push_message(msg, chat_id=channel_id) -> None:    bot = Bot(my_token)    bot.sendMessage(chat_id, msg)push_message('Hello channel')

I got an errortelegram.error.BadRequest: Chat not found Someone please help me. I checked the channel ID and I think it's correct. I copied the message link from the channel then got the channel ID from this URL.

I got the same issue too and didn't know how to resolve it.

You must be logged in to vote
0 replies
Comment options

After installedpython-telegram-bot, I ran a simple script as bellow:

from telegram import Botmy_token = '534*******:AAF*************'channel_id = -10016********def push_message(msg, chat_id=channel_id) -> None:    bot = Bot(my_token)    bot.sendMessage(chat_id, msg)push_message('Hello channel')

I got an errortelegram.error.BadRequest: Chat not found Someone please help me. I checked the channel ID and I think it's correct. I copied the message link from the channel then got the channel ID from this URL.

I resolved the issue. I found the previous channel id was incorrect. I issued the following command:

https://api.telegram.org/bot<TOKEN>/getUpdates

and check the id is -1002XXXXXXX under the channel name

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
5 participants
@nghlt@wyatt-wong@Bibo-Joshi@obarboza92@Nusab19

[8]ページ先頭

©2009-2025 Movatter.jp