From 6d185593b351a9c229af10d8d35e413039a516a7 Mon Sep 17 00:00:00 2001 From: Matt Arnold Date: Tue, 22 Feb 2022 14:32:06 -0500 Subject: Add fun stuff to the sample, and error handling at protocol --- client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'client.py') diff --git a/client.py b/client.py index bbd0649..a3ce217 100644 --- a/client.py +++ b/client.py @@ -16,7 +16,7 @@ with open('config.json') as f: jld = f.read() config = json.loads(jld) -botpass = "unused.factor.this.out" + # Need to pass the IRCBot class a socket the reason it doesn't do this itself is # so you can set up TLS or not as you need it @@ -39,6 +39,10 @@ def generate_response(person, message): return "Greetings Master" elif msg.lower() == "hello": return "Greetings Human!" + elif "Ground Control to Major Tom" in msg: + return "Put your helmet on!" + elif "Ziggy Stardust" in msg: + return "Looks good in leather pants" else: return None @@ -56,5 +60,8 @@ while True: msg = oursock.recv(4096) print(msg) sys.exit(0) + except IRCError as e: + printred(e) + sys.exit(1) -- cgit 1.4.1-2-gfad0