From 591ed50ac3e9b7d8ad55666a14ff6bf14740bf4f Mon Sep 17 00:00:00 2001 From: Kowlin Date: Sat, 11 Aug 2018 05:59:43 +0200 Subject: [PATCH] [Mod] Omit empty fields from [p]userinfo (#1829) * Hide roles if none are found. * Clarify about omitted fields in help doc --- redbot/cogs/mod/mod.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/redbot/cogs/mod/mod.py b/redbot/cogs/mod/mod.py index 2694aff4d..56545e960 100644 --- a/redbot/cogs/mod/mod.py +++ b/redbot/cogs/mod/mod.py @@ -1266,7 +1266,14 @@ class Mod: @commands.command() @commands.guild_only() async def userinfo(self, ctx, *, user: discord.Member = None): - """Shows users's informations""" + """Shows information for a user. + + This includes fields for status, discord join date, server + join date, voice state and previous names/nicknames. + + If the user has none of roles, previous names or previous + nicknames, these fields will be omitted. + """ author = ctx.author guild = ctx.guild @@ -1306,12 +1313,13 @@ class Mod: if roles: roles = ", ".join([x.name for x in roles]) else: - roles = _("None") + roles = None data = discord.Embed(description=activity, colour=user.colour) 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) + if roles is not None: + data.add_field(name=_("Roles"), value=roles, inline=False) if names: data.add_field(name=_("Previous Names"), value=", ".join(names), inline=False) if nicks: