mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
fantasy: make responding to nick a per-service configuration option (#343)
This also renames the "respondtonick" option to "respond_to_nick", deprecating the former name.
This commit is contained in:
parent
f497044777
commit
ce0c84266e
@ -24,12 +24,14 @@ pylink:
|
|||||||
# errors.
|
# errors.
|
||||||
prefix: "&"
|
prefix: "&"
|
||||||
|
|
||||||
# Whether service bots will respond to commands prefixes with their nick.
|
# Determines whether PyLink service bots will respond to commands prefixed with their nick
|
||||||
respondtonick: true
|
# (requires the fantasy plugin). Prior to PyLink 1.2, this option was named "respondtonick";
|
||||||
|
# it was renamed for consistency. This defaults to false.
|
||||||
|
#respond_to_nick: true
|
||||||
|
|
||||||
# Custom prefixes for other service bots if they are loaded. Note: this is deprecated
|
# Custom prefixes for other service bots if they are loaded. Note: this is deprecated
|
||||||
# since PyLink 1.2 in favour of adding prefixes into each plugin's configuration block
|
# since PyLink 1.2 in favour of adding prefixes into each plugin's configuration block
|
||||||
# itself (see the "prefix:" option in the "games:" block in this case).
|
# itself (see the "prefix:" option in the "games:" block for this example).
|
||||||
#prefixes:
|
#prefixes:
|
||||||
# games: "@"
|
# games: "@"
|
||||||
|
|
||||||
@ -674,9 +676,15 @@ automode:
|
|||||||
#spawn_service: true
|
#spawn_service: true
|
||||||
|
|
||||||
# Defines a fantasy prefix for the Automode bot (requires spawn_services to be set and the
|
# Defines a fantasy prefix for the Automode bot (requires spawn_services to be set and the
|
||||||
# fantasy plugin to be loaded).
|
# fantasy plugin to be loaded). This overrides the "prefix" option in the "pylink:" config
|
||||||
|
# block.
|
||||||
prefix: "@"
|
prefix: "@"
|
||||||
|
|
||||||
|
# Determines whether this bot should respond to its nick (requires spawn_services to be set and the
|
||||||
|
# fantasy plugin to be loaded). This overrides the "respond_to_nick" option in the "pylink:" config
|
||||||
|
# block.
|
||||||
|
#respond_to_nick: true
|
||||||
|
|
||||||
games:
|
games:
|
||||||
# Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined.
|
# Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined.
|
||||||
nick: Games
|
nick: Games
|
||||||
|
@ -9,8 +9,6 @@ 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 = conf.conf['bot'].get("respondtonick")
|
|
||||||
|
|
||||||
channel = args['target']
|
channel = args['target']
|
||||||
orig_text = args['text']
|
orig_text = args['text']
|
||||||
|
|
||||||
@ -25,6 +23,14 @@ def handle_fantasy(irc, source, command, args):
|
|||||||
for botname, sbot in world.services.copy().items():
|
for botname, sbot in world.services.copy().items():
|
||||||
if botname not in world.services: # Bot was removed during iteration
|
if botname not in world.services: # Bot was removed during iteration
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Check respond to nick options in this order:
|
||||||
|
# 1) The service specific "respond_to_nick" option
|
||||||
|
# 2) The global "pylink::respond_to_nick" option
|
||||||
|
# 3) The (deprecated) global "bot::respondtonick" option.
|
||||||
|
respondtonick = conf.conf.get(botname, {}).get('respond_to_nick',
|
||||||
|
conf.conf['pylink'].get("respond_to_nick", conf.conf['bot'].get("respondtonick")))
|
||||||
|
|
||||||
log.debug('(%s) fantasy: checking bot %s', irc.name, botname)
|
log.debug('(%s) fantasy: checking bot %s', irc.name, botname)
|
||||||
servuid = sbot.uids.get(irc.name)
|
servuid = sbot.uids.get(irc.name)
|
||||||
if servuid in irc.channels[channel].users:
|
if servuid in irc.channels[channel].users:
|
||||||
|
Loading…
Reference in New Issue
Block a user