updates
This commit is contained in:
@@ -17,6 +17,7 @@ class RadioBot:
|
|||||||
self._watchdog_task: Optional[asyncio.Task] = None
|
self._watchdog_task: Optional[asyncio.Task] = None
|
||||||
self._ready_event: Optional[asyncio.Event] = None
|
self._ready_event: Optional[asyncio.Event] = None
|
||||||
self._current_token: Optional[str] = None
|
self._current_token: Optional[str] = None
|
||||||
|
self._loop: Optional[asyncio.AbstractEventLoop] = None
|
||||||
|
|
||||||
# Remembered so we can rejoin after an unexpected disconnect
|
# Remembered so we can rejoin after an unexpected disconnect
|
||||||
self._guild_id: Optional[int] = None
|
self._guild_id: Optional[int] = None
|
||||||
@@ -115,8 +116,8 @@ class RadioBot:
|
|||||||
def _on_stream_end(self, error):
|
def _on_stream_end(self, error):
|
||||||
if error:
|
if error:
|
||||||
logger.error(f"Stream ended: {error}")
|
logger.error(f"Stream ended: {error}")
|
||||||
if self._voice_client and self._voice_client.is_connected() and not self._voice_client.is_playing():
|
if self._loop and self._voice_client and self._voice_client.is_connected() and not self._voice_client.is_playing():
|
||||||
asyncio.get_event_loop().call_soon_threadsafe(self._play_stream)
|
self._loop.call_soon_threadsafe(self._play_stream)
|
||||||
|
|
||||||
def _stop_stream(self):
|
def _stop_stream(self):
|
||||||
if self._voice_client and self._voice_client.is_playing():
|
if self._voice_client and self._voice_client.is_playing():
|
||||||
@@ -162,6 +163,7 @@ class RadioBot:
|
|||||||
self._bot = commands.Bot(command_prefix="!", intents=intents)
|
self._bot = commands.Bot(command_prefix="!", intents=intents)
|
||||||
self._ready_event = asyncio.Event()
|
self._ready_event = asyncio.Event()
|
||||||
self._current_token = token
|
self._current_token = token
|
||||||
|
self._loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
@self._bot.event
|
@self._bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
|||||||
Reference in New Issue
Block a user