I am trying to make a rank based system for my discord.py
bot.
I want to implement a rank command which returns the rank of the specified user. By default I want the specified user to be the one invoking the command, i.e. ctx.message.author
.
async def rank(self, ctx, user: discord.Member=ctx.message.author):
I know this is invalid syntax, but how could I achieve such a thing?
My discord.py version is 1.7.3
.
Thanks!
I would make user
default to None (using typing.Optional) and replace it with ctx.message.author inside the command.
e.g
async def rank(self, ctx, user: typing.Optional[discord.Member]=None):
if not user:
user = ctx.message.author