diff --git a/ChangeLog b/ChangeLog index 183caf94b..de9da043b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ + * Fixed bug #851254, Factoids.whatis didn't work on numeric keys. + * Added the ability to turn on/off the showing of ids in FunDB excuse/insult/praise/lart. diff --git a/plugins/Factoids.py b/plugins/Factoids.py index 2172229ee..369816f3c 100644 --- a/plugins/Factoids.py +++ b/plugins/Factoids.py @@ -131,7 +131,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg): necessary if the message isn't sent in the channel itself. """ channel = privmsgs.getChannel(msg, args) - if args[-1].isdigit(): + if len(args) > 1 and args[-1].isdigit(): number = args.pop() else: number = '' diff --git a/test/test_Factoids.py b/test/test_Factoids.py index c312ace4c..967b29c6a 100644 --- a/test/test_Factoids.py +++ b/test/test_Factoids.py @@ -105,6 +105,9 @@ if sqlite is not None: self.assertRegexp('search jemfinch', 'my primary author') + def testWhatisOnNumbers(self): + self.assertNotError('learn 911 as emergency number') + self.assertRegexp('whatis 911', 'emergency number') def testNotZeroIndexed(self): self.assertNotError('learn foo as bar')