Answer the question
In order to leave comments, you need to log in
How to send a message to a person using his ID?
(Library: telebot)
The idea of the bot is that after writing the start command in the group, the bot using the user id (Who wrote the start command) will write "Hi" to him in the PM. The problem is that the code works as I want only if I write the start command, but otherwise (If the start command is written by another user), the code just stops without an error.
The code itself:
@Bot.message_handler(commands=["start"])
def show_info(message):
Bot.send_message(message.from_user.id, "Hi")
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