mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +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)
|
irc.error(msg, '%s has no help or syntax description.'%command)
|
||||||
|
|
||||||
def hostmask(self, irc, msg, args):
|
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:
|
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:
|
except KeyError:
|
||||||
irc.error(msg, 'I haven\'t seen anyone named %r' % nick)
|
irc.error(msg, 'I haven\'t seen anyone named %r' % nick)
|
||||||
|
|
||||||
|
@ -132,6 +132,9 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
m = self.getMsg('notice [list]')
|
m = self.getMsg('notice [list]')
|
||||||
self.assertEqual(m.command, 'NOTICE')
|
self.assertEqual(m.command, 'NOTICE')
|
||||||
|
|
||||||
|
def testHostmask(self):
|
||||||
|
self.assertResponse('hostmask', self.prefix)
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user