diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 66e072c24..f42fc1a5d 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -504,6 +504,28 @@ class Misc(callbacks.Plugin): """ irc.reply(_('pong'), prefixNick=False) + @internationalizeDocstring + def completenick(self, irc, msg, args, channel, beginning, optlist): + """[] [--match-case] + + Returns the nick of someone on the channel whose nick begins with the + given . + defaults to the current channel.""" + if ('match-case', True) in optlist: + def match(nick): + return nick.startswith(beginning) + else: + beginning = beginning.lower() + def match(nick): + return nick.lower().startswith(beginning) + for nick in irc.state.channels[channel].users: + if match(nick): + irc.reply(nick) + return + irc.error(_('No such nick.')) + completenick = wrap(completenick, ['channel', 'something', + getopts({'match-case':''})]) + Class = Misc # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: