Answer the question
In order to leave comments, you need to log in
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)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question