From 20e2d6026f5258903c505d6d54bf80930ddf99b6 Mon Sep 17 00:00:00 2001 From: bobloy Date: Fri, 14 Sep 2018 17:02:20 -0400 Subject: [PATCH] actual starting --- audiotrivia/audiosession.py | 9 ++++++++- audiotrivia/audiotrivia.py | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/audiotrivia/audiosession.py b/audiotrivia/audiosession.py index 946965e..73f3e45 100644 --- a/audiotrivia/audiosession.py +++ b/audiotrivia/audiosession.py @@ -38,7 +38,10 @@ class AudioSession(TriviaSession): await self.ctx.send(msg) print(question) - await self.audio.play(ctx=self.ctx, query=question) + # await self.ctx.invoke(self.audio.play(ctx=self.ctx, query=question)) + await self.ctx.invoke(self.audio.play, query=question) + + print("after audio.play") continue_ = await self.wait_for_answer(answers, delay, timeout) if continue_ is False: @@ -49,3 +52,7 @@ class AudioSession(TriviaSession): else: await self.ctx.send("There are no more questions!") await self.end_game() + + async def end_game(self): + await super().end_game() + await self.ctx.invoke(self.audio.disconnect) \ No newline at end of file diff --git a/audiotrivia/audiotrivia.py b/audiotrivia/audiotrivia.py index 9b861e8..250f15a 100644 --- a/audiotrivia/audiotrivia.py +++ b/audiotrivia/audiotrivia.py @@ -2,6 +2,7 @@ import pathlib from typing import List import yaml +from redbot.cogs.audio import Audio from redbot.cogs.trivia import LOG from redbot.cogs.trivia.trivia import InvalidListError, Trivia from redbot.core import commands @@ -23,6 +24,13 @@ class AudioTrivia(Trivia): self.bot = bot self.audio = None + # @commands.command() + # @commands.is_owner() + # async def testit(self, ctx: commands.Context): + # self.audio: Audio = self.bot.get_cog("Audio") + # await ctx.invoke(self.audio.play, query="https://www.youtube.com/watch?v=FrceWR4XnVU") + # print("done") + @commands.group(invoke_without_command=True) @commands.guild_only() async def audiotrivia(self, ctx: commands.Context, *categories: str):