Good time of day!
Here is the code and for some reason does not want to give out or added the user ID.

users_id = [] @bot.message_handler(commands=['start']) def begin(message): for id in users_id: if id != message.from_user.id : users_id.append(message.from_user.id) print(users_id) 
  • one
    since before the entry into the function the list is empty, your id runs through the cycle over the empty list, that is, there is not a single iteration. First make a check on the empty list, if empty, add an element. And if not empty, then by cycle compare id with message.from_user.id - xxclojure

1 answer 1

Do the following:

 if message.from_user.id not in users: users.append(message.from_user.id)