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
[BUG] Message.reply_text
leads to Message thread not found
#4205
Comments
Hi. Thanks for reaching out. I tried to reproduce the behavior, but don't see an issue. What I've tried is the following. Use this mwe: import logging
from telegram import Update
from telegram.ext import (
ApplicationBuilder,
ContextTypes,
MessageHandler,
filters,
Defaults,
)
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.WARNING
)
# set higher logging level for httpx to avoid all GET and POST requests being logged
logging.getLogger("telegram.Bot").setLevel(logging.DEBUG)
logging.getLogger("telegram.ext.ExtBot").setLevel(logging.DEBUG)
async def callback(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
chat_type = update.message.chat.type
has_topics = bool(update.message.message_thread_id)
await update.message.reply_text(
f"Test reply for chat of type: {chat_type} with topics: {has_topics}",
message_thread_id=None,
)
if __name__ == "__main__":
application = (
ApplicationBuilder()
.token("TOKEN")
# I've tried with and without defaults.
.defaults(Defaults(do_quote=True))
.build()
)
application.add_handler(MessageHandler(filters.TEXT, callback))
application.run_polling(allowed_updates=Update.ALL_TYPES) Then I've sent messages to the bot in the following chats:
Everything worked as expected for me. Can you please provide an MWE along with instructions on how to trigger the exception? Please mention group type, privacy settings of the bot, and any other relevant parameters. |
|
Like this, when you use the ja command in this group, it works normally, but when you use ja to reply to a message in the group, an error message is reported. |
Message.reply_text
leads to Message thread not found
Thanks for elaborating (though in the future, please send 1 comment instead of several and paste monospaced text instead of posting screenshots 😉 ) I think I found the issued
My first idea was that we can fix that, by checking if
Here, Message3 will have TBH at first glance, I don't think how we can make this work reliably as long as we don't know if As a side note: if we get this to work, we should make |
Poolitzer thankfully pointed me to |
It worked. Thank you so much |
Steps to Reproduce
It works when I use it directly in a group, but when I quote a message the send command doesn't work.
Expected behaviour
Actual behaviour
async def get_hitokoto(update: Update, context: ContextTypes) -> None:
url = "https://v1.hitokoto.cn/"
await update.message.reply_text(f"{url }", parse_mode="Markdown",message_thread_id=None)
Operating System
docker
Version of Python, python-telegram-bot & dependencies
Relevant log output
Additional Context
No response
The text was updated successfully, but these errors were encountered: