disabled jokes, changed timers
authorGeorgios Atheridis <atheridis@tutamail.com>
Mon, 19 Sep 2022 16:55:58 +0000 (16:55 +0000)
committerGeorgios Atheridis <atheridis@tutamail.com>
Mon, 19 Sep 2022 16:55:58 +0000 (16:55 +0000)
13 files changed:
.gitignore
requirements.txt
skgyorugo/auto_messages/.jokes.py [new file with mode: 0644]
skgyorugo/auto_messages/give_permission.py [new file with mode: 0644]
skgyorugo/auto_messages/hello3.py
skgyorugo/auto_messages/jokes.py [deleted file]
skgyorugo/auto_messages/latege.py
skgyorugo/auto_messages/queuehelp.py
skgyorugo/auto_messages/youtube.py
skgyorugo/commands/.joke.py [new file with mode: 0644]
skgyorugo/commands/accept_share.py [new file with mode: 0644]
skgyorugo/commands/joke.py [deleted file]
skgyorugo/commands/truth.py [new file with mode: 0644]

index 1e041e3b97fdb3ee5eadb0c90d969cbff24054c1..63a20b2d2507a315061988986db1f73705ec537b 100644 (file)
@@ -130,3 +130,4 @@ dmypy.json
 
 # sqlite databse
 *.db
+data/
index c8ec5aab9c52ea5431566f6c07500e57ad5f625e..fa45f51acecc3a0476e02e11dc87f99fdda49ee2 100644 (file)
@@ -1,3 +1,3 @@
-aptbot @ git+https://github.com/atheridis/aptbot.git@296c2b730b342268c7b92725d9954fe9eef1ec12
+aptbot @ git+https://github.com/atheridis/aptbot.git@84683f404540292f74892576149e18a3d9d8fb61
 python-dotenv==0.20.0
 urllib3==1.26.11
diff --git a/skgyorugo/auto_messages/.jokes.py b/skgyorugo/auto_messages/.jokes.py
new file mode 100644 (file)
index 0000000..a972958
--- /dev/null
@@ -0,0 +1,26 @@
+from aptbot.bot import Message, Commands, Bot
+import tools.smart_privmsg
+import urllib3
+import json
+
+COOLDOWN = 30 * 60
+END_TIME = 0
+
+header = {
+    "Accept": "application/json",
+    "User-Agent": "For my twitch bot [MurphyAI] on https://twitch.tv/ihaspeks",
+}
+
+
+def main(bot: Bot, message: Message):
+    http = urllib3.PoolManager()
+    r = http.request("GET", "https://icanhazdadjoke.com", headers=header)
+    if r.status != 200:
+        tools.smart_privmsg.send(bot, message, f"Couldn't get a joke Sadge")
+        return
+
+    data = json.loads(r.data.decode("utf-8"))
+    joke = data["joke"].replace("\r\n", " ")
+    tools.smart_privmsg.send(
+        bot, message, f"{joke} ||| Get more jokes by typing ?joke"
+    )
diff --git a/skgyorugo/auto_messages/give_permission.py b/skgyorugo/auto_messages/give_permission.py
new file mode 100644 (file)
index 0000000..f85bc9b
--- /dev/null
@@ -0,0 +1,15 @@
+from aptbot.bot import Message, Commands, Bot
+
+COOLDOWN = 60 * 60
+END_TIME = 0
+
+
+def main(bot: Bot, message: Message):
+    msg = "I collect data and occasionally post interesting statistics on peks' discord. "
+    msg += "The type of data you should expect to see is 'Chat frequency', 'Most used emotes', "
+    msg += "'Most active time and day', 'Reply graphs', etc. "
+    bot.send_privmsg(message.channel, msg)
+
+    msg = "If you are okay with these stats being publicly available with your name, "
+    msg += "please type ?accept_share to let me know. "
+    bot.send_privmsg(message.channel, msg)
index bbcee322c1785ab2451727ec28430c646b935e19..5f5a65d9c5701db0feb2fb19cd3f1bf8f9b96f36 100644 (file)
@@ -1,7 +1,7 @@
 from aptbot.bot import Message, Commands, Bot
 
 COOLDOWN = 30 * 60
-END_TIME = 2 * 60 * 60
+END_TIME = 1 * 60 * 60
 
 
 def main(bot: Bot, message: Message):
diff --git a/skgyorugo/auto_messages/jokes.py b/skgyorugo/auto_messages/jokes.py
deleted file mode 100644 (file)
index bbb4eb8..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-from aptbot.bot import Message, Commands, Bot
-import tools.smart_privmsg
-import urllib3
-import json
-
-COOLDOWN = 20 * 60
-END_TIME = 0
-
-header = {
-    "Accept": "application/json",
-    "User-Agent": "For my twitch bot [MurphyAI] on https://twitch.tv/ihaspeks",
-}
-
-
-def main(bot: Bot, message: Message):
-    http = urllib3.PoolManager()
-    r = http.request("GET", "https://icanhazdadjoke.com", headers=header)
-    if r.status != 200:
-        tools.smart_privmsg.send(bot, message, f"Couldn't get a joke Sadge")
-        return
-
-    data = json.loads(r.data.decode("utf-8"))
-    joke = data["joke"].replace("\r\n", " ")
-    tools.smart_privmsg.send(
-        bot, message, f"{joke} ||| Get more jokes by typing ?joke"
-    )
index 932f652db6a707ab1886cb5c64a1ba3653fdd4ed..52fbf158a49c16132553d9706e3e15fe0c2d584c 100644 (file)
@@ -3,8 +3,8 @@ import datetime as dt
 from datetime import datetime
 import tools.smart_start_stream_time
 
