-2

lately i've been trying to make my bot commands case insensitive,but couldn't succed,i've seen some tutorials but not what i'm looking for,i need the case insensivity to work for all my bot commands and not to type for each command different forms

one of my commands is:

    if message.content == 'hello':
        await message.channel.send(
            'Hello'
        )

and i wanna turn any kind of hello(Hello,HeLLo etc) into hello so the command triggers

RainbowGuy
  • 33
  • 3
  • Does this answer your question? [How do I do a case-insensitive string comparison?](https://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison) – mkrieger1 May 21 '21 at 15:54

1 Answers1

0

You can use .lower(). Your code would look like:

if message.content.lower() == 'hello':
    await message.channel.send(
        'Hello'
    )
KetZoomer
  • 2,701
  • 3
  • 15
  • 43