move channel autojoin into a separate section, load it differently
This commit is contained in:
parent
9365176bbe
commit
85046a8277
|
@ -1,7 +1,6 @@
|
||||||
[IRC]
|
[IRC]
|
||||||
server = irc.foonetic.net
|
server = irc.foonetic.net
|
||||||
port = 6667
|
port = 6667
|
||||||
channel = #bss
|
|
||||||
nick = dr_devzo
|
nick = dr_devzo
|
||||||
name = dr. devzo
|
name = dr. devzo
|
||||||
|
|
||||||
|
@ -11,3 +10,6 @@ debug = true
|
||||||
|
|
||||||
[admin]
|
[admin]
|
||||||
userhost = bss@ayu.incorporeal.org
|
userhost = bss@ayu.incorporeal.org
|
||||||
|
|
||||||
|
[channels]
|
||||||
|
autojoin = #bss
|
||||||
|
|
13
dr.botzo.py
13
dr.botzo.py
|
@ -18,10 +18,14 @@ def on_connect(connection, event):
|
||||||
connection.mode(nick, usermode)
|
connection.mode(nick, usermode)
|
||||||
except NoOptionError: pass
|
except NoOptionError: pass
|
||||||
|
|
||||||
# join the specified channel
|
# join the specified channels
|
||||||
# TODO: support multiple
|
try:
|
||||||
if irclib.is_channel(channel):
|
autojoins = config.get('channels', 'autojoin').split(',')
|
||||||
connection.join(channel)
|
for channel in autojoins:
|
||||||
|
if irclib.is_channel(channel):
|
||||||
|
connection.join(channel)
|
||||||
|
except NoOptionError: pass
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# on_privmsg
|
# on_privmsg
|
||||||
# private messages to the bot
|
# private messages to the bot
|
||||||
|
@ -59,7 +63,6 @@ try:
|
||||||
# load connection info
|
# load connection info
|
||||||
server = config.get('IRC', 'server')
|
server = config.get('IRC', 'server')
|
||||||
port = config.getint('IRC', 'port')
|
port = config.getint('IRC', 'port')
|
||||||
channel = config.get('IRC', 'channel')
|
|
||||||
nick = config.get('IRC', 'nick')
|
nick = config.get('IRC', 'nick')
|
||||||
ircname = config.get('IRC', 'name')
|
ircname = config.get('IRC', 'name')
|
||||||
except NoSectionError as e:
|
except NoSectionError as e:
|
||||||
|
|
Loading…
Reference in New Issue