title: Discord.py ~ a command that shows user info
body: <p>I'm trying to make a userinfo command, the command works but only without mentions &quot;grabs my info but doesn't work when i mention someone&quot;. The command gives me this when i mention someone to see their info
  <code>Command raised an exception: AttributeError: 'ClientUser' object has no attribute 'joined_at'</code>
  Here's the code</p>
  <pre><code>@bot.command()
  async def userinfo(ctx, *, user: discord.User = None): # b'\xfc'
      if user is None:
          user = ctx.author      
      date_format = &quot;%a, %d %b %Y %I:%M %p&quot;
      embed = discord.Embed(color=0xdfa3ff, description=user.mention)
      embed.set_author(name=str(user), icon_url=user.avatar_url)
      embed.set_thumbnail(url=user.avatar_url)
      embed.add_field(name=&quot;Joined&quot;, value=user.joined_at.strftime(date_format))
      members = sorted(ctx.guild.members, key=lambda m: m.joined_at)
      embed.add_field(name=&quot;Join position&quot;, value=str(members.index(user)+1))
      embed.add_field(name=&quot;Registered&quot;, value=user.created_at.strftime(date_format))
      if len(user.roles) &gt; 1:
          role_string = ' '.join([r.mention for r in user.roles][1:])
          embed.add_field(name=&quot;Roles [{}]&quot;.format(len(user.roles)-1), value=role_string, inline=False)
      perm_string = ', '.join([str(p[0]).replace(&quot;_&quot;, &quot; &quot;).title() for p in user.guild_permissions if p[1]])
      embed.add_field(name=&quot;Guild permissions&quot;, value=perm_string, inline=False)
      embed.set_footer(text='ID: ' + str(user.id))
      return await ctx.send(embed=embed)
  </code></pre>