D
D
Dmitry Makarov2020-10-02 22:43:58
Python
Dmitry Makarov, 2020-10-02 22:43:58

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

3 answer(s)
S
soremix, 2020-10-02
@SoreMix

No way

I
IKIQ, 2020-10-03
@IKIQ

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.

F
Fake_n00b, 2021-12-27
@Fake_n00b

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 question

Ask a Question

731 491 924 answers to any question