From ba7820170c54321881add34265c099d6dbe6be5c Mon Sep 17 00:00:00 2001 From: Kepka Ludovic Date: Fri, 29 Aug 2025 10:27:53 +0200 Subject: [PATCH] =?UTF-8?q?J'arrive=20=C3=A0=20avoir=20les=20info=20de=20l?= =?UTF-8?q?ive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twitchbot/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/twitchbot/__init__.py b/twitchbot/__init__.py index 7103c38..061d8b8 100644 --- a/twitchbot/__init__.py +++ b/twitchbot/__init__.py @@ -16,6 +16,8 @@ async def _onReady(ready_event: EventData): logging.info('Bot Twitch prĂȘt') with webapp.app_context(): await ready_event.chat.join_room(ConfigurationHelper().getValue('twitch_channel')) + asyncio.get_event_loop().create_task(twitchBot._checkOnlineStreamers()) + async def _onMessage(msg: ChatMessage): logging.info(f'Dans {msg.room.name}, {msg.user.name} a dit : {msg.text}') @@ -48,6 +50,17 @@ class TwitchBot() : else: logging.info("Twitch n'est pas configurĂ©") + async def _checkOnlineStreamers(self): + # pas bon faudrait faire un truc mieux + while True : + async for stream in self.twitch.get_streams(user_login=['chainesteve']): + print(stream.user_id) + # toutes les 5 minutes + await asyncio.sleep(5*60) + + + + def begin(self): asyncio.run(self._connect())