better shortened lyrics for non-botspam chans
This commit is contained in:
parent
6018de870d
commit
436755f884
@ -196,6 +196,11 @@ class Meme(commands.Cog):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
await db_conn.commit()
|
await db_conn.commit()
|
||||||
|
try:
|
||||||
|
await self.update_meme_lb()
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("Failed to update meme leaderboard following increment: %s",
|
||||||
|
str(e))
|
||||||
|
|
||||||
|
|
||||||
async def init_meme_leaderboard(self) -> None:
|
async def init_meme_leaderboard(self) -> None:
|
||||||
|
12
cogs/sing.py
12
cogs/sing.py
@ -62,7 +62,7 @@ class Sing(commands.Cog):
|
|||||||
return await ctx.respond("**Error**: No song specified, no activity found to read.")
|
return await ctx.respond("**Error**: No song specified, no activity found to read.")
|
||||||
|
|
||||||
if interaction:
|
if interaction:
|
||||||
await ctx.respond("*Searching...*", ephemeral=True) # Must respond to interactions within 3 seconds, per Discord
|
await ctx.respond("*Searching...*") # Must respond to interactions within 3 seconds, per Discord
|
||||||
|
|
||||||
parsed = self.utility.parse_song_input(song, activity)
|
parsed = self.utility.parse_song_input(song, activity)
|
||||||
|
|
||||||
@ -88,7 +88,9 @@ class Sing(commands.Cog):
|
|||||||
search_result_wrapped: list[str] = search_result[1] # Second index is the wrapped lyrics
|
search_result_wrapped: list[str] = search_result[1] # Second index is the wrapped lyrics
|
||||||
search_result_wrapped_short: list[str] = search_result[2] # Third is short wrapped lyrics
|
search_result_wrapped_short: list[str] = search_result[2] # Third is short wrapped lyrics
|
||||||
if not ctx.channel.id in BOT_CHANIDS:
|
if not ctx.channel.id in BOT_CHANIDS:
|
||||||
search_result_wrapped = search_result_wrapped_short # Replace with shortened lyrics for non spamchans
|
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]] = []
|
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)})"
|
embed_url: str = f"[on codey.lol](https://codey.lol/#{urllib.parse.quote(search_artist)}/{urllib.parse.quote(search_song)})"
|
||||||
c: int = 0
|
c: int = 0
|
||||||
@ -152,7 +154,7 @@ class Sing(commands.Cog):
|
|||||||
|
|
||||||
if isinstance(parsed, tuple):
|
if isinstance(parsed, tuple):
|
||||||
(search_artist, search_song, search_subsearch) = parsed
|
(search_artist, search_song, search_subsearch) = parsed
|
||||||
await ctx.respond("*Searching...*", ephemeral=True) # Must respond to interactions within 3 seconds, per Discord
|
await ctx.respond("*Searching...*") # Must respond to interactions within 3 seconds, per Discord
|
||||||
search_result: Optional[list] = await self.utility.lyric_search(search_artist, search_song,
|
search_result: Optional[list] = await self.utility.lyric_search(search_artist, search_song,
|
||||||
search_subsearch)
|
search_subsearch)
|
||||||
if not search_result:
|
if not search_result:
|
||||||
@ -170,7 +172,9 @@ class Sing(commands.Cog):
|
|||||||
search_result_wrapped_short: list[str] = search_result[2] # Third index is shortened lyrics
|
search_result_wrapped_short: list[str] = search_result[2] # Third index is shortened lyrics
|
||||||
|
|
||||||
if not IS_SPAMCHAN:
|
if not IS_SPAMCHAN:
|
||||||
search_result_wrapped = search_result_wrapped_short # Swap for shortened lyrics if not spam chan
|
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]] = []
|
embeds: list[Optional[discord.Embed]] = []
|
||||||
c: int = 0
|
c: int = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user