mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 12:18:54 -05:00
[Mod] Omit empty fields from [p]userinfo (#1829)
* Hide roles if none are found. * Clarify about omitted fields in help doc
This commit is contained in:
parent
47350328e6
commit
591ed50ac3
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user