Answer the question
In order to leave comments, you need to log in
How to make a bot for Telegram in Python so that it mentions all participants in the conversation?
Hello. I quickly went through the API keys on the Telegram website, in the search on the page I tried to find a key that allows you to mention all the people in the conversation, but I didn’t find it, or I missed it. Also, I searched on the Internet - 0 results.
Can you tell me how I can mention all the participants in the conversation with the /all command. I will be grateful!
Answer the question
In order to leave comments, you need to log in
I would make a list of all users, which is updated on the first user message (/start). Well, or it is checked with each message, if the bot is already active. Then display this list if necessary.
You can use Pyrogram, get API tokens in telegram, and use code like this:
with app:
members_name = ""
for member in app.iter_chat_members(chat_id):
if member.user.username is not None:
members_name += "@" + member.user.username + " "
else:
members_name += member.user.mention + " "
print(members_name)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question