Answer the question
In order to leave comments, you need to log in
When using a bot in a chat, it saves the chat id instead of the user id, how to change the code?
I'll miss the start
knownUsers = []
@bot.message_handler(commands=['start'])
def send_welcome(message):
cid = message.chat.id
if cid not in knownUsers:
knownUsers.append(cid)
userStep[cid] = 0
bot.send_message(cid, "Привет " + str(message.from_user.first_name) + ' , приятно познакомиться')
bot.send_message(cid, "Сканирование прошло успешно ")
print(knownUsers)
return cid
else:
bot.send_message(cid, "Ещё раз привет, " + str(message.from_user.first_name))
return cid
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