I have this discord bot code that gives users roles:
@client.command(aliases=['r'], case_insensitive=True)
async def role(ctx, *, role: discord.Role):
if role in ctx.author.roles:
await ctx.author.remove_roles(role)
else:
await ctx.author.add_roles(role)
However, when a user inputs a role it is not case sensitive. For example, if you wanted the role "Coder" and did the command !role coder, it would not give you the role as it is lowercase when the role is uppercase. I tried experimenting with the capitalize() Method but I have not figured anything out.
source https://stackoverflow.com/questions/75539218/how-to-make-discord-role-command-case-insensitive-for-inputs
Comments
Post a Comment