diff --git a/plugins/Gameknot.py b/plugins/Gameknot.py index e3d40d63c..055289655 100644 --- a/plugins/Gameknot.py +++ b/plugins/Gameknot.py @@ -168,16 +168,19 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp): else: # Game is over. m = self._gkWon.search(s) - winner = m.group(1) - m = self._gkReason.search(s) if m: - reason = m.group(1) + winner = m.group(1) + m = self._gkReason.search(s) + if m: + reason = m.group(1) + else: + reason = 'lost' + if winner == 'white': + toMove = '%s won, %s %s.' % (wName, bName, reason) + else: + toMove = '%s won, %s %s.' % (bName, wName, reason) else: - reason = 'lost' - if winner == 'white': - toMove = '%s won, %s %s.' % (wName, bName, reason) - else: - toMove = '%s won, %s %s.' % (bName, wName, reason) + toMove = 'The game was a draw.' (wRating, wWins, wLosses, wDraws) = \ self._gkRating.search(wRating).groups() (bRating, bWins, bLosses, bDraws) = \ diff --git a/test/test_Gameknot.py b/test/test_Gameknot.py index 0b3847948..1d3393cf8 100644 --- a/test/test_Gameknot.py +++ b/test/test_Gameknot.py @@ -54,6 +54,8 @@ class GameknotTestCase(PluginTestCase, PluginDocumentation): '\x02chroniqueur\x0f resigned') self.assertRegexp('http://gameknot.com/chess.pl?bd=955432', '\x02ddipaolo\x0f lost') + self.assertRegexp('http://gameknot.com/chess.pl?bd=1077345&r=365', + 'draw')