def __unload(self): if not self._cleaned_up: self.session.detach() if self._disconnect_task: self._disconnect_task.cancel() self.bot.loop.create_task(lavalink.close()) shutdown_lavalink_server() self._cleaned_up = True
def cog_unload(self) -> None: if not self.cog_cleaned_up: self.bot.dispatch("red_audio_unload", self) self.session.detach() self.bot.loop.create_task(self._close_database()) if self.player_automated_timer_task: self.player_automated_timer_task.cancel() if self.lavalink_connect_task: self.lavalink_connect_task.cancel() if self.cog_init_task: self.cog_init_task.cancel() lavalink.unregister_event_listener(self.lavalink_event_handler) self.bot.loop.create_task(lavalink.close()) if self.player_manager is not None: self.bot.loop.create_task(self.player_manager.shutdown()) self.cog_cleaned_up = True