Skip to content

[FEATURE] Improve Message.link property to reflect threads #3475

@Bibo-Joshi

Description

@Bibo-Joshi

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

Message.link currently does not reflect if a message is a comment on another message in a supergroup/channel and also does not reflect if it's a message in a forum topic. By now we have a official documentation on how message links work: https://core.telegram.org/api/links#message-links and it would be nice to extend the support for this.

Describe the solution you'd like

I'd like for Message.link to reflect the "threads" that the message was sent in. IISC that can achieved by

  • include the reply_to_message_id as thread parameter in groups
  • include the reply_to_message_id as comment parameter in channels
  • for topics, I'm no entirely sure, but IISC the forum id and message_id should suffice, maybe the forum_id can also be used as thread

Admittedly, this needs some double checking on how things works out.

Describe alternatives you've considered

We could also add a full-fledged build_message_link function to helpers (or sim naming) that accepts all parameters described in https://core.telegram.org/api/links#message-links and use that function in Message.link.

We could also provide a method Message.build_link that accepts boolean flags that indicate if the link should represent the message in the thread (if available) or in the whole chat etc, but I think that's over the top.

Additional context

Originated from https://t.me/pythontelegrambotgroup/648879.

This has no priority to me. Just nice to have.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions