From 3b2c9a5d834c0f5a0ee183782adb13bf51abab23 Mon Sep 17 00:00:00 2001 From: programarivm Date: Fri, 13 Oct 2023 10:21:11 +0200 Subject: [PATCH] Documented the /inbox command --- docs/inbox.md | 88 ++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + src/Command/InboxCommand.php | 2 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 docs/inbox.md diff --git a/docs/inbox.md b/docs/inbox.md new file mode 100644 index 00000000..cd534d38 --- /dev/null +++ b/docs/inbox.md @@ -0,0 +1,88 @@ +# /inbox + +## Description + +Allows to play correspondence chess. + +| Name | Description | Required | +| ---- | ----------- | -------- | +| `action` | `create`
`read`
`reply` | Yes | + +## Usage + +### Create an inbox + +| Name | Description | Required | +| ---- | ----------- | -------- | +| `variant` | `960`
`capablanca`
`capablanca-fischer`
`classical` | Yes | +| `add` | `fen`
`startPos` | No | + +```js +ws.send('/inbox create classical "{}"'); +``` + +```text +{ + "/inbox": { + "action": "create", + "hash": "92a984a69050423e7b2e8dd2b9e99a22", + "inbox": { + "hash": "92a984a69050423e7b2e8dd2b9e99a22", + "variant": "classical", + "settings": [], + "fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -", + "movetext": "", + "createdAt": "2023-10-13 10:14:47", + "createdBy": 306 + } + } +} +``` + +### Read an inbox + +| Name | Description | Required | +| ---- | ----------- | -------- | +| `hash` | The unique hash of the game. | Yes | + +```js +ws.send('/inbox read 2624497eebedf72579717cd881400701'); +``` + +```text +{ + "/inbox": { + "action": "read", + "inbox": { + "hash": "2624497eebedf72579717cd881400701", + "variant": "classical", + "settings": [], + "fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -", + "movetext": "", + "createdAt": "2023-10-13 10:00:22", + "createdBy": 249, + "_id": 9 + } + } +} +``` + +### Reply to a chess move + +| Name | Description | Required | +| ---- | ----------- | -------- | +| `hash` | The unique hash of the game. | Yes | +| `move` | A chess move in PGN format. | Yes | + +```js +ws.send('/inbox reply 2624497eebedf72579717cd881400701 "e4"'); +``` + +```text +{ + "/inbox": { + "action": "reply", + "message": "Chess move successfully sent." + } +} +``` diff --git a/mkdocs.yml b/mkdocs.yml index 64dbd396..d16765b7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -13,4 +13,5 @@ pages: - /leave: leave.md - /rematch: rematch.md - /restart: restart.md + - /inbox: inbox.md theme: readthedocs diff --git a/src/Command/InboxCommand.php b/src/Command/InboxCommand.php index f840efb1..86990a4f 100644 --- a/src/Command/InboxCommand.php +++ b/src/Command/InboxCommand.php @@ -32,7 +32,7 @@ class InboxCommand extends AbstractCommand public function __construct() { $this->name = '/inbox'; - $this->description = "Correspondence chess."; + $this->description = "Allows to play correspondence chess."; $this->params = [ // mandatory 'action' => [