A
A
Anarh1st2021-01-10 12:37:20
Bots
Anarh1st, 2021-01-10 12:37:20

How to send messages from a bot to several people?

Hello everyone, a small bot whose function is to receive messages and send them to other users

import telebot

token = '...'
bot = telebot.TeleBot(token)

my_chat_id = '123, 321'


@bot.message_handler(commands=['start'])
def welcome(message):
  bot.send_message(message.chat.id, 'Добро пожаловать' + str(message.from_user.username) + '!)



@bot.message_handler(content_types=['text'])
def re_send_messages(message):
  bot.forward_message(my_chat_id, message.chat.id, message.message_id)
  bot.send_message(message.chat.id, "Сообщение отправлено!")


@bot.message_handler(content_types=['photo'])
def re_send_messages(message):
  bot.forward_message(my_chat_id, message.chat.id, message.message_id)
  bot.send_message(message.chat.id, "Сообщение отправлено!")
  






bot.polling(none_stop=True)

But the bot does not send messages to two people, but only to one. How to make it send to two people? What is wrong in the code? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question