W
W
who_someone2019-06-18 00:59:17
Python
who_someone, 2019-06-18 00:59:17

How can I make the bot not see the difference between uppercase and lowercase letters when reading a message?

There is a code

bot = telebot.TeleBot(config.TOKEN)

a = ["Привет", "привет", "Hello", "hello"] 
@bot.message_handler(content_types=["text"])
def name_of_function(message: Message):
  if message.text in a:
    bot.reply_to(message, "Здравствуйте!")
    return

It is necessary that instead of Was in order not to write the same words with a capital letter several times.
a = ["Привет", "привет", "Hello", "hello"]
a = ["привет", "hello"]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2019-06-18
@who_someone

https://docs.python.org/3/library/stdtypes.html#st...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question