I am creating a discord bot, and I am trying to make it where if a member says a command with no user mentioned, it defaults to themself. It doesn\'t work inline, and I need the
You can mark the parameter Optional, then check if it is None
in the body of the coroutine:
from discord import Member
from typing import Optional
@bot.command(name="joined", description="Shows precisely when a member of the server joined", aliases=["entry", "jointime", "join_time"], pass_context=True)
async def joined(ctx, member: Optional[Member]):
"""Says when a member joined."""
member = member or ctx.author
await ctx.send('{0.name} joined in {0.joined_at}'.format(member))