summary refs log tree commit diff
path: root/IRC.py
diff options
context:
space:
mode:
authorMatt Arnold2022-02-22 14:32:06 -0500
committerMatt Arnold2022-02-22 14:32:06 -0500
commit6d185593b351a9c229af10d8d35e413039a516a7 (patch)
treee7a2ed91df0252c1c9f0134c100157fa469f598b /IRC.py
parent66f447b69637160f894d04f35eac4ee4596441c9 (diff)
Add fun stuff to the sample, and error handling at protocol
Diffstat (limited to 'IRC.py')
-rw-r--r--IRC.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/IRC.py b/IRC.py
index a67e65d..90ef1fa 100644
--- a/IRC.py
+++ b/IRC.py
@@ -92,14 +92,17 @@ class IRCBot:
         self.send_cmd(usermsg)
         nickmsg = irctokens.build("NICK", [botnick])
         self.send_cmd(nickmsg)
+    
     def get_response(self):
         # Get the response
         resp = self.irc.recv(4096).decode("UTF-8")
         msg = parsemsg(resp)
         nwmsg = irctokens.tokenise(resp)
-        
+        printred(nwmsg.command)
         if nwmsg.command == "001":
             self.on_welcome(nwmsg.params)
+        if nwmsg.command == "ERROR":
+            raise IRCError(str(nwmsg.params[0]))
         if nwmsg.command == 'PING':
             print('Sending pong')
             self.irc.send(