]> jfr.im git - erebus.git/commitdiff
core/bot - add config flag to wait for hidden host (num 396) before joining channels
authorJohn Runyon <redacted>
Wed, 14 Jun 2023 12:17:05 +0000 (06:17 -0600)
committerJohn Runyon <redacted>
Wed, 14 Jun 2023 12:17:05 +0000 (06:17 -0600)
bot.py

diff --git a/bot.py b/bot.py
index 08c812872cb731372383f5480db50e85d7b8eaf8..a42c9ab9235c9292c33e21c15124ee21acc6fb45 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -106,6 +106,7 @@ class Bot(object):
                        'PRIVMSG': self._gotprivmsg,
                        '353': self._got353, #NAMES
                        '354': self._got354, #WHO
+                       '396': self._gotHiddenHost, # hidden host has been set
                        '433': self._got433, #nick in use
                        'JOIN': self._gotjoin,
                        'PART': self._gotpart,
@@ -159,8 +160,13 @@ class Bot(object):
                self.conn.send("MODE %s +x" % (pieces[2]))
                if self.authname is not None and self.authpass is not None:
                        self.conn.send("AUTH %s %s" % (self.authname, self.authpass))
-               for c in self.chans:
-                       self.join(c.name)
+               if not self.parent.cfg.getboolean('erebus', 'wait_for_hidden_host'):
+                       for c in self.chans:
+                               self.join(c.name)
+       def _gotHiddenHost(self, pieces):
+               if self.parent.cfg.getboolean('erebus', 'wait_for_hidden_host'):
+                       for c in self.chans:
+                               self.join(c.name)
        def _gotprivmsg(self, pieces):
                nick = pieces[0].split('!')[0][1:]
                user = self.parent.user(nick)