do away with sing embeds globally
This commit is contained in:
parent
436755f884
commit
4f3c82f9c0
54
cogs/sing.py
54
cogs/sing.py
@ -91,32 +91,23 @@ class Sing(commands.Cog):
|
||||
short_lyrics = " ".join(search_result_wrapped_short) # Replace with shortened lyrics for non spamchans
|
||||
short_lyrics = regex.sub(r'\p{Vert_Space}', ' / ', short_lyrics.strip())
|
||||
return await ctx.respond(f"**{search_result_song}** by **{search_result_artist}**\n-# {short_lyrics}")
|
||||
embeds: list[Optional[discord.Embed]] = []
|
||||
embed_url: str = f"[on codey.lol](https://codey.lol/#{urllib.parse.quote(search_artist)}/{urllib.parse.quote(search_song)})"
|
||||
|
||||
c: int = 0
|
||||
footer: str = "To be continued..." #Placeholder
|
||||
out_messages: list = []
|
||||
footer: str = "" # Placeholder
|
||||
for section in search_result_wrapped:
|
||||
c+=1
|
||||
if c == len(search_result_wrapped):
|
||||
if c == len(search_result_wrapped):
|
||||
footer = f"Found on: {search_result_src}"
|
||||
section = self.control_strip_regex.sub('', section)
|
||||
# if ctx.guild.id == 1145182936002482196:
|
||||
# section = section.upper()
|
||||
embed: discord.Embed = discord.Embed(
|
||||
title=f"{search_result_song} by {search_result_artist}",
|
||||
description=discord.utils.escape_markdown(section)
|
||||
)
|
||||
embed.add_field(name="Confidence", value=search_result_confidence,
|
||||
inline=True)
|
||||
embed.add_field(name="Time Taken", value=search_result_time_taken,
|
||||
inline=True)
|
||||
embed.add_field(name="Link", value=embed_url)
|
||||
embed.set_footer(text=footer)
|
||||
embeds.append(embed)
|
||||
await ctx.respond(embed=embeds[0])
|
||||
for _embed in embeds[1:]:
|
||||
if isinstance(_embed, discord.Embed):
|
||||
await ctx.send(embed=_embed)
|
||||
section = regex.sub(r'\p{Vert_Space}', ' / ', section.strip())
|
||||
msg: str = f"**{search_result_song}** by **{search_result_artist}**\n-# {section}\n{footer}"
|
||||
if c > 1:
|
||||
msg = "\n".join(msg.split("\n")[1:])
|
||||
out_messages.append(msg.strip())
|
||||
for msg in out_messages:
|
||||
await ctx.send(msg)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await ctx.respond(f"ERR: {str(e)}")
|
||||
@ -176,27 +167,22 @@ class Sing(commands.Cog):
|
||||
short_lyrics = regex.sub(r'\p{Vert_Space}', ' / ', short_lyrics.strip())
|
||||
return await ctx.respond(f"**{search_result_song}** by **{search_result_artist}**\n-# {short_lyrics}")
|
||||
|
||||
embeds: list[Optional[discord.Embed]] = []
|
||||
out_messages: list = []
|
||||
footer: str = ""
|
||||
c: int = 0
|
||||
footer: str = "To be continued..." #Placeholder
|
||||
for section in search_result_wrapped:
|
||||
c+=1
|
||||
if c == len(search_result_wrapped):
|
||||
footer = f"Found on: {search_result_src}"
|
||||
# if ctx.guild.id == 1145182936002482196:
|
||||
# section = section.upper()
|
||||
embed: discord.Embed = discord.Embed(
|
||||
title=f"{search_result_song} by {search_result_artist}",
|
||||
description=discord.utils.escape_markdown(section)
|
||||
)
|
||||
embed.add_field(name="Confidence", value=search_result_confidence, inline=True)
|
||||
embed.add_field(name="Time Taken", value=search_result_time_taken, inline=True)
|
||||
embed.add_field(name="Link", value=f"[on codey.lol](https://codey.lol/#{urllib.parse.quote(search_result_artist)}/{urllib.parse.quote(search_result_song)})")
|
||||
embed.set_footer(text=footer)
|
||||
embeds.append(embed)
|
||||
|
||||
for _embed in embeds:
|
||||
await ctx.send(embed=_embed)
|
||||
section = regex.sub(r'\p{Vert_Space}', ' / ', section.strip())
|
||||
msg: str = f"**{search_result_song}** by **{search_result_artist}**\n-# {section}\n{footer}"
|
||||
if c > 1:
|
||||
msg = "\n".join(msg.split("\n")[1:])
|
||||
out_messages.append(msg.strip())
|
||||
for msg in out_messages:
|
||||
await ctx.send(msg)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return await ctx.respond(f"ERR: {str(e)}")
|
||||
|
@ -130,7 +130,7 @@ class Utility:
|
||||
if not lyrics:
|
||||
return None
|
||||
response_obj['lyrics'] = textwrap.wrap(text=lyrics.strip(),
|
||||
width=4000, drop_whitespace=False,
|
||||
width=1500, drop_whitespace=False,
|
||||
replace_whitespace=False, break_long_words=True,
|
||||
break_on_hyphens=True, max_lines=8)
|
||||
response_obj['lyrics_short'] = textwrap.wrap(text=lyrics.strip(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user