mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 20:28:55 -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.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def userinfo(self, ctx, *, user: discord.Member = None):
|
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
|
author = ctx.author
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
|
|
||||||
@ -1306,12 +1313,13 @@ class Mod:
|
|||||||
if roles:
|
if roles:
|
||||||
roles = ", ".join([x.name for x in roles])
|
roles = ", ".join([x.name for x in roles])
|
||||||
else:
|
else:
|
||||||
roles = _("None")
|
roles = None
|
||||||
|
|
||||||
data = discord.Embed(description=activity, colour=user.colour)
|
data = discord.Embed(description=activity, colour=user.colour)
|
||||||
data.add_field(name=_("Joined Discord on"), value=created_on)
|
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=_("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:
|
if names:
|
||||||
data.add_field(name=_("Previous Names"), value=", ".join(names), inline=False)
|
data.add_field(name=_("Previous Names"), value=", ".join(names), inline=False)
|
||||||
if nicks:
|
if nicks:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user