Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Small example:
bot = telebot.TeleBot('Тут должен быть твой токен')
@bot.message_handler(content_types=["text"]) # Тут ловим все текстовые сообщения от пользователя
def some_funtion(message): #Название функции неважно
bot.send_message('ID чата пользователя, которому необходимо сообщение переслать', message.text)
...
msg = "Пользователь {} написал \"{}\".".format(message.from_user.username, message.text)
bot.send_message('ID чата пользователя, которому необходимо сообщение переслать', msg)
...
@bot.message_handler(commands=["id"]) # Получить ID чата при отправке сообщения /id
def chat_id(message):
my_chat_id = int(message.chat.id)
bot.send_message(message.chat.id, my_chat_id)
Can you explain how chats work?
In this case, if communication goes through a bot, then the bot is no different from a regular chat.
Bot - chat server, people - people in the chat.
A message sent to another person through a bot is no different from a regular postcard with the addressee's and sender's data sent via Russian mail.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question