mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 01:19:26 +01:00
Aka: Add @show command. Closes GH-572. Closes GH-710.
This commit is contained in:
parent
fee33c1272
commit
0a1bf6db22
@ -631,6 +631,23 @@ class Aka(callbacks.Plugin):
|
||||
'channel': 'somethingWithoutSpaces',
|
||||
}), 'user', 'something'])
|
||||
|
||||
def show(self, irc, msg, args, optlist, name):
|
||||
"""<command>
|
||||
|
||||
This command shows the content of an Aka.
|
||||
"""
|
||||
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
|
||||
command = self._db.get_alias(channel, name)
|
||||
irc.reply(command)
|
||||
show = wrap(show, [getopts({'channel': 'somethingWithoutSpaces'}),
|
||||
'text'])
|
||||
|
||||
def importaliasdatabase(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
||||
|
@ -70,6 +70,12 @@ class AkaChannelTestCase(ChannelPluginTestCase):
|
||||
self.assertNotError('aka add nonascii echo éé')
|
||||
self.assertRegexp('help nonascii', "Alias for .*echo éé")
|
||||
|
||||
def testShow(self):
|
||||
self.assertNotError('aka add foo bar')
|
||||
self.assertResponse('show foo', 'bar $*')
|
||||
self.assertNotError('aka add "foo bar" baz')
|
||||
self.assertResponse('show "foo bar"', 'baz $*')
|
||||
|
||||
def testRemove(self):
|
||||
self.assertNotError('aka add foo echo bar')
|
||||
self.assertResponse('foo', 'bar')
|
||||
|
Loading…
Reference in New Issue
Block a user