I declared an array with permitted user id
users_id = ['123213213']
and trying to validate user
@bot.message_handler(commands=['authorize'])
def start_command(message):
if message.from_user.id not in users_id:
bot.send_message(
message.chat.id,
'u are not permitted to run this bot'
)
else:
bot.send_message(
message.chat.id,
'u are welcome'
)
I printed message.from_user.id
and it looks the same as my array object, but i always get message "u are not permitted to run this bot"
please, could somebody explain what am i doing wrong?
message.chat.id
is integer value so you have to use list with integers
users_id = [123213213]
BTW: you can check it with print()
and type()
print(message.chat.id, type(message.chat.id))