fix(seautils): fixed body error
This commit is contained in:
parent
861a03719b
commit
2d895d16c9
1 changed files with 15 additions and 19 deletions
|
@ -208,28 +208,21 @@ class SeaUtils(commands.Cog):
|
|||
html = await response.text()
|
||||
soup = BeautifulSoup(html, 'html.parser')
|
||||
pre_tags = soup.find_all('pre')
|
||||
content = []
|
||||
content: list[Embed | str] = []
|
||||
for pre_tag in pre_tags:
|
||||
text = convert_rfc_references(md(pre_tag), number)
|
||||
if len(text) > 4096:
|
||||
text1 = text[:4096]
|
||||
text2 = text[4096:]
|
||||
pagified_text = cf.pagify(text, delims=["\n\n"], page_length=4096)
|
||||
for page in pagified_text:
|
||||
if await ctx.embed_requested():
|
||||
embed = Embed(
|
||||
title=f"RFC Document {number}",
|
||||
description=text1,
|
||||
description=page,
|
||||
color=await ctx.embed_color()
|
||||
)
|
||||
content.append(embed)
|
||||
embed2 = Embed(
|
||||
title=f"RFC Document {number}",
|
||||
description=text2,
|
||||
color=await ctx.embed_color()
|
||||
)
|
||||
content.append(embed2)
|
||||
else:
|
||||
content.append(text1)
|
||||
content.append(text2)
|
||||
content.append(page)
|
||||
else:
|
||||
if await ctx.embed_requested():
|
||||
embed = Embed(
|
||||
|
@ -240,6 +233,9 @@ class SeaUtils(commands.Cog):
|
|||
content.append(embed)
|
||||
else:
|
||||
content.append(text)
|
||||
if await ctx.embed_requested():
|
||||
for embed in content:
|
||||
embed.set_footer(text=f"Page {content.index(embed) + 1}/{len(content)}")
|
||||
await SimpleMenu(pages=content, disable_after_timeout=True, timeout=300).start(ctx)
|
||||
else:
|
||||
await ctx.maybe_send_embed(content=cf.error(f"An error occurred while fetching RFC {number}. Status code: {response.status}."))
|
||||
|
|
Loading…
Reference in a new issue