Skip to content

Commit

Permalink
fix(player): resolve issue with player.stop being ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
ooliver1 committed Feb 11, 2023
1 parent 294fab6 commit eacab59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mafic/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ async def stop(self) -> None:
This is a convenience method for :meth:`update`.
"""

await self.update(track=None)
await self.update(track=None, replace=True)

async def _update_filters(self, *, fast_apply: bool) -> None:
"""Update the filters on the player.
Expand Down
13 changes: 13 additions & 0 deletions test_bot/bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ async def play(inter: Interaction, query: str):
await inter.send(f"Playing {track}")


@bot.slash_command()
async def stop(inter: Interaction):
"""Stop playing."""

if not inter.guild.voice_client:
return await inter.send("I am not in a voice channel.")

player: MyPlayer = inter.guild.voice_client

await player.stop()
await inter.send("Stopped playing.")


@bot.listen()
async def on_track_end(event: TrackEndEvent[MyPlayer]):
if event.player.queue:
Expand Down

0 comments on commit eacab59

Please sign in to comment.