Add fallback in case table is too big
This commit is contained in:
parent
0660a3aec9
commit
89f22db78d
1 changed files with 7 additions and 2 deletions
|
@ -8,6 +8,7 @@ import git
|
|||
import psutil
|
||||
from aiofile import AIOFile, LineReader
|
||||
from dis_snek import MessageContext, Scale, Snake
|
||||
from dis_snek.client.errors import BadRequest
|
||||
from dis_snek.client.utils.misc_utils import find
|
||||
from dis_snek.models.discord.embed import EmbedField
|
||||
from dis_snek.models.discord.file import File
|
||||
|
@ -176,10 +177,11 @@ class BotutilCog(Scale):
|
|||
)
|
||||
|
||||
table.add_row("Total", str(i_total), str(d_total), str(l_total))
|
||||
self.logger.debug(table)
|
||||
console = Console()
|
||||
with console.capture() as capture:
|
||||
console.print(table)
|
||||
self.logger.debug(capture.get())
|
||||
self.logger.debug(len(capture.get()))
|
||||
new = "\n".join(loaded)
|
||||
removed = "\n".join(unloaded)
|
||||
changed = "\n".join(reloaded)
|
||||
|
@ -201,7 +203,10 @@ class BotutilCog(Scale):
|
|||
embed.set_image(url="https://dev.zevaryx.com/git.png")
|
||||
|
||||
self.logger.info("Updates applied")
|
||||
try:
|
||||
await ctx.reply(f"```ansi\n{capture.get()}\n```", embed=embed)
|
||||
except BadRequest:
|
||||
await ctx.reply(f"Total Changes: {l_total}", embed=embed)
|
||||
|
||||
else:
|
||||
embed = build_embed(title="Update Status", description="No changes applied", fields=[])
|
||||
|
|
Loading…
Add table
Reference in a new issue