]> jfr.im git - erebus.git/commitdiff
sockets - use channel's bot if on channel
authorJohn Runyon <redacted>
Sun, 10 Mar 2024 13:00:34 +0000 (07:00 -0600)
committerJohn Runyon <redacted>
Sun, 10 Mar 2024 13:00:34 +0000 (07:00 -0600)
modules/sockets.py

index 060057b5f182829b9a351964144443416cf3b998..cf79e70d36a912fc8e100e6936062cef8ec9e1a0 100644 (file)
@@ -57,7 +57,10 @@ def gotParent(parent):
                                return lines
 
                        def parse(self, line):
-                               bot = lib.parent.randbot()
+                               try:
+                                       bot = lib.parent.channel(self.chan).bot
+                               except AttributeError: # <class 'AttributeError'> 'NoneType' object has no attribute 'bot'
+                                       bot = lib.parent.randbot()
                                maxlen = bot.maxmsglen() - len("PRIVMSG  :") - len(self.chan)
                                while len(line) > maxlen:
                                        cutat = line.rfind(' ', 0, maxlen)