Search code examples
pythondiscorddiscord.pybots

How do I make the command work regardless of the case. discord.py?


How do I make the command work regardless of the case? that is , the user can write !Teama, !TeamA, !TEAMa, etc. and the command should work anyway? https://i.sstatic.net/AZfzB.png

that's my code:

a = "asd"
@client.command(pass_context=True)
async def teama(ctx):
    await ctx.send(a)

Solution

  • You simply have to specify it when declaring the bot:

    bot = commands.Bot(command_prefix='!', case_insensitive=True)