mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Made the hostmask command default to providing the hostmask of the person asking giving the command if no nick is provided.
This commit is contained in:
parent
cad2269ba5
commit
be97120c63
12
src/Misc.py
12
src/Misc.py
@ -206,13 +206,17 @@ class Misc(callbacks.Privmsg):
|
||||
irc.error(msg, '%s has no help or syntax description.'%command)
|
||||
|
||||
def hostmask(self, irc, msg, args):
|
||||
"""<nick>
|
||||
"""[<nick>]
|
||||
|
||||
Returns the hostmask of <nick>.
|
||||
Returns the hostmask of <nick>. If <nick> isn't given, return the
|
||||
hostmask of the person giving the command.
|
||||
"""
|
||||
nick = privmsgs.getArgs(args)
|
||||
nick = privmsgs.getArgs(args, needed=0, optional=1)
|
||||
try:
|
||||
irc.reply(msg, irc.state.nickToHostmask(nick))
|
||||
if nick:
|
||||
irc.reply(msg, irc.state.nickToHostmask(nick))
|
||||
else:
|
||||
irc.reply(msg, msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(msg, 'I haven\'t seen anyone named %r' % nick)
|
||||
|
||||
|
@ -132,6 +132,9 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
m = self.getMsg('notice [list]')
|
||||
self.assertEqual(m.command, 'NOTICE')
|
||||
|
||||
def testHostmask(self):
|
||||
self.assertResponse('hostmask', self.prefix)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user