mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +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:
|
||||
# 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) = \
|
||||
|
@ -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')
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user