3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00

Actually implement 'nick', 'ident', and 'loglevel' config options

This commit is contained in:
James Lu 2015-07-07 12:14:55 -07:00
parent 087a4e7e5c
commit cfc840ebb3
2 changed files with 14 additions and 2 deletions

12
log.py
View File

@ -1,5 +1,15 @@
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s [%(levelname)s] %(message)s')
import sys
from conf import conf
level = conf['bot']['loglevel'].upper()
try:
level = getattr(logging, level)
except AttributeError:
print('ERROR: Invalid log level %r specified in config.' % level)
sys.exit(3)
logging.basicConfig(level=level, format='%(asctime)s [%(levelname)s] %(message)s')
global log
log = logging.getLogger()

View File

@ -142,7 +142,9 @@ def connect(irc):
f('SERVER {host} {Pass} 0 {sid} :PyLink Service'.format(host=host,
Pass=irc.serverdata["sendpass"], sid=irc.sid))
f(':%s BURST %s' % (irc.sid, ts))
irc.pseudoclient = spawnClient(irc, 'PyLink', 'pylink', host, modes=set([("+o", None)]))
nick = conf['bot'].get('nick') or 'PyLink'
ident = conf['bot'].get('ident') or 'pylink'
irc.pseudoclient = spawnClient(irc, nick, ident, host, modes={("+o", None)})
f(':%s ENDBURST' % (irc.sid))
for chan in irc.serverdata['channels']:
joinClient(irc, irc.pseudoclient.uid, chan)