Answer the question
In order to leave comments, you need to log in
How to implement if message.text == {array} so that if elif is not written for each number?
telebot python telegram bot.....
there is a certain array
code = [
["11072"],
["018"],
["13072", "13079"],
["0"],
["11070", "11012", "11219", "11071"],
["11464","11496", "11408"],
["136"]
]
bot.message_handler(content_types=["text"])
def repeat_all_messages(message):
chatid = message.chat.id
if message.text == '13072':
bot.send_message(chatid, f"code is {message.text}")
else:
bot.send_message(chatid, message.text)
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