mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Fixed snarfer for drawn games.
This commit is contained in:
parent
70b80f0622
commit
fd1aacbd64
@ -168,16 +168,19 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
else:
|
else:
|
||||||
# Game is over.
|
# Game is over.
|
||||||
m = self._gkWon.search(s)
|
m = self._gkWon.search(s)
|
||||||
winner = m.group(1)
|
|
||||||
m = self._gkReason.search(s)
|
|
||||||
if m:
|
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:
|
else:
|
||||||
reason = 'lost'
|
toMove = 'The game was a draw.'
|
||||||
if winner == 'white':
|
|
||||||
toMove = '%s won, %s %s.' % (wName, bName, reason)
|
|
||||||
else:
|
|
||||||
toMove = '%s won, %s %s.' % (bName, wName, reason)
|
|
||||||
(wRating, wWins, wLosses, wDraws) = \
|
(wRating, wWins, wLosses, wDraws) = \
|
||||||
self._gkRating.search(wRating).groups()
|
self._gkRating.search(wRating).groups()
|
||||||
(bRating, bWins, bLosses, bDraws) = \
|
(bRating, bWins, bLosses, bDraws) = \
|
||||||
|
@ -54,6 +54,8 @@ class GameknotTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
'\x02chroniqueur\x0f resigned')
|
'\x02chroniqueur\x0f resigned')
|
||||||
self.assertRegexp('http://gameknot.com/chess.pl?bd=955432',
|
self.assertRegexp('http://gameknot.com/chess.pl?bd=955432',
|
||||||
'\x02ddipaolo\x0f lost')
|
'\x02ddipaolo\x0f lost')
|
||||||
|
self.assertRegexp('http://gameknot.com/chess.pl?bd=1077345&r=365',
|
||||||
|
'draw')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user