Answer the question
In order to leave comments, you need to log in
How to do command completion?
There is this code. It is necessary that if the user_id is incorrect, the code is not executed further, that is, it does not reach the sending of the "qq" message, something like checking the user_id.
import telebot
bot = telebot.TeleBot(token)
@bot.message_handler(content_types=['text'])
def hello(message):
if message.text.lower() == 'привет':
check(message)
bot.send_message(message.from_user.id, 'qq')
def check(message):
if message.from_user.id != [905259209, -1001486872541]:
bot.send_message(message.from_user.id, 'Ты кто такой?')
bot.polling()
Answer the question
In order to leave comments, you need to log in
user_id = 1707533564 #Сюда нужный id
if message.chat.id == user_id:
#Тут ваш код
users_id = [1707533564, 1707533561] #Сюда нужные id
if message.chat.id in users_id:
#Тут ваш код
> message.from_user.id != [905259209, -1001486872541]:
Learn the basics of python first, huh? Then you will take up botography.
Checking whether a value is in a collection is performed by the in operator. To check for non-occurrence, there is the not in operator.
message.from_user.id not in [905259209, -1001486872541]:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question