-COOLDOWN = 120
-END_TIME = COOLDOWN * 8
+COOLDOWN = 180
+END_TIME = COOLDOWN * 5
 
 STREAM_SCHEDULE = dt.time(17, 30)
 
index 473d5501f6ebfee5dced03197320a892017321bb..1159e97e6b41ab3bffa1c84c520c97e9619edd2e 100644 (file)
@@ -1,7 +1,7 @@
 from aptbot.bot import Message, Commands, Bot
 
-COOLDOWN = 8 * 60
-END_TIME = 2 * 60 * 60
+COOLDOWN = 30 * 60
+END_TIME = 2.5 * 60 * 60
 
 
 def main(bot: Bot, message: Message):
index 426f9fb51ac962e76a56b8192ef080d969d10a27..e71fa8730547651e4dc43dffd13dd655724475fa 100644 (file)
@@ -1,7 +1,7 @@
 from aptbot.bot import Message, Commands, Bot
 import yt_api.videos
 
-COOLDOWN = 25 * 60
+COOLDOWN = 30 * 60
 END_TIME = 0
 
 CHANNEL_ID = "UCQ7C3NUKY6TSkURdUdVoYFw"
diff --git a/skgyorugo/commands/.joke.py b/skgyorugo/commands/.joke.py
new file mode 100644 (file)
index 0000000..c01c1b2
--- /dev/null
@@ -0,0 +1,28 @@
+from aptbot.bot import Message, Commands, Bot
+import tools.smart_privmsg
+import urllib3
+import json
+
+PERMISSION = 99
+PREFIX = "?"
+DESCRIPTION = r""
+USER_COOLDOWN = 30
+GLOBAL_COOLDOWN = 30
+
+header = {
+    "Accept": "application/json",
+    "User-Agent": "For my twitch bot [MurphyAI] on https://twitch.tv/ihaspeks",
+}
+
+
+def main(bot: Bot, message: Message):
+    http = urllib3.PoolManager()
+    r = http.request("GET", "https://icanhazdadjoke.com", headers=header)
+    if r.status != 200:
+        tools.smart_privmsg.send(
+            bot, message, f"Couldn't get a joke Sadge", reply=message.tags["id"]
+        )
+        return
+
+    data = json.loads(r.data.decode("utf-8"))
+    tools.smart_privmsg.send(bot, message, f"{data['joke']}", reply=message.tags["id"])
diff --git a/skgyorugo/commands/accept_share.py b/skgyorugo/commands/accept_share.py
new file mode 100644 (file)
index 0000000..80a7f6e
--- /dev/null
@@ -0,0 +1,28 @@
+from aptbot.bot import Message, Commands, Bot
+import tools.smart_privmsg
+import os
+
+PERMISSION = 99
+PREFIX = "?"
+DESCRIPTION = ""
+USER_COOLDOWN = 30
+GLOBAL_COOLDOWN = 15
+
+
+COMMANDS_PATH = os.path.dirname(os.path.realpath(__file__))
+PATH = os.path.join(COMMANDS_PATH, "..")
+DATA_PATH = os.path.join(PATH, "data")
+
+
+def main(bot: Bot, message: Message):
+    accepted_path = os.path.join(DATA_PATH, "permission")
+    with open(accepted_path, "r") as f:
+        accepted = [user_id.rstrip() for user_id in f]
+    if message.tags["user-id"] in accepted:
+        tools.smart_privmsg.send(bot, message, "You have already given permission")
+        return
+
+    with open(accepted_path, "a") as f:
+        f.write(f"{message.tags['user-id']}\n")
+    tools.smart_privmsg.send(bot, message, "Thank you for giving permission")
+
diff --git a/skgyorugo/commands/joke.py b/skgyorugo/commands/joke.py
deleted file mode 100644 (file)
index c01c1b2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-from aptbot.bot import Message, Commands, Bot
-import tools.smart_privmsg
-import urllib3
-import json
-
-PERMISSION = 99
-PREFIX = "?"
-DESCRIPTION = r""
-USER_COOLDOWN = 30
-GLOBAL_COOLDOWN = 30
-
-header = {
-    "Accept": "application/json",
-    "User-Agent": "For my twitch bot [MurphyAI] on https://twitch.tv/ihaspeks",
-}
-
-
-def main(bot: Bot, message: Message):
-    http = urllib3.PoolManager()
-    r = http.request("GET", "https://icanhazdadjoke.com", headers=header)
-    if r.status != 200:
-        tools.smart_privmsg.send(
-            bot, message, f"Couldn't get a joke Sadge", reply=message.tags["id"]
-        )
-        return
-
-    data = json.loads(r.data.decode("utf-8"))
-    tools.smart_privmsg.send(bot, message, f"{data['joke']}", reply=message.tags["id"])
diff --git a/skgyorugo/commands/truth.py b/skgyorugo/commands/truth.py
new file mode 100644 (file)
index 0000000..ad38954
--- /dev/null
@@ -0,0 +1,24 @@
+from aptbot.bot import Message, Commands, Bot
+import tools.smart_privmsg
+import os
+import random
+
+PERMISSION = 99
+PREFIX = "?"
+DESCRIPTION = ""
+USER_COOLDOWN = 30
+GLOBAL_COOLDOWN = 15
+
+
+COMMANDS_PATH = os.path.dirname(os.path.realpath(__file__))
+PATH = os.path.join(COMMANDS_PATH, "..")
+DATA_PATH = os.path.join(PATH, "data")
+
+
+def main(bot: Bot, message: Message):
+    accepted_path = os.path.join(DATA_PATH, "jokes")
+    with open(accepted_path, "r") as f:
+        jokes = [user_id.rstrip() for user_id in f]
+    joke = random.choice(jokes)
+
+    tools.smart_privmsg.send(bot, message, f"{joke}", reply=message.tags["id"])