all uncommitted changes
authorGeorgios Atheridis <georgios@atheridis.org>
Mon, 16 Jan 2023 03:15:47 +0000 (03:15 +0000)
committerGeorgios Atheridis <georgios@atheridis.org>
Mon, 16 Jan 2023 04:31:23 +0000 (04:31 +0000)
24 files changed:
skgyorugo/auto_messages/update_queue.py [new file with mode: 0644]
skgyorugo/commands/9ball.py [new file with mode: 0644]
skgyorugo/commands/Q.py
skgyorugo/commands/cleanqueue.py
skgyorugo/commands/forcehere.py
skgyorugo/commands/forcejoin.py
skgyorugo/commands/forceleave.py
skgyorugo/commands/forcenothere.py
skgyorugo/commands/here.py
skgyorugo/commands/join.py
skgyorugo/commands/leave.py
skgyorugo/commands/movedown.py
skgyorugo/commands/moveup.py
skgyorugo/commands/newteams.py
skgyorugo/commands/nothere.py
skgyorugo/commands/teams.py
skgyorugo/commands/teamsize.py
skgyorugo/main.py
skgyorugo/scripts/alwase.py
skgyorugo/scripts/chat.py [new file with mode: 0644]
skgyorugo/scripts/chatting.py
skgyorugo/scripts/clean_queue.py
skgyorugo/scripts/clip_server.py [new file with mode: 0644]
skgyorugo/scripts/crylaugh.py [new file with mode: 0644]

diff --git a/skgyorugo/auto_messages/update_queue.py b/skgyorugo/auto_messages/update_queue.py
new file mode 100644 (file)
index 0000000..e7da3f9
--- /dev/null
@@ -0,0 +1,41 @@
+import os
+import sqlite3
+import time
+from aptbot.bot import Message, Commands, Bot
+
+COOLDOWN = 60
+END_TIME = 0
+
+PATH = os.path.dirname(os.path.realpath(__file__))
+PATH = os.path.join(PATH, "..")
+
+
+def main(bot: Bot, message: Message):
+    conn = sqlite3.connect(os.path.join(PATH, "lol_data.db"))
+    c = conn.cursor()
+
+    tables = ["lol_queue", "ow"]
+
+    for table in tables:
+        c.execute(
+            f"""
+            UPDATE
+                {table}
+            SET
+                last_available = ?,
+                time_remaining = time_remaining - (? - last_available)
+            WHERE
+                available = 0;
+            """,
+            (
+                int(time.time()),
+                int(time.time()),
+            ),
+        )
+        c.execute(f"DELETE FROM {table} WHERE time_remaining < 0;")
+        if c.rowcount:
+            bot.send_privmsg(message.channel, f"/announce {c.rowcount} user{'s were' if c.rowcount > 1 else ' was'} just removed from {table if table != 'lol_queue' else 'lol'} queue.")
+
+    conn.commit()
+
+    conn.close()
diff --git a/skgyorugo/commands/9ball.py b/skgyorugo/commands/9ball.py
new file mode 100644 (file)
index 0000000..cc8d056
--- /dev/null
@@ -0,0 +1,48 @@
+from aptbot.bot import Message, Commands, Bot
+import os
+import tools.smart_privmsg
+import openai
+from openai.error import RateLimitError
+
+PERMISSION = 99
+PREFIX = "?"
+DESCRIPTION = ""
+USER_COOLDOWN = 40
+GLOBAL_COOLDOWN = 20
+
+openai.api_key = os.getenv("OPENAI_API")
+
+def main(bot: Bot, message: Message):
+    replied_message = message.tags.get("reply-parent-msg-body", None)
+    if replied_message:
+        msg = replied_message
+        replied_msg_id = message.tags["reply-parent-msg-id"]
+    else:
+        msg = " ".join(message.value.split(" ")[1:])
+        replied_msg_id = message.tags['id']
+
+
+    try:
+        response = openai.Completion.create(
+            # model="davinci:ft-personal:9ball-2022-12-05-08-37-36",
+            model="davinci:ft-personal-2022-12-06-10-03-18",
+            prompt=f"9ball is an 8ball. 9ball answers your questions reluctantly with sarcastic and unhelpful responses.\n{message.nick}: {msg}\n\n###\n\n",
+            temperature=1,
+            max_tokens=60,
+            top_p=0.3,
+            frequency_penalty=0.5,
+            presence_penalty=0.0,
+            stop=[" END"],
+        )
+    except RateLimitError:
+        tools.smart_privmsg.send_safe(bot, message.channel, "UwU Sowwy. The sevwews awe ovewloaded :( Twy again in a few minutes OwO", reply=replied_msg_id)
+
+    print(response)
+    if response:
+        msg = response["choices"][0]["text"]
+        # msg = msg[:msg.find("#")]
+    else:
+        msg = "Sadge nothing was returned"
+
+    tools.smart_privmsg.send_safe(bot, message.channel, msg, reply=replied_msg_id)
+    # bot.send_privmsg(message.channel, msg, reply=replied_msg_id)
index b7f4fd0313cdcee18d0bc50c5adcab777a4f1cf6..897c07e8e045cbd613b7f1b19872ddb1a666c22b 100644 (file)
@@ -5,6 +5,7 @@ import ttv_api.users
 import sqlite3
 import tools.smart_privmsg
 import random
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -17,8 +18,7 @@ GLOBAL_COOLDOWN = 15
 PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
