Answer the question
In order to leave comments, you need to log in
How to send a message from a bot to multiple users?
I know that you can send messages from the bot using the API:
https://api.telegram.org/bot <YOUR_TOKEN>/sendMessage?chat_id=&text=<TEXT>
But how can I send a message to several people at once in this way? Is it really possible to make such a link for each id
Answer the question
In order to leave comments, you need to log in
First we need to collect the chat_id of the users. For example, when the user writes the '/start' command, the function would be:
chat_id = update.message.chat.id
Write this value to the list, or to the database (at least to a text file)
After that, we do the sending itself. I would do it like this:
bot = Bot(токен_бота)
for user_number in range(len(список_с_пользователями)):
chat_id = список_с_пользователями[user_number]
bot.send_message (
text = 'То, что ты хочешь написать',
chat_id = chat_id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question