Answer the question
In order to leave comments, you need to log in
Executing a function 1 time Python?
How can I make a function run only once?
hellos = ["Привет","привет","Здарова","Дарова","Ку","ку","Хай","Хелло","Хеллоу","дарова","Начать"]
@bot.message_handler(content_types=['text'])
def welcome(message):
for element in hellos:
if element == message.text:
bot.send_message(message.chat.id, "Привет, я рад что ты сюда заглянул.")
return
bot.polling(none_stop = True)
Answer the question
In order to leave comments, you need to log in
What is the point. In your solution, the function is wrapped in a decorator that calls it when new content of type text has flown in. In general, there is a lot of fun with this library, I recommend you to use the vk_api library, I use it in all my projects.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question