Skip to content

Commit

Permalink
v0.2.3-b
Browse files Browse the repository at this point in the history
Merge pull request #15 from Hamziee/dev
  • Loading branch information
Hamziee authored Apr 14, 2024
2 parents 596cc37 + d8e9a91 commit 406c612
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions commands/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async def audio_player_task(self):
# the player will disconnect due to performance
# reasons.
try:
async with timeout(180): # 3 minutes
async with timeout(180): # 3 minutes.
self.current = await self.songs.get()
except asyncio.TimeoutError:
self.bot.loop.create_task(self.stop())
Expand Down Expand Up @@ -476,11 +476,28 @@ async def _play(self, ctx: commands.Context, *, search: str):
This command automatically searches from various sites if no URL is provided.
"""

# Initialize ran as a global variable
global ran

# Initialize ran if it's not defined
if 'ran' not in globals():
ran = False

if not ctx.voice_state.voice:
await ctx.invoke(self._leave)
await ctx.invoke(self._join)
await ctx.invoke(self._leave)
await ctx.invoke(self._join)
# Use global ran variable here
if ran == True:
import time
await ctx.invoke(self._join)
time.sleep(0.25)
await ctx.invoke(self._leave)
ran = False
await ctx.send('The bot recently left due to inactivity, please rerun your command as we have cleared the previous queue to avoid weird behaviors.')
return
else:
await ctx.invoke(self._join)
ran = True

ran = True

async with ctx.typing():
try:
Expand Down
2 changes: 1 addition & 1 deletion ex_config (change me to config.py).py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AVA_VERSION='v0.2.2-b' # Do not change this, it will help with troubleshooting later
AVA_VERSION='v0.2.3-b' # Do not change this, it will help with troubleshooting later

PREFIX = '$' # deprecated, only used for admin and music commands.
OWNER_ID = 496673945211240462 # used for admin commands and ChatAI recognition.
Expand Down

0 comments on commit 406c612

Please sign in to comment.