From 5220e703e54a72391d8dbfa01602893028a0adbd Mon Sep 17 00:00:00 2001 From: bobloy Date: Tue, 2 Oct 2018 08:37:47 -0400 Subject: [PATCH] Automatically unload trivia when it's already loaded --- audiotrivia/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/audiotrivia/__init__.py b/audiotrivia/__init__.py index 327e34e..6cb34ed 100644 --- a/audiotrivia/__init__.py +++ b/audiotrivia/__init__.py @@ -1,5 +1,13 @@ +from redbot.core.bot import Red + from .audiotrivia import AudioTrivia -def setup(bot): +async def setup(bot: Red): + if bot.get_cog("Trivia"): + print("Trivia is already loaded, attempting to unload it first") + bot.remove_cog("Trivia") + await bot.remove_loaded_package("trivia") + bot.unload_extension("trivia") + bot.add_cog(AudioTrivia(bot))