Skip to content

Commit

Permalink
Fix description not showing on posts, fix some suggested song links s…
Browse files Browse the repository at this point in the history
…howing as None
  • Loading branch information
stekc committed Oct 9, 2024
1 parent bc6175b commit 55e0f8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cogs/socials.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ async def fix_instagram(
link = link.replace("www.", "")
link = link.replace("instagram.com", self.config["instagram"]["url"])

if "/reel/" or "/reels/" in link:
if "/reel/" in link or "/reels/" in link:
link = link.replace(
self.config["instagram"]["url"], "d." + self.config["instagram"]["url"]
)
Expand Down
17 changes: 13 additions & 4 deletions cogs/songs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def callback(self, interaction: discord.Interaction):
if suggested_songs:
suggested_songs_str = "\n\n".join(
[
f"**<:icons_music:1293362305886589010> {song['artist']} - {song['name']}**\n<:website:1290793095734100008> [[Apple Music]]({song['apple_music']}) [[Spotify]]({song['spotify']}) [[YouTube]]({song['youtube']})"
f"**<:icons_music:1293362305886589010> {song['artist']} - {song['name']}**\n<:website:1290793095734100008> {song['links']}"
for song in suggested_songs
]
)
Expand Down Expand Up @@ -106,13 +106,22 @@ async def suggested_songs(self, artist: str, track: str):
spotify_url = await self.lastfm_to_spotify(track["url"])
if spotify_url:
links = await self.get_song_links(spotify_url)
song_links = []
for platform, url in [
("Apple Music", links.get("appleMusic")),
("Spotify", links.get("spotify")),
("YouTube", links.get("youtube")),
]:
if url:
song_links.append(
f"[[{platform}]]({url}{'?autoplay=0' if platform == 'Spotify' else ''})"
)

suggested_songs.append(
{
"name": track["name"],
"artist": track["artist"]["name"],
"spotify": links.get("spotify") + "?autoplay=0",
"apple_music": links.get("appleMusic"),
"youtube": links.get("youtube"),
"links": " ".join(song_links),
}
)
return suggested_songs
Expand Down

0 comments on commit 55e0f8b

Please sign in to comment.