Is There A Way To Include Spaces In My Argument?
In my discord bot, I have 2 commands do give and create roles. They work perfectly fine, but if the role name includes a space, I have an issue. It counts the second word toward th
Solution 1:
You have a few options:
Use a role converter and require the role to be mentioned:
asyncdefgiverole(ctx, role: discord.Role, member: discord.Member):
Require the role to be wrapped in quotes:
k!giverole "Bot Tester"@user
Switch the positions of the two arguments so that the converted user comes first, and the potentially spaced name comes as the keyword-only argument.
asyncdefgiverole(ctx, member: discord.Member, *, rname):
I would recommend the first option, but you may want to try the others as well to see which one you prefer.
Post a Comment for "Is There A Way To Include Spaces In My Argument?"