Skip to content

Commit

Permalink
Revert "Possible Spotify Fix 3 (#23)"
Browse files Browse the repository at this point in the history
This reverts commit 1b4527b.
  • Loading branch information
Shinyhunter2109 committed Apr 28, 2024
1 parent 56eb31d commit 9e5eff6
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions Discord-Bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,30 +795,21 @@ async def unbanhelp(ctx):

# ================================================================================= #

@client.command(pass_context=True)
@client.command()
@commands.cooldown(1, 180, commands.BucketType.user)
async def spotify(ctx, user: discord.Member = None):
if user == None:
user = ctx.author
pass
if user.activities:
for activity in user.activities:
if str(activity).lower() == "spotify":
embed = discord.Embed(
title=f"{user.name}'s Spotify",
description="Listening to {}".format(activity.title),
color=activity.colour)
duration = str(activity.duration)
finalduration = duration[3:7]
embed.set_thumbnail(url=activity.album_cover_url)
embed.add_field(name="Artist", value=activity.artist)
embed.add_field(name="Album", value=activity.album)
embed.add_field(name="Song Duration", value=finalduration)
embed.set_footer(text="Song started at {}".format(activity.created_at.strftime("%H:%M.%p")))
embed.url = (f"https://open.spotify.com/embed/track/{activity.track_id}")
await ctx.send(embed=embed)
return
await ctx.send("User is not doing anything")
return
user = user or ctx.author
spot = next((activity for activity in user.activities if isinstance(activity, discord.Spotify)), None)
if spot is None:
await ctx.send(f"{user.name} is not listening to Spotify")
return
embed = discord.Embed(title=f"{user.name}'s Spotify", color=spot.color)
embed.add_field(name="Song", value=spot.title)
embed.add_field(name="Artist", value=spot.artist)
embed.add_field(name="Album", value=spot.album)
embed.add_field(name="Track Link", value=f"[{spot.title}](https://open.spotify.com/track/{spot.track_id})")
embed.set_thumbnail(url=spot.album_cover_url)
await ctx.send(embed=embed)


@spotify.error
Expand Down

0 comments on commit 9e5eff6

Please sign in to comment.