From fe778c60bf6a6352f7885bc317dd8228a4560d77 Mon Sep 17 00:00:00 2001 From: GLolol Date: Tue, 16 Dec 2014 16:18:25 -0800 Subject: [PATCH] Aka: add 'list' command (Closes ProgVal/Limnoria#572) --- plugins/Aka/plugin.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/Aka/plugin.py b/plugins/Aka/plugin.py index c09a8d451..2dc2f2d01 100644 --- a/plugins/Aka/plugin.py +++ b/plugins/Aka/plugin.py @@ -713,6 +713,25 @@ class Aka(callbacks.Plugin): irc.replySuccess() importaliasdatabase = wrap(importaliasdatabase, ['owner']) + def list(self, irc, msg, args, optlist): + """[--channel] <#channel> + + Lists all Akas defined for . If is not specified, + lists all global Akas.""" + channel = 'global' + for (option, arg) in optlist: + if option == 'channel': + if not ircutils.isChannel(arg): + irc.error(_('%r is not a valid channel.') % arg, + Raise=True) + channel = arg + aka_list = self._db.get_aka_list(channel) + aka_values = [self._db.get_alias(channel, aka) for aka in aka_list] + s = ('{0}: "{1}"'.format(ircutils.bold(k), v) for (k, v) in + zip(aka_list, aka_values)) + irc.replies(s) + list = wrap(list, [getopts({'channel': 'somethingWithoutSpaces'})]) + Class = Aka