eternnoir / pyTelegramBotAPI

Python Telegram bot api.
GNU General Public License v2.0
8.12k stars 2.03k forks source link

Bot can't recognize if the message is a reply #2034

Closed Karimium0 closed 1 year ago

Karimium0 commented 1 year ago

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using? latest
  2. What OS are you using? windows
  3. What version of python are you using? 3.11.4

here is a code snippet i was trying out, @bot.message_handler(commands=['reveal']) def handle_message(message): if message.reply_to_message: replied_id = message.reply_to_message.message_id bot.reply_to(message, f"The replied-to message's ID is: {replied_id}") else: bot.reply_to(message, "You need to reply to a message to use the /reveal command.") It seems like the bot cannot recognize if a message was a reply. Things i have tried:

  1. Tried to change all the different settings on my bot including privacy modes
  2. Tried in a different group
  3. made the bot an admin None seemed to work.
coder2020official commented 1 year ago

What exactly is not working? Debug

Karimium0 commented 1 year ago

What exactly is not working? Debug

Message.reply_to seems to be a none type rather than a true or false, the same snippet is used across a lot of codes that are using the library yet it's not functioning

Badiboy commented 1 year ago

image

No True/False. Message on success.

Karimium0 commented 1 year ago

image

No True/False. Message on success.

IMG_1723 IMG_1724

as you see, i still get None type despite it being a reply, I don't get the value as a message

Karimium0 commented 1 year ago

Apparently the bot was added after the message was sent. thought the bots had access to messages or at least are given info once a reply is made. It's solved. Thanks ❤️