IrcAdmin: sleep a configured time before autojoin

this is to let any sort of autosend commands apply before joining
channels. for example, i have my bot set to turn on its hostserv cloak,
which was sometimes happening after channel joins, making its hostname
appear different in various channels. this solves that

as a total aside, this module is becoming really poorly named, i should
probably do something about that
This commit is contained in:
Brian S. Stephan 2013-01-13 11:45:01 -06:00
parent 64341b4fb2
commit 89847a6e58
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,7 @@ dbname = dr_botzo
[IrcAdmin]
autojoin = #bss
sleep = 30
automsg = nickserv identify foo
[Karma]

View File

@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from ConfigParser import NoOptionError
import time
from extlib import irclib
@ -56,6 +57,12 @@ class IrcAdmin(Module):
' '.join(command.split(' ')[1:]))
except NoOptionError: pass
# sleep for a bit before autojoining, if told to
try:
sleep = self.config.getint(self.__class__.__name__, 'sleep')
time.sleep(sleep)
except NoOptionError: pass
# join the specified channels
try:
autojoins = self.config.get(self.__class__.__name__, 'autojoin').split(',')