3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

Irc: remove internal use of 'conf' and 'botdata' (#273)

This commit is contained in:
James Lu 2017-03-05 00:00:11 -08:00
parent 7f070448b7
commit 4284853a4a

View File

@ -23,7 +23,7 @@ try:
except ImportError: except ImportError:
raise ImportError("PyLink requires ircmatch to function; please install it and try again.") raise ImportError("PyLink requires ircmatch to function; please install it and try again.")
from . import world, utils, structures, __version__ from . import world, utils, structures, conf, __version__
from .log import * from .log import *
### Exceptions ### Exceptions
@ -78,7 +78,7 @@ class Irc(utils.DeprecatedAttributesObject):
Initializes any channel loggers defined for the current network. Initializes any channel loggers defined for the current network.
""" """
try: try:
channels = self.conf['logging']['channels'][self.name] channels = conf.conf['logging']['channels'][self.name]
except KeyError: # Not set up; just ignore. except KeyError: # Not set up; just ignore.
return return
@ -103,7 +103,7 @@ class Irc(utils.DeprecatedAttributesObject):
(Re)sets an IRC object to its default state. This should be called when (Re)sets an IRC object to its default state. This should be called when
an IRC object is first created, and on every reconnection to a network. an IRC object is first created, and on every reconnection to a network.
""" """
self.botdata = self.conf['bot'] self.botdata = conf.conf['bot']
self.pingfreq = self.serverdata.get('pingfreq') or 90 self.pingfreq = self.serverdata.get('pingfreq') or 90
self.pingtimeout = self.pingfreq * 3 self.pingtimeout = self.pingfreq * 3
@ -303,7 +303,7 @@ class Irc(utils.DeprecatedAttributesObject):
self.servers[self.sid] = IrcServer(None, host, internal=True, self.servers[self.sid] = IrcServer(None, host, internal=True,
desc=self.serverdata.get('serverdesc') desc=self.serverdata.get('serverdesc')
or self.botdata['serverdesc']) or conf.conf['bot']['serverdesc'])
log.info('(%s) Starting ping schedulers....', self.name) log.info('(%s) Starting ping schedulers....', self.name)
self.schedulePing() self.schedulePing()