[p]userinfo: Handle target w/ 'None' Member.joined_at (#2426)

This commit is contained in:
Twentysix 2019-02-07 22:40:40 +01:00 committed by GitHub
parent 8f8c52d8c4
commit 99ad01ae0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1369,10 +1369,10 @@ class Mod(commands.Cog):
@commands.bot_has_permissions(embed_links=True) @commands.bot_has_permissions(embed_links=True)
async def userinfo(self, ctx, *, user: discord.Member = None): async def userinfo(self, ctx, *, user: discord.Member = None):
"""Show information about a user. """Show information about a user.
This includes fields for status, discord join date, server This includes fields for status, discord join date, server
join date, voice state and previous names/nicknames. join date, voice state and previous names/nicknames.
If the user has no roles, previous names or previous nicknames, If the user has no roles, previous names or previous nicknames,
these fields will be omitted. these fields will be omitted.
""" """
@ -1391,8 +1391,12 @@ class Mod(commands.Cog):
joined_at = user.joined_at if not is_special else special_date joined_at = user.joined_at if not is_special else special_date
since_created = (ctx.message.created_at - user.created_at).days since_created = (ctx.message.created_at - user.created_at).days
since_joined = (ctx.message.created_at - joined_at).days if joined_at is not None:
user_joined = joined_at.strftime("%d %b %Y %H:%M") since_joined = (ctx.message.created_at - joined_at).days
user_joined = joined_at.strftime("%d %b %Y %H:%M")
else:
since_joined = "?"
user_joined = "Unknown"
user_created = user.created_at.strftime("%d %b %Y %H:%M") user_created = user.created_at.strftime("%d %b %Y %H:%M")
voice_state = user.voice voice_state = user.voice
member_number = ( member_number = (