Skip to content

Commit

Permalink
Fixed forward and rewind command
Browse files Browse the repository at this point in the history
  • Loading branch information
ChocoMeow committed Dec 15, 2023
1 parent 727f37c commit 5e0f8b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cogs/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ async def forward(self, ctx: commands.Context, position: str = "10"):
if num is None:
return await ctx.send(player.get_msg('timeFormatError'), ephemeral=True)

await player.seek(player.position + num)
await player.seek(int(player.position + num))
await ctx.send(player.get_msg('forward').format(ctime(player.position + num)))

@commands.hybrid_command(name="rewind", aliases=get_aliases("rewind"))
Expand All @@ -692,7 +692,7 @@ async def rewind(self, ctx: commands.Context, position: str = "10"):
if num is None:
return await ctx.send(player.get_msg('timeFormatError'), ephemeral=True)

await player.seek(player.position - num)
await player.seek(int(player.position - num))
await ctx.send(player.get_msg('rewind').format(ctime(player.position - num)))

@commands.hybrid_command(name="replay", aliases=get_aliases("replay"))
Expand Down
8 changes: 5 additions & 3 deletions views/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ async def callback(self, interaction: discord.Interaction):
if not self.player.current:
return await self.send(interaction, self.player.get_msg('noTrackPlaying'), ephemeral=True)

await self.player.seek(self.player.position + 30000)
await self.send(interaction, self.player.get_msg('forward').format(func.time(self.player.position + 10000)))
position = int(self.player.position + 30000)

await self.player.seek(position)
await self.send(interaction, self.player.get_msg('forward').format(func.time(position)))

class Rewind(ControlButton):
def __init__(self, **kwargs):
Expand All @@ -362,7 +364,7 @@ async def callback(self, interaction: discord.Interaction):
if not self.player.current:
return await self.send(interaction, self.player.get_msg('noTrackPlaying'), ephemeral=True)

position = 0 if (value := (self.player.position - 30000)) <= 0 else value
position = 0 if (value := int(self.player.position - 30000)) <= 0 else value

await self.player.seek(position)
await self.send(interaction, self.player.get_msg('rewind').format(func.time(position)))
Expand Down

0 comments on commit 5e0f8b1

Please sign in to comment.