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
[Suggestion] Add mention_XXX to Chat class #3216
Comments
Hi, i want contribute in this project. Please assign this project to me. |
Hi, my contribution to this project has been just one word, fixing a typo. Please do not tag random contributors, it is distracting to us, it is inconsiderate towards our time and we are powerless to help you. You can check the contributor insights page to find major contributors to a project https://github.com/python-telegram-bot/python-telegram-bot/graphs/contributors Have a nice day Edit: Reading again this reply I was too harsh without need. I stand by what I said but I think I could have expressed it with a much better choice of words. I apologize for that and I hope this doesn't discourage you to contribute to this or other open source projects. |
@DhwanishShah glad that you like to contribute. I'm assigning this issue to you. |
Hi I am new to this community. Can you please explain in brief about this suggestion @Poolitzer ? |
Hey, sure. Please read the description and if you have a specific technical question while implementing the mentioned changes to the Chat class, ask them, and I will explain :D |
Hi, i want contribute in this project. Please assign this project to me. |
Sicne @DhwanishShah hasn't PRed so far, I'll re-assign to @Srijan-bot . @DhwanishShah if you are in fact preparing a PR, please leave a short comment here. |
Can I contribute to this project @Bibo-Joshi. Can you assign me please. |
Yes I am preparing PR |
All right. Can you give an estimate on when you'll be PRin @DhwanishShah? It has been two weeks since your last comment 😉 @Srijan-bot @Paari1263 please for now have a look at the other hacktoberfest issues instead. |
@DhwanishShah since I've not seen a reply from you since 10 days, I'll unassign you again. @Srijan-bot @Paari1263 (or anyone else) if you're still interested, please leave a short comment. |
|
Hello! I'd like to contribute if that's okay. I'm new to this repo and new to contributing, but I have worked with python quite a bit. |
I don't get the 'mention the Chat in the picked markup'. As mentioned by miles, I can't seem to find anywhere in the API to mention chats, only mentioning users. Could you elaborate on this? |
Hi, sorry for my late response. You both are right, there is no documented way of dealing with Chats without usernames, i forgot this when writing the issue. There is however the link to specific messages in chats with no username, https://t.me/c/chat_id/message_id. This only works if you are part of the chat ofc, and it is only really implemented for super groups/channels. But it can be used to link to a chat without a username. I need the opinion of the maintainers of this repository before "I" can tell you if/how to implement this. There are three ways to try to abuse this link I can think of, either with adding nothing, with adding -1 or with adding a very large number (this is problematic because some groups might reach this number of messages and then the "chat link" turns into a "message link"). I have collected the behaviour on all official telegram apps: Normal group links only work in the Android App and the Web apps.
Until we reached a consent if and if yes, how to implement this, you could implement mentioning by chat username. This works with https://t.me/username, in the respective markup. @miles170 commented earlier, so if they want to implement this, I would give them a day to say so. |
Alright, no problem! I'll check in on this tomorrow. |
@Poolitzer https://bugs.telegram.org/c/21352 got created. Ideally we get a proper documented way to mention chats without usernames at some point. |
Tbh I had thought that the main use case here would be private chats, where mentioning the chat boils down to mentioning the user. IMO it would be perfectly fine to just In any case, |
I would prefer the method returns the t.me link for public chats instead of None. |
Agree with poolitzer for public chats. For private chats we can just use |
For public chats, sure. For private group-chats, I'm leaning towards returning
That's exactly what |
Hello, is it possible I work on this issue? 🙂 |
We have reached a decision. Please implement the return function the following way: If not and the chat has a username, make the text link to https://t.me/username. If the chat does not have a username, raise a TypeError with the text set to something like "Can not create a link to a private group chat". If you want to implement this @MRZHD1 I will assign you, everyone else had enough time to speak up :D |
I can work on this if no one wants to take over. |
Looks like it's yours. |
I have one question left to implement this. Should I change def mention_html(user_id: Union[int, str], name: str) -> str to def mention_html(user_id: Union[int, str], name: str, tg_link_prefix: str = "tg://user?id=") -> str Since Or should we implement it inside the chat class? |
Currently the .link attributes of chat and user do not allow to change the prefix, I wouldn't add it in this PR. If you think it's a good thing to have that, you can make a new issue, and we can add it everywhere at once. |
XXX means .html and .markdown(_v2). It is supposed to mention the Chat in the picked markup. Use title or first_name + space + Lastname as the text if the input parameter name is not set (otherwise use that), and the inline mention of the chat.id.
The logic will be close to the User one, have a look at it here: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/_user.py#L222
Also check out our contrib document to get started with this project, and don't forget to unit test your changes!
The text was updated successfully, but these errors were encountered: