mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
ServiceBot: make displaying unknown command errors optional
Closes #441.
This commit is contained in:
parent
4cd71d12ef
commit
5d10ee39be
@ -68,6 +68,9 @@ pylink:
|
||||
#plugin_dirs: ["~/my-plugins", "~/pylink-contrib-modules/plugins"]
|
||||
#protocol_dirs: ["~/pylink-contrib-modules/protocols"]
|
||||
|
||||
# Determines whether we should show unknown command errors for service bots. Defaults to True.
|
||||
#show_unknown_commands: true
|
||||
|
||||
login:
|
||||
# NOTE: for users migrating from PyLink < 1.1, the old login:user/login:password settings
|
||||
# have been deprecated. We strongly recommend migrating to the new "accounts:" block below, as
|
||||
@ -685,6 +688,10 @@ automode:
|
||||
# block.
|
||||
#respond_to_nick: true
|
||||
|
||||
# Determines whether we should show unknown command errors for this service bot. Defaults to True.
|
||||
# This overrides the "show_unknown_commands" option in the "pylink:" config block.
|
||||
#show_unknown_commands: true
|
||||
|
||||
games:
|
||||
# Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined.
|
||||
nick: Games
|
||||
|
7
utils.py
7
utils.py
@ -335,7 +335,12 @@ class ServiceBot():
|
||||
cmd = cmd_args[0].lower()
|
||||
cmd_args = cmd_args[1:]
|
||||
if cmd not in self.commands:
|
||||
if cmd and not cmd.startswith('\x01'):
|
||||
# XXX: we really need abstraction for this kind of config fetching...
|
||||
show_unknown_cmds = irc.serverdata.get('%s_show_unknown_commands' % self.name,
|
||||
conf.conf.get(self.name, {}).get('show_unknown_commands',
|
||||
conf.conf['pylink'].get('show_unknown_commands', True)))
|
||||
|
||||
if cmd and show_unknown_cmds and not cmd.startswith('\x01'):
|
||||
# Ignore empty commands and invalid command errors from CTCPs.
|
||||
self.reply(irc, 'Error: Unknown command %r.' % cmd)
|
||||
log.info('(%s/%s) Received unknown command %r from %s', irc.name, self.name, cmd, irc.getHostmask(source))
|
||||
|
Loading…
Reference in New Issue
Block a user