misc(seautils): optimized showcode
This commit is contained in:
parent
bb1aca83dd
commit
84d2728d3a
1 changed files with 4 additions and 7 deletions
|
@ -38,19 +38,16 @@ class SeaUtils(commands.Cog):
|
|||
async def showcode(self, ctx: commands.Context, *, command: str):
|
||||
"""Show the code for a particular command."""
|
||||
try:
|
||||
temp_content = []
|
||||
content = []
|
||||
for page in cf.pagify(
|
||||
temp_content = cf.pagify(
|
||||
text=inspect.getsource(self.bot.get_command(command).callback),
|
||||
escape_mass_mentions=True,
|
||||
page_length = 1977
|
||||
):
|
||||
temp_content.append(cf.box(page, lang='py'))
|
||||
|
||||
)
|
||||
content = []
|
||||
max_i = len(temp_content)
|
||||
i = 1
|
||||
for page in temp_content:
|
||||
content.append(f"**Page {i}/{max_i}**\n{page}")
|
||||
content.append(f"**Page {i}/{max_i}**\n{cf.box(page, lang='py')}")
|
||||
i += 1
|
||||
await SimpleMenu(content, disable_after_timeout=True, timeout=180).start(ctx)
|
||||
except (OSError, AttributeError):
|
||||
|
|
Loading…
Reference in a new issue