summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--notcqst.py36
1 files changed, 29 insertions, 7 deletions
diff --git a/notcqst.py b/notcqst.py
index 40f04b3..b5cc1b7 100644
--- a/notcqst.py
+++ b/notcqst.py
@@ -1,6 +1,8 @@
import socket
+import random
from yt_dlp import YoutubeDL
+
def check_youtube():
if "https://youtube.com" in text_str or "https://www.youtube.com" in text_str:
split_str = text_str.split('##tech-tangents :')
@@ -16,16 +18,36 @@ def check_youtube():
else:
return 0
-
-def command_choose():
-
+
+def command_choose(split_spaces):
+ print(split_spaces)
+ arr_hack = len(split_spaces)
+ arr_hack -= 2
+ choices = []
+ for x in range(arr_hack):
+ choices.append(split_spaces[x+2])
+ print(choices)
+ decision = random.choice(choices)
+ irc.send((bytes("PRIVMSG " + channel + " :" + decision + "\r\n", 'utf-8')))
+
+
+def command_hello():
+ irc.send((bytes("PRIVMSG " + channel + " :" + "Hello, " + "\r\n", 'utf-8')))
+
+
+def unknown_command():
+ irc.send((bytes("PRIVMSG " + channel + " :" + "Sorry I don't understand." + "\r\n", 'utf-8')))
+
def command_flag():
- if "n!" in text_str:
- split_text = text.split(':n!')
- command = split_text[1].strip()
+ if ":n!" in text_str:
+ split_text = text_str.split(':n!')
+ split_spaces = split_text[1].split(' ')
+ command = split_spaces[1].strip()
match command:
- case "choose": command_choose()
+ case "choose": command_choose(split_spaces)
+ case "hello": command_hello()
+ case _: unknown_command()
def parse_cmd():