|
@@ -683,7 +683,12 @@ async def chess_move_handler(chess, id, move):
|
|
|
except IllegalMove:
|
|
|
return ["Некорректный ход."]
|
|
|
|
|
|
- return [svg2png(chess.svg(id))]
|
|
|
+ reply = [svg2png(chess.svg(id))]
|
|
|
+
|
|
|
+ if chess.is_check(id):
|
|
|
+ reply.append("Шах!")
|
|
|
+
|
|
|
+ return reply
|
|
|
|
|
|
|
|
|
async def chess_undo_handler(chess, id):
|
|
@@ -713,7 +718,12 @@ async def chess_skip_handler(chess, id):
|
|
|
f"Конец игры: {str(e)}",
|
|
|
]
|
|
|
|
|
|
- return [svg2png(chess.svg(id))]
|
|
|
+ reply = [svg2png(chess.svg(id))]
|
|
|
+
|
|
|
+ if chess.is_check(id):
|
|
|
+ reply.append("Шах!")
|
|
|
+
|
|
|
+ return reply
|
|
|
|
|
|
|
|
|
async def chess_pass_handler(chess, id):
|
|
@@ -732,7 +742,12 @@ async def chess_pass_handler(chess, id):
|
|
|
f"Конец игры: {str(e)}",
|
|
|
]
|
|
|
|
|
|
- return [svg2png(chess.svg(id))]
|
|
|
+ reply = [svg2png(chess.svg(id))]
|
|
|
+
|
|
|
+ if chess.is_check(id):
|
|
|
+ reply.append("Шах!")
|
|
|
+
|
|
|
+ return reply
|
|
|
|
|
|
|
|
|
async def chess_board_handler(chess, id):
|
|
@@ -741,12 +756,20 @@ async def chess_board_handler(chess, id):
|
|
|
except KeyError:
|
|
|
return ["Нет активной игры."]
|
|
|
|
|
|
- return [board]
|
|
|
+ reply = [board]
|
|
|
+
|
|
|
+ if chess.is_check(id):
|
|
|
+ reply.append("Шах!")
|
|
|
+
|
|
|
+ return reply
|
|
|
|
|
|
|
|
|
async def chess_moves_handler(chess, id):
|
|
|
try:
|
|
|
moves = f"Последние два хода: {chess.moves(id, 2)}\nВсе ходы (первый ход - игрока): {chess.moves(id)}"
|
|
|
+
|
|
|
+ if chess.is_check(id):
|
|
|
+ moves = f"Шах.\n{moves}"
|
|
|
except KeyError:
|
|
|
return ["Нет активной игры."]
|
|
|
|