diff --git a/royalnet/serf/discord/__init__.py b/royalnet/serf/discord/__init__.py index af5bb41e..67120215 100644 --- a/royalnet/serf/discord/__init__.py +++ b/royalnet/serf/discord/__init__.py @@ -5,13 +5,11 @@ It is pretty unstable, compared to the rest of the bot, but it *should* work.""" from .escape import escape from .discordserf import DiscordSerf from .playable import Playable -from .playableytdqueue import PlayableYTDQueue from .voiceplayer import VoicePlayer __all__ = [ "escape", "DiscordSerf", "Playable", - "PlayableYTDQueue", "VoicePlayer", ] diff --git a/royalnet/serf/discord/playableytdqueue.py b/royalnet/serf/discord/playableytdqueue.py deleted file mode 100644 index 44dfc366..00000000 --- a/royalnet/serf/discord/playableytdqueue.py +++ /dev/null @@ -1,46 +0,0 @@ -import logging -from typing import Optional, List, AsyncGenerator, Tuple, Any, Dict -from royalnet.bard import YtdlDiscord -from .playable import Playable -try: - import discord -except ImportError: - discord = None - - -log = logging.getLogger(__name__) - - -class PlayableYTDQueue(Playable): - """A queue of :class:`YtdlDiscord` to be played in sequence.""" - def __init__(self, start_with: Optional[List[YtdlDiscord]] = None): - super().__init__() - self.contents: List[YtdlDiscord] = [] - self.now_playing: Optional[YtdlDiscord] = None - if start_with is not None: - self.contents = [*self.contents, *start_with] - log.debug(f"Created new PlayableYTDQueue containing: {self.contents}") - - async def _generator(self) \ - -> AsyncGenerator[Optional["discord.AudioSource"], Tuple[Tuple[Any, ...], Dict[str, Any]]]: - yield - while True: - log.debug(f"Dequeuing an item...") - try: - # Try to get the first YtdlDiscord of the queue - self.now_playing: YtdlDiscord = self.contents.pop(0) - except IndexError: - # If there isn't anything, yield None - log.debug(f"Nothing to dequeue, yielding None.") - yield None - continue - log.debug(f"Yielding FileAudioSource from: {self.now_playing}") - # Create a FileAudioSource from the YtdlDiscord - # If the file hasn't been fetched / downloaded / converted yet, it will do so before yielding - async with self.now_playing.spawn_audiosource() as fas: - # Yield the resulting AudioSource - yield fas - # Delete the YtdlDiscord file - log.debug(f"Deleting: {self.now_playing}") - await self.now_playing.delete_asap() - log.debug(f"Deleted successfully!") diff --git a/royalnet/serf/serf.py b/royalnet/serf/serf.py index f8caca25..ef0480a0 100644 --- a/royalnet/serf/serf.py +++ b/royalnet/serf/serf.py @@ -182,10 +182,12 @@ class Serf: raise ExternalError(response.extra_info["message"]) else: raise ProgramError(f"Invalid error in Herald event '{event_name}':\n" - f"[p]{response}[/p]") + f"[b]{response.extra_info['type']}[/b]\n" + f"{response.extra_info['message']}") elif response.name == "unhandled_exception_in_event": raise ProgramError(f"Unhandled exception in Herald event '{event_name}':\n" - f"[p]{response}[/p]") + f"[b]{response.extra_info['type']}[/b]\n" + f"{response.extra_info['message']}") elif isinstance(response, rh.ResponseSuccess): return response.data else: