Change format of short member list a bit
This commit is contained in:
parent
2efaca706f
commit
bfdb629aa5
@ -362,6 +362,8 @@ async def system_frontpercent(ctx: CommandContext, system: System):
|
||||
await ctx.reply(embed=embed)
|
||||
|
||||
async def system_list(ctx: CommandContext, system: System):
|
||||
# TODO: refactor this
|
||||
|
||||
all_members = sorted(await system.get_members(ctx.conn), key=lambda m: m.name.lower())
|
||||
if ctx.match("full"):
|
||||
page_size = 8
|
||||
@ -404,10 +406,10 @@ async def system_list(ctx: CommandContext, system: System):
|
||||
else:
|
||||
|
||||
#Basically same code as above
|
||||
#A dozen members at a time seems handy
|
||||
page_size = 12
|
||||
#25 members at a time seems handy
|
||||
page_size = 25
|
||||
if len(all_members) <= page_size:
|
||||
# If we have less than 12 members, don't bother paginating
|
||||
# If we have less than 25 members, don't bother paginating
|
||||
await ctx.reply(embed=embeds.member_list_short(system, all_members, 0, page_size))
|
||||
else:
|
||||
current_page = 0
|
||||
|
@ -224,6 +224,7 @@ def help_footer_embed() -> discord.Embed:
|
||||
embed.set_footer(text="By @Ske#6201 | GitHub: https://github.com/xSke/PluralKit/")
|
||||
return embed
|
||||
|
||||
# TODO: merge these somehow, they're very similar
|
||||
def member_list_short(system: System, all_members: List[Member], current_page: int, page_size: int):
|
||||
page_count = int(math.ceil(len(all_members) / page_size))
|
||||
|
||||
@ -238,11 +239,14 @@ def member_list_short(system: System, all_members: List[Member], current_page: i
|
||||
|
||||
embed = discord.Embed()
|
||||
embed.title = title
|
||||
|
||||
desc = ""
|
||||
for member in all_members[current_page*page_size:current_page*page_size+page_size]:
|
||||
member_description = "**ID**: {}\n".format(member.hid)
|
||||
|
||||
#Removed truncating since it's just the ID
|
||||
embed.add_field(name=member.name, value=member_description, inline=False)
|
||||
if member.prefix or member.suffix:
|
||||
desc += "[`{}`] {} *({}text{})*\n".format(member.hid, member.name, member.prefix, member.suffix)
|
||||
else:
|
||||
desc += "[`{}`] {}\n".format(member.hid, member.name)
|
||||
embed.description = desc
|
||||
return embed
|
||||
|
||||
def member_list_full(system: System, all_members: List[Member], current_page: int, page_size: int):
|
||||
|
Loading…
Reference in New Issue
Block a user