]> jfr.im git - erebus.git/commitdiff
add ctcp responses for ping, clientinfo
authorJohn Runyon <redacted>
Wed, 29 Nov 2023 23:33:22 +0000 (16:33 -0700)
committerJohn Runyon <redacted>
Wed, 29 Nov 2023 23:33:22 +0000 (16:33 -0700)
bot.py

diff --git a/bot.py b/bot.py
index 813151b68650a837cb63c14ecd606273ac59d821..681400febb9ffbcdd7748516f56541e401508552 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -328,12 +328,20 @@ class Bot(object):
                if len(msg) == 0:
                        return
 
-               if target == self.nick:
-                       if msg.startswith("\001"): #ctcp
-                               msg = msg.strip("\001")
-                               if msg == "VERSION":
-                                       self.msg(user, "\001VERSION Erebus v%d.%d - http://jfr.im/git/erebus.git" % (self.parent.APIVERSION, self.parent.RELEASE))
-                               return
+               if target == self.nick and msg.startswith("\001"): #ctcp
+                       msg = msg.strip("\001")
+                       if msg:
+                               pieces = msg.split()
+                               if pieces[0] == "CLIENTINFO":
+                                       self.msg(user, "\001CLIENTINFO VERSION PING\001")
+                               elif pieces[0] == "VERSION":
+                                       self.msg(user, "\001VERSION Erebus v%d.%d - http://jfr.im/git/erebus.git\001" % (self.parent.APIVERSION, self.parent.RELEASE))
+                               elif pieces[0] == "PING":
+                                       if len(pieces) > 1:
+                                               self.msg(user, "\001PING %s\001" % (' '.join(pieces[1:])))
+                                       else:
+                                               self.msg(user, "\001PING\001")
+                       return
 
                triggerused = msg.startswith(self.parent.trigger)
                if triggerused: msg = msg[len(self.parent.trigger):]