Automatically unload trivia when it's already loaded
This commit is contained in:
		
							parent
							
								
									8935303f41
								
							
						
					
					
						commit
						5220e703e5
					
				| @ -1,5 +1,13 @@ | |||||||
|  | from redbot.core.bot import Red | ||||||
|  | 
 | ||||||
| from .audiotrivia import AudioTrivia | 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)) |     bot.add_cog(AudioTrivia(bot)) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 bobloy
						bobloy