Skip to content

Commit e1b6e5b

Browse files
committed
Update music.py
1 parent 3e48524 commit e1b6e5b

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

src/cogs/music.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ async def play_music_from_player(self, ctx, *, player):
195195
embed.add_field(name="Title", value=player.title, inline=False)
196196
embed.add_field(name="Position in queue",
197197
value=self.current+1, inline=False)
198-
embed.add_field(name="Volume", value=str(self.vol * 100) + "%", inline=False)
198+
embed.add_field(name="Volume", value=str(int(self.vol * 100)) + "%", inline=False)
199199
# View
200200
# restart_btn = Button()
201201
# previous_btn = Button()
@@ -779,9 +779,19 @@ async def next_command(self, ctx):
779779
await ctx.send(embed=embed)
780780
else:
781781
if ctx.voice_client.is_playing() or ctx.voice_client.is_paused():
782-
self.current += 0
783-
self.repeat_song = False
784-
ctx.voice_client.stop()
782+
if self.current < len(self.music_queue[str(ctx.guild.id)]) - 1 or self.loop_queue:
783+
self.current += 0
784+
self.repeat_song = False
785+
ctx.voice_client.stop()
786+
else:
787+
async with ctx.typing():
788+
embed=discord.Embed(
789+
title="Error",
790+
description="Nothing to play after this",
791+
colour=0xff0000,
792+
timestamp=datetime.datetime.utcnow()
793+
)
794+
await ctx.send(embed=embed)
785795
return
786796
# ----------------------------------------------------------------------------------------------------------------------
787797

@@ -794,9 +804,19 @@ async def previous_command(self, ctx):
794804
await ctx.send(embed=embed)
795805
else:
796806
if ctx.voice_client.is_playing() or ctx.voice_client.is_paused():
797-
self.current -= 2
798-
self.repeat_song = False
799-
ctx.voice_client.stop()
807+
if self.current > 0 or self.loop_queue:
808+
self.current -= 2
809+
self.repeat_song = False
810+
ctx.voice_client.stop()
811+
else:
812+
async with ctx.typing():
813+
embed=discord.Embed(
814+
title="Error",
815+
description="Nothing to play before this",
816+
colour=0xff0000,
817+
timestamp=datetime.datetime.utcnow()
818+
)
819+
await ctx.send(embed=embed)
800820
return
801821
# ----------------------------------------------------------------------------------------------------------------------
802822

0 commit comments

Comments
 (0)