mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Made stats default to the name of the person asking.
This commit is contained in:
parent
6d9aea2d26
commit
68dd30cb8b
@ -408,14 +408,21 @@ class ChannelDB(plugins.ChannelDBHandler, callbacks.PrivmsgCommandAndRegexp):
|
|||||||
WHERE name=%s""", name)
|
WHERE name=%s""", name)
|
||||||
|
|
||||||
def stats(self, irc, msg, args):
|
def stats(self, irc, msg, args):
|
||||||
"""[<channel>] <nick>
|
"""[<channel>] [<name>]
|
||||||
|
|
||||||
Returns the statistics for <nick> on <channel>. <channel> is only
|
Returns the statistics for <name> on <channel>. <channel> is only
|
||||||
necessary if the message isn't sent on the channel itself.
|
necessary if the message isn't sent on the channel itself. If <name>
|
||||||
|
isn't given, it defaults to the user sending the command.
|
||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
name = privmsgs.getArgs(args)
|
name = privmsgs.getArgs(args, needed=0, optional=1)
|
||||||
if not ircdb.users.hasUser(name):
|
if not name:
|
||||||
|
try:
|
||||||
|
id = ircdb.users.getUserId(msg.prefix)
|
||||||
|
except KeyError:
|
||||||
|
irc.error(msg, 'I couldn\'t find you in my user database.')
|
||||||
|
return
|
||||||
|
elif not ircdb.users.hasUser(name):
|
||||||
try:
|
try:
|
||||||
hostmask = irc.state.nickToHostmask(name)
|
hostmask = irc.state.nickToHostmask(name)
|
||||||
id = ircdb.users.getUserId(hostmask)
|
id = ircdb.users.getUserId(hostmask)
|
||||||
|
@ -57,6 +57,7 @@ if sqlite is not None:
|
|||||||
self.assertError('stats %s' % self.nick)
|
self.assertError('stats %s' % self.nick)
|
||||||
self.assertNotError('stats %s' % self.nick)
|
self.assertNotError('stats %s' % self.nick)
|
||||||
self.assertNotError('stats %s' % self.nick.upper())
|
self.assertNotError('stats %s' % self.nick.upper())
|
||||||
|
self.assertNotError('stats')
|
||||||
|
|
||||||
def testNoKeyErrorEscapeFromSeen(self):
|
def testNoKeyErrorEscapeFromSeen(self):
|
||||||
self.assertRegexp('seen asldfkjasdlfkj', 'I have not seen')
|
self.assertRegexp('seen asldfkjasdlfkj', 'I have not seen')
|
||||||
|
Loading…
Reference in New Issue
Block a user