[General] Add member # to [p]userinfo (#528)

This commit is contained in:
palmtree5 2016-12-17 20:20:58 -06:00 committed by Twentysix
parent 8593c08f77
commit 8145b41097

View File

@ -156,7 +156,7 @@ class General:
await self.bot.say(msg)
@commands.command(pass_context=True, no_pm=True)
async def userinfo(self, ctx, user: discord.Member=None):
async def userinfo(self, ctx, *, user: discord.Member=None):
"""Shows users's informations"""
author = ctx.message.author
server = ctx.message.server
@ -171,6 +171,8 @@ class General:
since_joined = (ctx.message.timestamp - joined_at).days
user_joined = joined_at.strftime("%d %b %Y %H:%M")
user_created = user.created_at.strftime("%d %b %Y %H:%M")
member_number = sorted(server.members,
key=lambda m: m.joined_at).index(user) + 1
created_on = "{}\n({} days ago)".format(user_created, since_created)
joined_on = "{}\n({} days ago)".format(user_joined, since_joined)
@ -195,7 +197,8 @@ class General:
data.add_field(name="Joined Discord on", value=created_on)
data.add_field(name="Joined this server on", value=joined_on)
data.add_field(name="Roles", value=roles, inline=False)
data.set_footer(text="User ID: " + user.id)
data.set_footer(text="Member #{} | User ID:{}"
"".format(member_number, user.id))
if user.avatar_url:
name = str(user)