mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Made configuration file parsing more flexible.
This commit is contained in:
parent
a4ae47d7b8
commit
fb150d0e5b
15
src/bot.py
15
src/bot.py
@ -110,8 +110,19 @@ def processConfigFile(filename):
|
|||||||
for Class in privmsgs.standardPrivmsgModules:
|
for Class in privmsgs.standardPrivmsgModules:
|
||||||
irc.addCallback(Class())
|
irc.addCallback(Class())
|
||||||
world.startup = True
|
world.startup = True
|
||||||
lines = m.get_payload().splitlines()
|
text = m.get_payload()
|
||||||
(startup, after376) = filter(None,itersplit(lines,lambda s: not s))[:2]
|
while 1:
|
||||||
|
# Gotta remove all extra newlines.
|
||||||
|
newtext = text.replace('\n\n\n', '\n\n')
|
||||||
|
if newtext == text:
|
||||||
|
text = newtext
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
text = newtext
|
||||||
|
lines = text.splitlines()
|
||||||
|
print lines
|
||||||
|
print tuple(itersplit(lines, lambda s: not s, True))
|
||||||
|
(startup, after376) = tuple(itersplit(lines,lambda s: not s, True))
|
||||||
#debug.printf('startup: %r' % startup)
|
#debug.printf('startup: %r' % startup)
|
||||||
#debug.printf('after376: %r' % after376)
|
#debug.printf('after376: %r' % after376)
|
||||||
for line in filter(None, startup):
|
for line in filter(None, startup):
|
||||||
|
Loading…
Reference in New Issue
Block a user