Skip to content

Commit

Permalink
Merge pull request #215 from IgKniteDev/develop
Browse files Browse the repository at this point in the history
🔨 [tuning] Improved voice state management and more
  • Loading branch information
hitblast authored Apr 7, 2023
2 parents 81202cd + 53ca96c commit 9acc2c3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ async def _refresh(self, _: disnake.ui.Button, inter: disnake.Interaction) -> No
await inter.edit_original_message(embed=embed, view=self)

async def on_timeout(self) -> None:
for children in self.children:
children.disabled = True
for child in self.children:
child.disabled = True

await self.inter.edit_original_message(view=self)

Expand Down
6 changes: 3 additions & 3 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def _confirm_action(self, _: disnake.ui.Button, inter: disnake.Interaction
await inter.edit_original_message('You can\'t do that!', embed=None, view=None)

async def on_timeout(self) -> None:
for children in self.children:
if 'Redirect' != children.label:
children.disabled = True
for child in self.children:
if 'Redirect' != child.label:
child.disabled = True

await self.inter.edit_original_message(view=self)

Expand Down
11 changes: 5 additions & 6 deletions cogs/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,8 @@ def remove(self, index: int) -> None:

# The VoiceState class, which represents the playback status of songs.
class VoiceState:
def __init__(self, bot: core.IgKnite, inter: disnake.CommandInteraction) -> None:
def __init__(self, bot: core.IgKnite) -> None:
self.bot = bot
self._inter = inter

self.current = None
self.voice: disnake.VoiceProtocol | None = None
Expand Down Expand Up @@ -422,9 +421,9 @@ async def _skip(self, button: disnake.ui.Button, inter: disnake.Interaction) ->
await inter.response.edit_message(view=self)

async def on_timeout(self) -> None:
for children in self.children:
if 'Redirect' != children.label:
children.disabled = True
for child in self.children:
if 'Redirect' != child.label:
child.disabled = True

await self.inter.edit_original_message(view=self)

Expand Down Expand Up @@ -518,7 +517,7 @@ def init_voice_state(self, inter: disnake.CommandInteraction) -> VoiceState:
state = self.voice_states.get(inter.guild.id)

if not state or not state.exists:
state = VoiceState(self.bot, inter)
state = VoiceState(self.bot)
self.voice_states[inter.guild.id] = state

return state
Expand Down
2 changes: 1 addition & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .ui import *

# Set version number.
__version_info__ = ('2023', '4', '4') # Year.Month.Day
__version_info__ = ('2023', '4', '7') # Year.Month.Day
__version__ = '.'.join(__version_info__)


Expand Down
6 changes: 3 additions & 3 deletions core/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def add_button(

async def on_timeout(self) -> None:
if self.inter:
for children in self.children:
if children.style != disnake.ButtonStyle.link:
children.disabled = True
for child in self.children:
if child.style != disnake.ButtonStyle.link:
child.disabled = True

await self.inter.edit_original_message(view=self)

0 comments on commit 9acc2c3

Please sign in to comment.