mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 07:05:36 +01:00
Fix
This commit is contained in:
@@ -117,6 +117,19 @@ class TwitchService:
|
|||||||
await self.twitch.refresh_used_token()
|
await self.twitch.refresh_used_token()
|
||||||
logger.info("Token refreshed")
|
logger.info("Token refreshed")
|
||||||
|
|
||||||
|
async def stop(self, eventsub: EventSubWebhook):
|
||||||
|
self.failed = True
|
||||||
|
|
||||||
|
try:
|
||||||
|
await eventsub.stop()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
await self.twitch.close()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
async def run(self) -> NoReturn:
|
async def run(self) -> NoReturn:
|
||||||
eventsub = EventSubWebhook(
|
eventsub = EventSubWebhook(
|
||||||
callback_url=config.TWITCH_CALLBACK_URL,
|
callback_url=config.TWITCH_CALLBACK_URL,
|
||||||
@@ -139,10 +152,7 @@ class TwitchService:
|
|||||||
|
|
||||||
await self._check_token()
|
await self._check_token()
|
||||||
finally:
|
finally:
|
||||||
await eventsub.stop()
|
await self.stop(eventsub)
|
||||||
await self.twitch.close()
|
|
||||||
|
|
||||||
raise RuntimeError("Twitch service stopped")
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def start(cls):
|
async def start(cls):
|
||||||
|
|||||||
Reference in New Issue
Block a user