diff --git a/plugins/Gameknot.py b/plugins/Gameknot.py index 44f0f62ce..4b8a68429 100644 --- a/plugins/Gameknot.py +++ b/plugins/Gameknot.py @@ -33,6 +33,8 @@ Handles URL snarfing for Gameknot.com and the gkstats command. """ +__revision__ = "$id$" + import plugins import re @@ -189,9 +191,21 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable): #debug.printf('Got the string.') fd.close() try: - gameTitle = self._gkGameTitle.search(s).groups() + if 'no longer available' in s: + s = 'That game is no longer available.' + irc.reply(msg, s, prefixName=True) + return + m = self._gkGameTitle.search(s) + if m is None: + debug.msg('Gameknot._gkGameTitle didn\'t match (%s).' % url) + return + gameTitle = m.groups() gameTitle = ircutils.bold(gameTitle) - ((wRating, wName), (bRating, bName)) = self._gkPlayer.findall(s) + L = self._gkPlayer.findall(s) + if not L: + debug.msg('Gameknot._gkPlayer didn\'t match (%s).' % url) + return + ((wRating, wName), (bRating, bName)) = L wName = ircutils.bold(wName) bName = ircutils.bold(bName) if 'to move...' in s: diff --git a/test/test_Gameknot.py b/test/test_Gameknot.py index ca200a566..885acabfa 100644 --- a/test/test_Gameknot.py +++ b/test/test_Gameknot.py @@ -67,8 +67,9 @@ class GameknotTestCase(PluginTestCase, PluginDocumentation): def testSnarfer(self): - self.assertRegexp('http://gameknot.com/chess.pl?bd=907498', - '\x02ddipaolo\x0f won') + # This game expired. +## self.assertRegexp('http://gameknot.com/chess.pl?bd=907498', +## '\x02ddipaolo\x0f won') self.assertRegexp('http://gameknot.com/chess.pl?bd=907498', '\x02chroniqueur\x0f resigned') self.assertRegexp('http://gameknot.com/chess.pl?bd=955432',