Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions redbot/cogs/mod/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,10 @@ async def __global_check(self, ctx):
@commands.bot_has_permissions(embed_links=True)
async def userinfo(self, ctx, *, user: discord.Member = None):
"""Show information about a user.

This includes fields for status, discord join date, server
join date, voice state and previous names/nicknames.

If the user has no roles, previous names or previous nicknames,
these fields will be omitted.
"""
Expand All @@ -1391,8 +1391,12 @@ async def userinfo(self, ctx, *, user: discord.Member = None):

joined_at = user.joined_at if not is_special else special_date
since_created = (ctx.message.created_at - user.created_at).days
since_joined = (ctx.message.created_at - joined_at).days
user_joined = joined_at.strftime("%d %b %Y %H:%M")
if joined_at is not None:
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")
voice_state = user.voice
member_number = (
Expand Down