最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to determine if a message on Telegram is a comment using pyrogram? (or any other library if not possible with pyrogram) - St

matteradmin7PV0评论

I need to differentiate between messages that are replies to a channel and comments under a channel post. I could not find any reliable way to do that and pyrogram does not give any info about whether a message is a comment or not in the Message object. Is there a way to do that? What's the exact difference between a comment and a reply to a channel's message?

I tried marking all replies to a message sent by a channel to be a comment, but a channel can send a message in a non-linked chat and when you reply to that message, it is not actually a comment.

reply_in_msg = msg.reply_to_message
is_reply_to_channel = reply_in_msg and (reply_in_msg.forward_from_chat and reply_in_msg.forward_from_chat.type == ChatType.CHANNEL)

The code block is mostly irrelevant, its what i use to determine whether a message contains a reply to a channel

What i expect: i need a way to determine whether a message is a comment or not and i have no idea how to do that

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far