-
-def main(bot: Bot, message: Message):
+def check_queue(bot: Bot, message: Message, table: str):
     if random.random() < 0.02:
         q = [
             "https://imgur.com/d5qGioI",
@@ -45,8 +45,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        SELECT twitch_id, priority_queue FROM lol_queue WHERE available = 1 ORDER BY position ASC;
+        f"""
+        SELECT twitch_id, priority_queue FROM {table} WHERE available = 1 ORDER BY position ASC;
         """
     )
     fetched = c.fetchall()
@@ -74,8 +74,8 @@ def main(bot: Bot, message: Message):
                 reply=message.tags["id"],
             )
     c.execute(
-        """
-        SELECT data FROM lol_queue_data WHERE name = 'queuesize';
+        f"""
+        SELECT data FROM {table}_data WHERE name = 'queuesize';
         """
     )
     try:
@@ -89,8 +89,8 @@ def main(bot: Bot, message: Message):
         )
 
     c.execute(
-        """
-        SELECT twitch_id FROM lol_queue WHERE available = 0 ORDER BY position ASC;
+        f"""
+        SELECT twitch_id FROM {table} WHERE available = 0 ORDER BY position ASC;
         """
     )
     fetched_unavailable = c.fetchall()
@@ -136,3 +136,30 @@ def main(bot: Bot, message: Message):
     )
 
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[0].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    check_queue(bot, message, scrub(args.get("--game", "lol_queue")))
index b94131befaf4f762c216a89bd22a13d515b6cd7c..ed3d4478e803df52b05e762a0646cf928bae6c77 100644 (file)
@@ -4,6 +4,7 @@ import logging
 import ttv_api.users
 import sqlite3
 import time
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -17,7 +18,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def clean_queue(bot: Bot, message: Message, table: str):
     twitch = ttv_api.users.get_users(user_logins=[message.channel])
     if not twitch:
         bot.send_privmsg(
@@ -31,12 +32,12 @@ def main(bot: Bot, message: Message):
     conn = sqlite3.connect(os.path.join(PATH, "lol_data.db"))
     c = conn.cursor()
 
-    c.execute("DELETE FROM lol_queue")
+    c.execute(f"DELETE FROM {table}")
     conn.commit()
 
     c.execute(
-        """
-        INSERT INTO lol_queue (
+        f"""
+        INSERT INTO {table} (
             "twitch_id",
             "position",
             "available",
@@ -61,3 +62,30 @@ def main(bot: Bot, message: Message):
     )
 
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[0].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    clean_queue(bot, message, scrub(args.get("--game", "lol_queue")))
index 6e7d2639c30241667540b51f17e3a4d0f4b043f7..0c27769022b7ca8a71932ab50d50fd0810ff09be 100644 (file)
@@ -1,5 +1,6 @@
 from aptbot.bot import Message, Commands, Bot
 import os
+import shlex
 import logging
 import ttv_api.users
 import sqlite3
@@ -17,7 +18,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def force_here(bot: Bot, message: Message, table: str):
     twitch_name = message.tags.get("reply-parent-user-login", None)
     if not twitch_name:
         twitch_name = message.value.split(" ")[1]
@@ -34,9 +35,9 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
+        f"""
         UPDATE
-            lol_queue
+            {table}
         SET
             position = (
                 CASE
@@ -44,7 +45,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     ) < (
@@ -54,7 +55,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY
@@ -63,7 +64,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -78,7 +79,7 @@ def main(bot: Bot, message: Message):
                 SELECT
                     max(position)
                 FROM
-                    lol_queue
+                    {table}
                 WHERE
                     priority_queue = 1
                     OR position <= (
@@ -88,7 +89,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY 
@@ -97,7 +98,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -110,9 +111,9 @@ def main(bot: Bot, message: Message):
     )
 
     c.execute(
-        """
+        f"""
         UPDATE
-            lol_queue
+            {table}
         SET 
             available = 1,
             priority_queue = (
@@ -121,7 +122,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     ) < (
@@ -131,7 +132,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY 
@@ -140,7 +141,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -156,7 +157,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     ) < (
@@ -166,7 +167,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY 
@@ -175,7 +176,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -185,7 +186,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             max(position)
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             priority_queue = 1
                             OR position <= (
@@ -195,7 +196,7 @@ def main(bot: Bot, message: Message):
                                     SELECT
                                         position
                                     FROM
-                                        lol_queue
+                                        {table}
                                     WHERE
                                         available = 1
                                     ORDER BY 
@@ -204,7 +205,7 @@ def main(bot: Bot, message: Message):
                                         SELECT
                                             data
                                         FROM
-                                            lol_queue_data
+                                            {table}_data
                                         WHERE
                                             name = 'queuesize'
                                     )
@@ -235,7 +236,7 @@ def main(bot: Bot, message: Message):
         conn.close()
         return
     conn.commit()
-    c.execute("DELETE FROM lol_queue WHERE time_remaining < 0;")
+    c.execute(f"DELETE FROM {table} WHERE time_remaining < 0;")
     if c.rowcount > 0:
         bot.send_privmsg(
             message.channel,
@@ -252,3 +253,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    force_here(bot, message, scrub(args.get("--game", "lol_queue")))
index 950138f81d33d86bea2a4ddea23fd2698dc9d8c2..df60a98ff728521c7b65575577a943c223daeb5e 100644 (file)
@@ -1,4 +1,5 @@
 from aptbot.bot import Message, Commands, Bot
+import shlex
 import os
 import logging
 import ttv_api.users
@@ -18,7 +19,7 @@ PATH = os.path.join(PATH, "..")
 DEFAULT_TIME_REMAINING = 60 * 60
 
 
-def main(bot: Bot, message: Message):
+def force_join(bot: Bot, message: Message, table: str):
     twitch_name = message.tags.get("reply-parent-user-login", None)
     if not twitch_name:
         twitch_name = message.value.split(" ")[1]
@@ -35,8 +36,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        SELECT position FROM lol_queue ORDER BY position DESC;
+        f"""
+        SELECT position FROM {table} ORDER BY position DESC;
         """
     )
 
@@ -47,8 +48,8 @@ def main(bot: Bot, message: Message):
 
     try:
         c.execute(
-            """
-            INSERT INTO lol_queue (
+            f"""
+            INSERT INTO {table} (
                 "twitch_id",
                 "position",
                 "available",
@@ -79,3 +80,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    force_join(bot, message, scrub(args.get("--game", "lol_queue")))
index 4ae7874d658b6365eb8d988340827d02b103c4cc..62cce6523f31b9e39692ff00ee284952f2ad3b7e 100644 (file)
@@ -3,6 +3,7 @@ import os
 import logging
 import ttv_api.users
 import sqlite3
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -16,7 +17,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def force_leave(bot: Bot, message: Message, table: str):
     twitch_name = message.tags.get("reply-parent-user-login", None)
     if not twitch_name:
         twitch_name = message.value.split(" ")[1]
@@ -33,8 +34,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        DELETE FROM lol_queue WHERE twitch_id = ?;
+        f"""
+        DELETE FROM {table} WHERE twitch_id = ?;
         """,
         (twitch_id,),
     )
@@ -53,3 +54,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    force_leave(bot, message, scrub(args.get("--game", "lol_queue")))
index 68edb695e5ac2bb2afea404e4ba343bb5a54a307..4944b664141e499fd6abcee63856502d2106b258 100644 (file)
@@ -4,6 +4,7 @@ import logging
 import ttv_api.users
 import sqlite3
 import time
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -17,7 +18,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def force_not_here(bot: Bot, message: Message, table: str):
     twitch_name = message.tags.get("reply-parent-user-login", None)
     if not twitch_name:
         twitch_name = message.value.split(" ")[1]
@@ -34,8 +35,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        UPDATE lol_queue SET available = 0, priority_queue = null, last_available = ? WHERE twitch_id = ?;
+        f"""
+        UPDATE {table} SET available = 0, priority_queue = null, last_available = ? WHERE twitch_id = ?;
         """,
         (
             int(time.time()),
@@ -57,3 +58,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    force_not_here(bot, message, scrub(args.get("--game", "lol_queue")))
index 31ceb1ab0aa33980ab8ace3f3a932217662eb06f..2002cb559b47d7aefb6d0395e98358fd7d37c718 100644 (file)
@@ -4,20 +4,21 @@ import logging
 import ttv_api.users
 import sqlite3
 import time
+import shlex
 
 logger = logging.getLogger(__name__)
 
 PERMISSION = 99
 PREFIX = "?"
 DESCRIPTION = r"Makes yourself available in the list."
-USER_COOLDOWN = 600
+USER_COOLDOWN = 10
 GLOBAL_COOLDOWN = 0
 
 PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def here(bot: Bot, message: Message, table: str):
     twitch = ttv_api.users.get_users(user_logins=[message.nick])
     if not twitch:
         bot.send_privmsg(
@@ -31,9 +32,9 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
+        f"""
         UPDATE
-            lol_queue
+            {table}
         SET
             position = (
                 CASE
@@ -41,7 +42,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     ) < (
@@ -51,7 +52,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY
@@ -60,7 +61,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -75,7 +76,7 @@ def main(bot: Bot, message: Message):
                 SELECT
                     max(position)
                 FROM
-                    lol_queue
+                    {table}
                 WHERE
                     priority_queue = 1
                     OR position <= (
@@ -85,7 +86,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY 
@@ -94,7 +95,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -107,9 +108,9 @@ def main(bot: Bot, message: Message):
     )
 
     c.execute(
-        """
+        f"""
         UPDATE
-            lol_queue
+            {table}
         SET 
             available = 1,
             priority_queue = (
@@ -118,7 +119,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     ) < (
@@ -128,7 +129,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY 
@@ -137,7 +138,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -153,7 +154,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     ) < (
@@ -163,7 +164,7 @@ def main(bot: Bot, message: Message):
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 available = 1
                             ORDER BY 
@@ -172,7 +173,7 @@ def main(bot: Bot, message: Message):
                                 SELECT
                                     data
                                 FROM
-                                    lol_queue_data
+                                    {table}_data
                                 WHERE
                                     name = 'queuesize'
                             )
@@ -182,7 +183,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             max(position)
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             priority_queue = 1
                             OR position <= (
@@ -192,7 +193,7 @@ def main(bot: Bot, message: Message):
                                     SELECT
                                         position
                                     FROM
-                                        lol_queue
+                                        {table}
                                     WHERE
                                         available = 1
                                     ORDER BY 
@@ -201,7 +202,7 @@ def main(bot: Bot, message: Message):
                                         SELECT
                                             data
                                         FROM
-                                            lol_queue_data
+                                            {table}_data
                                         WHERE
                                             name = 'queuesize'
                                     )
@@ -232,7 +233,7 @@ def main(bot: Bot, message: Message):
         conn.close()
         return
     conn.commit()
-    c.execute("DELETE FROM lol_queue WHERE time_remaining < 0;")
+    c.execute(f"DELETE FROM {table} WHERE time_remaining < 0;")
     if c.rowcount > 0:
         bot.send_privmsg(
             message.channel,
@@ -249,3 +250,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    here(bot, message, scrub(args.get("--game", "lol_queue")))
index 77ff305c092b199c15360e6d253e4bc8042883ce..8484186ba4dc51932cddc2b3bffea6e51dde2c9c 100644 (file)
@@ -3,13 +3,14 @@ import os
 import logging
 import ttv_api.users
 import sqlite3
+import shlex
 
 logger = logging.getLogger(__name__)
 
 PERMISSION = 99
 PREFIX = "?"
 DESCRIPTION = r"Joins the queue to play the game with the streamer."
-USER_COOLDOWN = 60
+USER_COOLDOWN = 10
 GLOBAL_COOLDOWN = 0
 
 PATH = os.path.dirname(os.path.realpath(__file__))
@@ -18,7 +19,7 @@ PATH = os.path.join(PATH, "..")
 DEFAULT_TIME_REMAINING = 60 * 60
 
 
-def main(bot: Bot, message: Message):
+def join(bot: Bot, message: Message, table: str):
     twitch = ttv_api.users.get_users(user_logins=[message.nick])
     if not twitch:
         bot.send_privmsg(
@@ -32,8 +33,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        SELECT position FROM lol_queue ORDER BY position DESC;
+        f"""
+        SELECT position FROM {table} ORDER BY position DESC;
         """
     )
 
@@ -44,8 +45,8 @@ def main(bot: Bot, message: Message):
 
     try:
         c.execute(
-            """
-            INSERT INTO lol_queue (
+            f"""
+            INSERT INTO {table} (
                 "twitch_id",
                 "position",
                 "available",
@@ -76,3 +77,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[0].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    join(bot, message, scrub(args.get("--game", "lol_queue")))
index 5cfcd32f27d06524ffad39b7f5ddb52d9ed3b04b..ac7fefece12efed4de1e50995b7b9232e1c1672b 100644 (file)
@@ -3,6 +3,7 @@ import os
 import logging
 import ttv_api.users
 import sqlite3
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -18,7 +19,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def leave(bot: Bot, message: Message, table: str):
     twitch = ttv_api.users.get_users(user_logins=[message.nick])
     if not twitch:
         bot.send_privmsg(
@@ -32,8 +33,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        DELETE FROM lol_queue WHERE twitch_id = ?;
+        f"""
+        DELETE FROM {table} WHERE twitch_id = ?;
         """,
         (twitch_id,),
     )
@@ -52,3 +53,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[0].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    leave(bot, message, scrub(args.get("--game", "lol_queue")))
index b6d8f711db64dcbec45012c891e9bddc26135f76..e64d3ed6774867e50ab372849d3f50406ce7caef 100644 (file)
@@ -3,6 +3,7 @@ import os
 import logging
 import ttv_api.users
 import sqlite3
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -16,7 +17,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def move_down(bot: Bot, message: Message, table: str):
     twitch_name = message.tags.get("reply-parent-user-login", None)
     if not twitch_name:
         twitch_name = message.value.split(" ")[1]
@@ -35,21 +36,21 @@ def main(bot: Bot, message: Message):
 
     try:
         c.execute(
-            """
+            f"""
             UPDATE
-                lol_queue
+                {table}
             SET
                 position = (
                     SELECT
                         min(position)
                     FROM
-                        lol_queue
+                        {table}
                     WHERE
                         position > (
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 twitch_id = ?
                         )
@@ -57,7 +58,7 @@ def main(bot: Bot, message: Message):
                     SELECT
                         position
                     FROM
-                        lol_queue
+                        {table}
                     WHERE
                         twitch_id = ?
                 ) - position
@@ -67,13 +68,13 @@ def main(bot: Bot, message: Message):
                         SELECT
                             min(position)
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             position > (
                                 SELECT
                                     position
                                 FROM
-                                    lol_queue
+                                    {table}
                                 WHERE
                                     twitch_id = ?
                             )
@@ -82,7 +83,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position 
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     )
@@ -101,3 +102,30 @@ def main(bot: Bot, message: Message):
         message.channel, "Successfully moved them down.", reply=message.tags["id"]
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    move_down(bot, message, scrub(args.get("--game", "lol_queue")))
index 5c062c79d0f6abd7fd4c94dcf4f1b699d29ddad2..42b7f12252fd98a1eae532d6795092d2e3818fd8 100644 (file)
@@ -3,6 +3,7 @@ import os
 import logging
 import ttv_api.users
 import sqlite3
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -16,7 +17,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def move_up(bot: Bot, message: Message, table: str):
     twitch_name = message.tags.get("reply-parent-user-login", None)
     if not twitch_name:
         twitch_name = message.value.split(" ")[1]
@@ -35,21 +36,21 @@ def main(bot: Bot, message: Message):
 
     try:
         c.execute(
-            """
+            f"""
             UPDATE
-                lol_queue
+                {table}
             SET
                 position = (
                     SELECT
                         max(position)
                     FROM
-                        lol_queue
+                        {table}
                     WHERE
                         position < (
                             SELECT
                                 position
                             FROM
-                                lol_queue
+                                {table}
                             WHERE
                                 twitch_id = ?
                         )
@@ -57,7 +58,7 @@ def main(bot: Bot, message: Message):
                     SELECT
                         position
                     FROM
-                        lol_queue
+                        {table}
                     WHERE
                         twitch_id = ?
                 ) - position
@@ -67,13 +68,13 @@ def main(bot: Bot, message: Message):
                         SELECT
                             max(position)
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             position < (
                                 SELECT
                                     position
                                 FROM
-                                    lol_queue
+                                    {table}
                                 WHERE
                                     twitch_id = ?
                             )
@@ -82,7 +83,7 @@ def main(bot: Bot, message: Message):
                         SELECT
                             position 
                         FROM
-                            lol_queue
+                            {table}
                         WHERE
                             twitch_id = ?
                     )
@@ -101,3 +102,30 @@ def main(bot: Bot, message: Message):
         message.channel, "Successfully moved them up.", reply=message.tags["id"]
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    move_up(bot, message, scrub(args.get("--game", "lol_queue")))
index cf70770c3ef7069d7045e0b7ffee8eceab37e726..a7a3c64d6a6af46f335e150eba22a06540b2f6e0 100644 (file)
@@ -4,6 +4,7 @@ import logging
 import ttv_api.users
 import sqlite3
 import random
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -17,13 +18,13 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def new_teams(bot: Bot, message: Message, table: str):
     conn = sqlite3.connect(os.path.join(PATH, "lol_data.db"))
     c = conn.cursor()
 
     c.execute(
-        """
-        SELECT twitch_id FROM lol_queue WHERE available = 1 ORDER BY position ASC;
+        f"""
+        SELECT twitch_id FROM {table} WHERE available = 1 ORDER BY position ASC;
         """
     )
     fetched = c.fetchall()
@@ -50,8 +51,8 @@ def main(bot: Bot, message: Message):
                 reply=message.tags["id"],
             )
     c.execute(
-        """
-        SELECT data FROM lol_queue_data WHERE name = 'queuesize';
+        f"""
+        SELECT data FROM {table}_data WHERE name = 'queuesize';
         """
     )
     fetched = c.fetchone()
@@ -77,10 +78,10 @@ def main(bot: Bot, message: Message):
     blue_team: list[ttv_api.users.User] = queue_users[: queue_size // 2]
     red_team: list[ttv_api.users.User] = queue_users[queue_size // 2 :]
 
-    c.execute("UPDATE lol_queue SET team = NULL")
-    sql = f"UPDATE lol_queue SET team = 0 WHERE twitch_id IN ({(', ?' * (queue_size // 2))[2:]})"
+    c.execute(f"UPDATE {table} SET team = NULL")
+    sql = f"UPDATE {table} SET team = 0 WHERE twitch_id IN ({(', ?' * (queue_size // 2))[2:]})"
     c.execute(sql, tuple(user.user_id for user in blue_team))
-    sql = f"UPDATE lol_queue SET team = 1 WHERE twitch_id IN ({(', ?' * (queue_size - queue_size // 2))[2:]})"
+    sql = f"UPDATE {table} SET team = 1 WHERE twitch_id IN ({(', ?' * (queue_size - queue_size // 2))[2:]})"
     c.execute(sql, tuple(user.user_id for user in red_team))
     conn.commit()
 
@@ -94,3 +95,30 @@ def main(bot: Bot, message: Message):
     )
 
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    new_teams(bot, message, scrub(args.get("--game", "lol_queue")))
index 2aca550a489556575cdc719b1b54554d478fc8d2..f82bb6890745dd2fd213e78a1cfdd96624abacab 100644 (file)
@@ -4,6 +4,7 @@ import logging
 import ttv_api.users
 import sqlite3
 import time
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -17,7 +18,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def not_here(bot: Bot, message: Message, table: str):
     twitch = ttv_api.users.get_users(user_logins=[message.nick])
     if not twitch:
         bot.send_privmsg(
@@ -31,8 +32,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        UPDATE lol_queue SET available = 0, priority_queue = null, last_available = ? WHERE twitch_id = ?;
+        f"""
+        UPDATE {table} SET available = 0, priority_queue = null, last_available = ? WHERE twitch_id = ?;
         """,
         (
             int(time.time()),
@@ -54,3 +55,30 @@ def main(bot: Bot, message: Message):
         reply=message.tags["id"],
     )
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    not_here(bot, message, scrub(args.get("--game", "lol_queue")))
index b7779344970843a4210796fbbb49bd4e6f581750..c35e65b0cc044dc6b0233484b8d8f41c3d487650 100644 (file)
@@ -4,6 +4,7 @@ import logging
 import ttv_api.users
 import sqlite3
 import tools.smart_privmsg
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -17,13 +18,13 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def teams(bot: Bot, message: Message, table: str):
     conn = sqlite3.connect(os.path.join(PATH, "lol_data.db"))
     c = conn.cursor()
 
     c.execute(
-        """
-        SELECT twitch_id, team FROM lol_queue WHERE team in (0, 1);
+        f"""
+        SELECT twitch_id, team FROM {table} WHERE team in (0, 1);
         """
     )
     fetched = c.fetchall()
@@ -81,3 +82,30 @@ def main(bot: Bot, message: Message):
     )
 
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[1].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    teams(bot, message, scrub(args.get("--game", "lol_queue")))
index f50277e6d071f6b07d16ee7c0c5fd2a4e55c7cb4..ce910c5730d7a25c78f3062821cd7873e1d47d8d 100644 (file)
@@ -2,6 +2,7 @@ from aptbot.bot import Message, Commands, Bot
 import os
 import logging
 import sqlite3
+import shlex
 
 logger = logging.getLogger(__name__)
 
@@ -15,7 +16,7 @@ PATH = os.path.dirname(os.path.realpath(__file__))
 PATH = os.path.join(PATH, "..")
 
 
-def main(bot: Bot, message: Message):
+def team_size(bot: Bot, message: Message, table: str):
     replied_message = message.tags.get("reply-parent-msg-body", None)
     if replied_message:
         queue_size = message.value.split(" ")[2]
@@ -35,8 +36,8 @@ def main(bot: Bot, message: Message):
     c = conn.cursor()
 
     c.execute(
-        """
-        REPLACE INTO lol_queue_data (name, data) VALUES ('queuesize', ?)
+        f"""
+        REPLACE INTO {table}_data (name, data) VALUES ('queuesize', ?)
         """,
         (queue_size,),
     )
@@ -49,3 +50,30 @@ def main(bot: Bot, message: Message):
     )
 
     conn.close()
+
+
+def parse(query):
+    query = query.split()
+    try:
+        if query[0].lower() in {"ow", "overwatch", "ow2", "overwatch2"}:
+            return {"--game": "ow"}
+    except:
+        pass
+    return {"--game": "lol_queue"}
+    d = dict()
+    for i in shlex.split(query):
+        try:
+            d[i.split('=')[0]] = i.split('=')[1]
+        except:
+            pass
+    return d
+
+
+def scrub(table_name):
+    return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+
+
+def main(bot: Bot, message: Message):
+    args = " ".join(message.value.split(" ")[1:])
+    args = parse(args)
+    team_size(bot, message, scrub(args.get("--game", "lol_queue")))
index e8f7dab41a12fd163b30fbf7edfcb8c081d2fab1..f4116e11d310a1a33517fa10089f3be10680b550 100644 (file)
@@ -11,6 +11,8 @@ import analyze_command
 import scripts.unit_converter
 import scripts.alwase
 import scripts.chatting
+import scripts.chat
+import scripts.crylaugh
 import database_manager
 import analyze_auto_message
 import time
@@ -26,6 +28,8 @@ reload(analyze_command)
 reload(scripts.unit_converter)
 reload(scripts.alwase)
 reload(scripts.chatting)
+reload(scripts.chat)
+reload(scripts.crylaugh)
 reload(database_manager)
 reload(analyze_auto_message)
 
@@ -132,5 +136,14 @@ def main(bot: Bot, message: Message):
         scripts.alwase.alwase(bot, message)
         scripts.chatting.chatting(bot, message)
         scripts.chatting.chatting_annoy(bot, message)
+        scripts.chat.chat(bot, message)
+        scripts.crylaugh.crylaugh(bot, message)
+
+    # if message.command == Commands.PART:
+    #     if message.nick in {'jelemar', 'flauenn', 'ihaspeks', 'blobin_wobin', 'officiallysp'}:
+    #         bot.send_privmsg(message.channel, f"/announce {message.nick} has left chat")
+    # if message.command == Commands.JOIN:
+    #     if message.nick in {'jelemar', 'flauenn', 'ihaspeks', 'blobin_wobin', 'officiallysp'}:
+    #         bot.send_privmsg(message.channel, f"/announce {message.nick} has joined chat")
 
     tools.raid.raid(bot, message)
index b44597c687a1ea2d17fd25298646a3987cacf55c..851672049b999ddf77db945ffa8015fd791e94f2 100644 (file)
@@ -11,9 +11,9 @@ def alwase(bot: Bot, message: Message):
     except KeyError:
         replied_msg_id = None
     msgs = [
-        "It's alwase Madge",
-        "Why don't you spell it alwase? Madge",
-        "Spell it alwase or peepoArriveBan",
+        "It's ALWASE gigaMadge",
+        "Why don't you spell it ALWASE ? gigaMadge",
+        "Spell it ALWASE or peepoArriveBan",
     ]
     msg = random.choice(msgs)
     tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)
diff --git a/skgyorugo/scripts/chat.py b/skgyorugo/scripts/chat.py
new file mode 100644 (file)
index 0000000..26dbd19
--- /dev/null
@@ -0,0 +1,38 @@
+from aptbot.bot import Message, Commands, Bot
+import tools.smart_privmsg
+import openai
+import os
+
+openai.api_key = os.getenv("OPENAI_API")
+
+def chat(bot: Bot, message: Message):
+    if not message.nick in {'skgyorugo', 'ihaspeks'}:
+        return
+    if not message.value.startswith("# "):
+        return
+
+    replied_message = message.tags.get("reply-parent-msg-body", None)
+    if replied_message:
+        msg = replied_message
+        replied_msg_id = message.tags["reply-parent-msg-id"]
+    else:
+        msg = " ".join(message.value.split(" ")[1:])
+        replied_msg_id = message.tags['id']
+
+    response = openai.Completion.create(
+        model="text-davinci-003",
+        prompt=msg,
+        temperature=1,
+        max_tokens=4000,
+        top_p=0.3,
+        frequency_penalty=0.5,
+        presence_penalty=0.5,
+    )
+
+    if response:
+        msg = response["choices"][0]["text"]
+        msg = msg.replace("\n", " ")
+    else:
+        msg = "Sadge nothing was returned"
+
+    tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)
index 104094ee81a253e6189704c0f81df70bffe5693a..0eb7224ff3f5425a73e0e8f60c138704655cbeb9 100644 (file)
@@ -24,4 +24,5 @@ def chatting_annoy(bot: Bot, message: Message):
     if message.nick.lower() not in nicks:
         return
     msg = "Chatting " + message.value
+    # msg = "Pepelaff " + message.value
     tools.smart_privmsg.send(bot, message, msg)
index 635b2b97efb366cc56ce27adf407618e3c5285e9..b86d7f76eb46e42fd50b034480c1cf1e260b5796 100644 (file)
@@ -36,6 +36,7 @@ def clean_queue():
     c = conn.cursor()
 
     c.execute("DELETE FROM lol_queue")
+    c.execute("DELETE FROM ow")
     conn.commit()
 
     c.execute(
@@ -56,6 +57,24 @@ def clean_queue():
             9999999,
         ),
     )
+    c.execute(
+        """
+        INSERT INTO ow (
+            "twitch_id",
+            "position",
+            "available",
+            "last_available",
+            "time_remaining"
+        ) VALUES (?, ?, ?, ?, ?);
+        """,
+        (
+            twitch_id,
+            0,
+            1,
+            None,
+            9999999,
+        ),
+    )
     conn.commit()
 
     conn.close()
diff --git a/skgyorugo/scripts/clip_server.py b/skgyorugo/scripts/clip_server.py
new file mode 100644 (file)
index 0000000..57d521b
--- /dev/null
@@ -0,0 +1,38 @@
+import os
+import random
+import sqlite3
+import logging
+from fastapi import FastAPI
+from fastapi.middleware.cors import CORSMiddleware
+
+app = FastAPI()
+
+origins = ["*"]
+
+app.add_middleware(
+    CORSMiddleware,
+    allow_origins=origins,
+    allow_credentials=True,
+    allow_methods=["*"],
+    allow_headers=["*"],
+)
+
+@app.get("/clip")
+async def root():
+    clips = [
+        "https://clips-media-assets2.twitch.tv/AT-cm%7CMGyhlrJbd3gtietAgP63LA.mp4",
+        "https://clips-media-assets2.twitch.tv/WATxq6O_aQBU1qrftJJ0fQ/AT-cm%7CWATxq6O_aQBU1qrftJJ0fQ.mp4",
+    ]
+    return random.choice(clips)
+
+# logger = logging.getLogger(__name__)
+
+# PATH = os.path.dirname(os.path.realpath(__file__))
+# logger.debug(f"PATH set to: {PATH}")
+
+
+# def do_command(bot: Bot, message: Message, command_modules: dict):
+#     db_name_database = "database.db"
+#     conn = sqlite3.connect(os.path.join(PATH, db_name_database))
+#     c = conn.cursor()
+#     logger.info(f"connected to database {db_name_database}")
diff --git a/skgyorugo/scripts/crylaugh.py b/skgyorugo/scripts/crylaugh.py
new file mode 100644 (file)
index 0000000..a6e2658
--- /dev/null
@@ -0,0 +1,16 @@
+from aptbot.bot import Bot, Message, Commands
+import tools.smart_privmsg
+import random
+
+
+def crylaugh(bot: Bot, message: Message):
+    if random.random() > 0.05:
+        return
+    if "😂" not in message.value:
+        return
+    try:
+        replied_msg_id = message.tags["id"]
+    except KeyError:
+        replied_msg_id = None
+    msg = "Oh ðŸ˜‚ look ðŸ˜‚ at ðŸ˜‚ me ðŸ˜‚ I ðŸ˜‚ use ðŸ˜‚ this ðŸ˜‚ funny ðŸ˜‚ emoji ðŸ˜‚ hahahaha ðŸ˜‚😂😂😂😂 lit ðŸ’¯ ðŸ‘Œ"
+    tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)