3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-25 09:50:39 +01:00

handlers, fantasy: migrate away from irc.botdata (#273)

This commit is contained in:
James Lu 2017-03-05 00:10:33 -08:00
parent d318fbac77
commit e8bf1d08bc
2 changed files with 5 additions and 5 deletions

View File

@ -75,7 +75,7 @@ def handle_whois(irc, source, command, args):
# 3) +H is set, but whois_use_hideoper is disabled in config # 3) +H is set, but whois_use_hideoper is disabled in config
isHideOper = (irc.umodes.get('hideoper'), None) in user.modes isHideOper = (irc.umodes.get('hideoper'), None) in user.modes
if (not isHideOper) or (isHideOper and sourceisOper) or \ if (not isHideOper) or (isHideOper and sourceisOper) or \
(isHideOper and not irc.botdata.get('whois_use_hideoper', True)): (isHideOper and not conf.conf['bot'].get('whois_use_hideoper', True)):
# Let's be gramatically correct. (If the opertype starts with a vowel, # Let's be gramatically correct. (If the opertype starts with a vowel,
# write "an Operator" instead of "a Operator") # write "an Operator" instead of "a Operator")
n = 'n' if user.opertype[0].lower() in 'aeiou' else '' n = 'n' if user.opertype[0].lower() in 'aeiou' else ''

View File

@ -1,5 +1,5 @@
# fantasy.py: Adds FANTASY command support, to allow calling commands in channels # fantasy.py: Adds FANTASY command support, to allow calling commands in channels
from pylinkirc import utils, world from pylinkirc import utils, world, conf
from pylinkirc.log import log from pylinkirc.log import log
def handle_fantasy(irc, source, command, args): def handle_fantasy(irc, source, command, args):
@ -9,7 +9,7 @@ def handle_fantasy(irc, source, command, args):
# Break if the IRC network isn't ready. # Break if the IRC network isn't ready.
return return
respondtonick = irc.botdata.get("respondtonick") respondtonick = conf.conf['bot'].get("respondtonick")
channel = args['target'] channel = args['target']
orig_text = args['text'] orig_text = args['text']
@ -32,8 +32,8 @@ def handle_fantasy(irc, source, command, args):
# Try to look up a prefix specific for this bot in # Try to look up a prefix specific for this bot in
# bot: prefixes: <botname>, falling back to the default prefix if not # bot: prefixes: <botname>, falling back to the default prefix if not
# specified. # specified.
prefixes = [irc.botdata.get('prefixes', {}).get(botname) or prefixes = [conf.conf['bot'].get('prefixes', {}).get(botname) or
irc.botdata.get('prefix')] conf.conf['bot'].get('prefix')]
# If responding to nick is enabled, add variations of the current nick # If responding to nick is enabled, add variations of the current nick
# to the prefix list: "<nick>," and "<nick>:" # to the prefix list: "<nick>," and "<nick>:"