Skip to content

Commit

Permalink
stop button disables filters
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrWieczorek98 committed Dec 22, 2023
1 parent 21544a9 commit cdddba8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
17 changes: 0 additions & 17 deletions src/cogs/audio_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,6 @@ async def __remove_view_and_disconnect(self, player: wavelink.Player):
view.remove_view()
self.views.pop(guild_id)

# @commands.Cog.listener()
# async def on_wavelink_track_start(self, payload: wavelink.TrackStartEventPayload) -> None:
# """
# Callback used when new track starts playing
# Used to update embed wherever player changes track
# """
# player = payload.player
# view = self.views.get(player.guild.id)
# history = player.queue.history
# # Wait for track history update (should happen instantly but sometimes it doesn't)
# while True:
# await asyncio.sleep(0.1)
# if len(history) > 0 and history[-1] == player.current:
# break

# await view.send_embed()

@commands.Cog.listener()
async def on_wavelink_track_end(self, payload: wavelink.TrackEndEventPayload) -> None:
"""
Expand Down
4 changes: 3 additions & 1 deletion src/views/audio_player_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ async def stop_button(self, interaction: discord.Interaction, button: discord.ui
player = cast(wavelink.Player, interaction.guild.voice_client)
player.queue.clear()
await player.skip()
await player.set_filters()
self.filters_applied = False
await interaction.response.defer()

@discord.ui.button(label='ඞ', style=discord.ButtonStyle.grey, row=0)
Expand Down Expand Up @@ -307,7 +309,7 @@ def _update_buttons_state(self):
self.pause_button.disabled = not player.playing
self.skip_button.disabled = not player.playing
self.stop_button.disabled = not player.playing
self.filter_button.disabled = False
self.filter_button.disabled = not player.playing
self.filter_button.label = amogus if not self.filters_applied else ''
self.filter_button.emoji = dancing_black_man if self.filters_applied else None
self._update_track_selection_buttons()

0 comments on commit cdddba8

Please sign in to comment.