|  | @@ -846,6 +846,30 @@ async def chess_moves_handler(chess, id):
 | 
											
												
													
														|  |      return [text]
 |  |      return [text]
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +async def chess_set_handler(chess, id, moves):
 | 
											
												
													
														|  | 
 |  | +    try:
 | 
											
												
													
														|  | 
 |  | +        await chess.set(id, moves, strict=not isinstance(id, str))
 | 
											
												
													
														|  | 
 |  | +    except GameOver as e:
 | 
											
												
													
														|  | 
 |  | +        return chess_game_over(chess, id, e)
 | 
											
												
													
														|  | 
 |  | +    except IllegalMove as e:
 | 
											
												
													
														|  | 
 |  | +        move = str(e)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        if move:
 | 
											
												
													
														|  | 
 |  | +            return [f"Некорректный ход: {move}"]
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        return ["Некорректная последовательность ходов."]
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    reply = chess_render(chess, id)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    if chess.is_check(id):
 | 
											
												
													
														|  | 
 |  | +        reply.append("Шах!")
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    if isinstance(id, str):
 | 
											
												
													
														|  | 
 |  | +        reply.append(f"Ход {'белых' if chess.turn(id) else 'чёрных'}.")
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    return reply
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  async def chess_anim_handler(chess, id, arg):
 |  |  async def chess_anim_handler(chess, id, arg):
 | 
											
												
													
														|  |      count = None
 |  |      count = None
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -885,6 +909,7 @@ CHESS_COMMANDS = {
 | 
											
												
													
														|  |      "pass": (chess_pass_handler, "Сделать ход вместо вас", 0),
 |  |      "pass": (chess_pass_handler, "Сделать ход вместо вас", 0),
 | 
											
												
													
														|  |      "board": (chess_board_handler, "Показать доску", 0),
 |  |      "board": (chess_board_handler, "Показать доску", 0),
 | 
											
												
													
														|  |      "moves": (chess_moves_handler, "Показать историю ходов и состояние игры", 0),
 |  |      "moves": (chess_moves_handler, "Показать историю ходов и состояние игры", 0),
 | 
											
												
													
														|  | 
 |  | +    "set": (chess_set_handler, "Установить состояние доски", 1, True),
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      "create": (chess_start_handler, "Создать общую доску", 0),
 |  |      "create": (chess_start_handler, "Создать общую доску", 0),
 | 
											
												
													
														|  |      "createfrom": (chess_from_handler, "Создать общую доску в указанном состоянии", 1, True),
 |  |      "createfrom": (chess_from_handler, "Создать общую доску в указанном состоянии", 1, True),
 |