def _inrole(ctx, *roles, members, final='and'):
joined_roles = human_join(map(str, roles), final=final)
truncated_title = truncate(f'Members in {pluralize(role=len(roles))} {joined_roles}', 256, '...')
total_color = map(sum, zip(*(role.colour.to_rgb() for role in roles)))
average_color = discord.Colour.from_rgb(*map(round, (c / len(roles) for c in total_color)))
if members:
entries = sorted(map(str, members))
# Make the author's name bold (assuming they have that role).
# We have to do it after the list was built, otherwise the author's name
# would be at the top.
with contextlib.suppress(ValueError):
index = entries.index(str(ctx.author))
entries[index] = f'**{entries[index]}**'
else:
entries = ('There are no members :(', )
pages = ListPaginator(ctx, entries, colour=average_color, title=truncated_title)
await pages.interact()
评论列表
文章目录