close webhook shit when done
@@ -27,8 +27,15 @@ class Events(commands.Cog):
self.webhook_task = self.bot.loop.create_task(self.webhook())
+ self.web_runner = None
+
def cog_unload(self):
self.bot.loop.create_task(self.dblpy.close())
+ self.bot.loop.create_task(self.close_webhook())
+
+ async def close_webhook(self):
+ await self.web_runner.shutdown()
+ await self.web_runner.cleanup()
async def webhook(self):
@@ -56,7 +63,7 @@ class Events(commands.Cog):
web_app = web.Application(loop=self.bot.loop)
web_app.router.add_post("/dbl2", vote_handler)
- web_runner = web.AppRunner(web_app)
+ self.web_runner = web.AppRunner(web_app)
await web_runner.setup()
site = web.TCPSite(web_runner, "0.0.0.0", 8000)
