From 0c4f9d74ebb3a1502979b839f4b24f64173ed7ec Mon Sep 17 00:00:00 2001 From: Ken Spencer Date: Sat, 26 Nov 2016 21:48:50 -0500 Subject: [PATCH 1/2] User: allow for custom whoami error --- plugins/User/config.py | 4 +++- plugins/User/plugin.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/User/config.py b/plugins/User/config.py index b1c89afa4..22c32567b 100644 --- a/plugins/User/config.py +++ b/plugins/User/config.py @@ -47,5 +47,7 @@ conf.registerChannelValue(User, 'listInPrivate', registry.Boolean(True, _("""Determines whether the output of 'user list' will be sent in private. This prevents mass-highlights of people who use their nick as their bot username."""))) - +conf.registerGlobalValue(User, 'customWho', + registry.NormalizedString(None, _("""Determines what message the bot sends + when a user isn't identified or recognized."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/User/plugin.py b/plugins/User/plugin.py index 8eb0d72e3..d4e6774b3 100644 --- a/plugins/User/plugin.py +++ b/plugins/User/plugin.py @@ -480,7 +480,10 @@ class User(callbacks.Plugin): user = ircdb.users.getUser(msg.prefix) irc.reply(user.name) except KeyError: - irc.reply(_('I don\'t recognize you. You can message me either of these two commands: "user identify " to log in or "user register " to register.')) + if not self.registryValue('customWho'): + irc.reply(_('I don\'t recognize you. You can message me either of these two commands: "user identify " to log in or "user register " to register.')) + else: + irc.reply(self.registryValue('customWho')) whoami = wrap(whoami) @internationalizeDocstring From bbaf3cd47ea6ffcc91237134ffa9f50e09e20b5c Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 28 Nov 2016 10:31:37 +0100 Subject: [PATCH 2/2] User: Fix previous commit by @IotaSpencer. --- plugins/User/config.py | 4 ++-- plugins/User/plugin.py | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/User/config.py b/plugins/User/config.py index 22c32567b..babf78778 100644 --- a/plugins/User/config.py +++ b/plugins/User/config.py @@ -47,7 +47,7 @@ conf.registerChannelValue(User, 'listInPrivate', registry.Boolean(True, _("""Determines whether the output of 'user list' will be sent in private. This prevents mass-highlights of people who use their nick as their bot username."""))) -conf.registerGlobalValue(User, 'customWho', - registry.NormalizedString(None, _("""Determines what message the bot sends +conf.registerGlobalValue(User, 'customWhoamiError', + registry.String("", _("""Determines what message the bot sends when a user isn't identified or recognized."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/User/plugin.py b/plugins/User/plugin.py index d4e6774b3..ac4be2cb5 100644 --- a/plugins/User/plugin.py +++ b/plugins/User/plugin.py @@ -480,10 +480,9 @@ class User(callbacks.Plugin): user = ircdb.users.getUser(msg.prefix) irc.reply(user.name) except KeyError: - if not self.registryValue('customWho'): - irc.reply(_('I don\'t recognize you. You can message me either of these two commands: "user identify " to log in or "user register " to register.')) - else: - irc.reply(self.registryValue('customWho')) + error = self.registryValue('customWhoamiError') or \ + _('I don\'t recognize you. You can message me either of these two commands: "user identify " to log in or "user register " to register.') + irc.reply(error) whoami = wrap(whoami) @internationalizeDocstring