From 56f4d021593a331a1ddbace84e844f4493e750b7 Mon Sep 17 00:00:00 2001
From: dnns01 <git@dnns01.de>
Date: Sun, 30 May 2021 22:41:08 +0200
Subject: [PATCH] Use event_loop for info loop

---
 .idea/haugebot.iml          | 2 +-
 .idea/misc.xml              | 2 +-
 haugebot_twitch/haugebot.py | 7 ++++---
 haugebot_twitch/info_cog.py | 4 ++++
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.idea/haugebot.iml b/.idea/haugebot.iml
index 6190690..13a13f0 100644
--- a/.idea/haugebot.iml
+++ b/.idea/haugebot.iml
@@ -16,7 +16,7 @@
     <content url="file://$MODULE_DIR$">
       <excludeFolder url="file://$MODULE_DIR$/venv" />
     </content>
-    <orderEntry type="inheritedJdk" />
+    <orderEntry type="jdk" jdkName="Python 3.9 (haugebot) (2)" jdkType="Python SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>
   <component name="TemplatesService">
diff --git a/.idea/misc.xml b/.idea/misc.xml
index e32c50e..60d2706 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
   <component name="JavaScriptSettings">
     <option name="languageLevel" value="ES6" />
   </component>
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (haugebot)" project-jdk-type="Python SDK" />
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (haugebot) (2)" project-jdk-type="Python SDK" />
 </project>
\ No newline at end of file
diff --git a/haugebot_twitch/haugebot.py b/haugebot_twitch/haugebot.py
index 8998cc9..b3f71dd 100644
--- a/haugebot_twitch/haugebot.py
+++ b/haugebot_twitch/haugebot.py
@@ -34,11 +34,11 @@ class HaugeBot(commands.Bot, ABC):
         super().__init__(irc_token=IRC_TOKEN, prefix=PREFIX, nick=NICK, initial_channels=[CHANNEL], client_id=CLIENT_ID,
                          client_secret=CLIENT_SECRET)
         self.info_cog = InfoCog(self)
-        self.pipi_cog = PipiCog(self)
+        # self.pipi_cog = PipiCog(self)
         self.add_cog(GiveawayCog(self))
         self.add_cog(VoteCog(self))
         self.add_cog(self.info_cog)
-        self.add_cog(self.pipi_cog)
+        # self.add_cog(self.pipi_cog)
 
     @staticmethod
     async def send_me(ctx, content, color):
@@ -54,8 +54,9 @@ class HaugeBot(commands.Bot, ABC):
     async def event_ready(self):
         print('Logged in')
 
+        self.info_cog.start_info_loop()
         asyncio.create_task(self.info_cog.info_loop())
-        asyncio.create_task(self.pipi_cog.pipimeter_loop())
+        # asyncio.create_task(self.pipi_cog.pipimeter_loop())
 
     @staticmethod
     def get_percentage(part, total):
diff --git a/haugebot_twitch/info_cog.py b/haugebot_twitch/info_cog.py
index c3d9233..b638bbc 100644
--- a/haugebot_twitch/info_cog.py
+++ b/haugebot_twitch/info_cog.py
@@ -11,6 +11,10 @@ class InfoCog:
     def __init__(self, bot):
         self.bot = bot
 
+    def start_info_loop(self):
+        loop = asyncio.get_event_loop()
+        loop.create_task(self.info_loop())
+
     async def info_loop(self):
         while True:
             sleep_duration = config.get_int("WusstestDuSchonLoop")
-- 
GitLab