just add separate couroutine to handle webhook shit
@@ -28,10 +28,14 @@ class Events(commands.Cog):
self.web_app = web.Application()
self.web_app.add_routes([web.post("/dbl2", self.on_dbl2_vote)])
- self.web_runner = web.AppRunner(self.web_app)
- self.bot.loop.create_task(self.web_runner.setup())
- self.site = web.TCPSite(self.web_runner, "localhost", 8000)
- self.bot.loop.create_task(self.site.start())
+ self.bot.loop.create_task(self.setup_dbl2_webhooks())
+
+ async def setup_dbl2_webhooks(self):
+ web_runner = web.AppRunner(self.web_app)
+ web_runner.setup()
+
+ site = web.TCPSite(self.web_runner, "localhost", 8000)
+ await site.start()
def cog_unload(self):
self.bot.loop.create_task(self.dblpy.close())
