aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Karlis. S <[email protected]>2020-02-29 20:23:03 +0200
committerGravatar Karlis. S <[email protected]>2020-03-01 09:15:37 +0200
commitded89e843980902e03e60a3a44997b91826300de (patch)
tree346ed0166fa58c4bae1c9476229feeea613184fb
parentMerge pull request #755 from python-discord/bug/backend/b754/scheduler-suppre... (diff)
!roles Command: Added pagination (LinePaginator), moved roles amount to title (was before in footer).
-rw-r--r--bot/cogs/information.py15
1 files 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")