From ded89e843980902e03e60a3a44997b91826300de Mon Sep 17 00:00:00 2001 From: "Karlis. S" Date: Sat, 29 Feb 2020 20:23:03 +0200 Subject: !roles Command: Added pagination (LinePaginator), moved roles amount to title (was before in footer). --- bot/cogs/information.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bot/cogs/information.py b/bot/cogs/information.py index 49beca15b..4dd4a7e75 100644 --- a/bot/cogs/information.py +++ b/bot/cogs/information.py @@ -13,6 +13,7 @@ from discord.utils import escape_markdown from bot import constants from bot.bot import Bot from bot.decorators import InChannelCheckFailure, in_channel, with_role +from bot.pagination import LinePaginator from bot.utils.checks import cooldown_with_role_bypass, with_role_check from bot.utils.time import time_since @@ -32,20 +33,18 @@ class Information(Cog): # Sort the roles alphabetically and remove the @everyone role roles = sorted(ctx.guild.roles[1:], key=lambda role: role.name) - # Build a string - role_string = "" + # Build a list + role_list = [] for role in roles: - role_string += f"`{role.id}` - {role.mention}\n" + role_list.append(f"`{role.id}` - {role.mention}") # Build an embed embed = Embed( - title="Role information", - colour=Colour.blurple(), - description=role_string + title=f"Role information (Total {len(roles)} roles)", + colour=Colour.blurple() ) - embed.set_footer(text=f"Total roles: {len(roles)}") - await ctx.send(embed=embed) + await LinePaginator.paginate(role_list, ctx, embed) @with_role(*constants.MODERATION_ROLES) @command(name="role") -- cgit v1.2.3