aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-07-21 13:48:21 -0700
committerGravatar MarkKoz <[email protected]>2020-07-21 14:17:29 -0700
commit6c367269032b85fd60094228178209760aa8d282 (patch)
treed1f728f0856cafc8a0df3701e2f684807f69ad27
parentCharinfo: use send_denial helper (diff)
Charinfo: paginate the results
Pagination ensures the results will never go over the char limit for an embed. Fixes #897 Fixes BOT-3D
-rw-r--r--bot/cogs/utils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index 60e160ed0..d70fb300d 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -12,6 +12,7 @@ from discord.ext.commands import BadArgument, Cog, Context, command
from bot.bot import Bot
from bot.constants import Channels, MODERATION_ROLES, STAFF_ROLES
from bot.decorators import in_whitelist, with_role
+from bot.pagination import LinePaginator
from bot.utils import messages
log = logging.getLogger(__name__)
@@ -142,15 +143,14 @@ class Utils(Cog):
info = f"`{u_code.ljust(10)}`: {name} - {utils.escape_markdown(char)}"
return info, u_code
- charlist, rawlist = zip(*(get_info(c) for c in characters))
-
- embed = Embed(description="\n".join(charlist))
- embed.set_author(name="Character Info")
+ char_list, raw_list = zip(*(get_info(c) for c in characters))
+ embed = Embed().set_author(name="Character Info")
if len(characters) > 1:
- embed.add_field(name='Raw', value=f"`{''.join(rawlist)}`", inline=False)
+ # Maximum length possible is 252 so no need to truncate.
+ embed.add_field(name='Raw', value=f"`{''.join(raw_list)}`", inline=False)
- await ctx.send(embed=embed)
+ await LinePaginator.paginate(char_list, ctx, embed, max_size=2000, empty=False)
@command()
async def zen(self, ctx: Context, *, search_value: Union[int, str, None] = None) -> None: