bot: add member count to system card (#91)
* bot: add member count to system card * bot: fix potential crash on edge case Fixes a potential crash if a user queries the system card of a system with no members * bot: tidy up code * bot: move member count to embed title/Member field Displays the member count (between parentheses) in the embed title if the system is named, otherwise shows it in the Member field title (again between parentheses) * bot: move member count to Member field title entirely Removed the member count from the embed title and display it in the Member field title within parentheses in all cases
This commit is contained in:
parent
5124d263d5
commit
2648f208da
@ -79,6 +79,9 @@ async def system_card(conn, client: discord.Client, system: System, is_own_syste
|
||||
card = discord.Embed()
|
||||
card.colour = discord.Colour.blue()
|
||||
|
||||
all_members = await system.get_members(conn)
|
||||
member_count = str(len(all_members))
|
||||
|
||||
if system.name:
|
||||
card.title = truncate_title(system.name)
|
||||
|
||||
@ -109,7 +112,7 @@ async def system_card(conn, client: discord.Client, system: System, is_own_syste
|
||||
card.add_field(name="Description",
|
||||
value=truncate_field_body(system.description), inline=False)
|
||||
|
||||
card.add_field(name="Members", value="*See `pk;system {0} list`for the short list, or `pk;system {0} list full` for the detailed list*".format(system.hid) if not is_own_system else "*See `pk;system list` for the short list, or `pk;system list full` for the detailed list*")
|
||||
card.add_field(name="Members ({})".format(member_count), value="*See `pk;system {0} list`for the short list, or `pk;system {0} list full` for the detailed list*".format(system.hid) if not is_own_system else "*See `pk;system list` for the short list, or `pk;system list full` for the detailed list*")
|
||||
card.set_footer(text="System ID: {}".format(system.hid))
|
||||
return card
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user