nonebot_plugin_handle


Namenonebot_plugin_handle JSON
Version 0.4.1 PyPI version JSON
download
home_pagehttps://github.com/noneplugin/nonebot-plugin-handle
SummaryNonebot2 汉字Wordle 插件
upload_time2024-03-03 14:32:15
maintainer
docs_urlNone
authormeetwq
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nonebot-plugin-handle

适用于 [Nonebot2](https://github.com/nonebot/nonebot2) 的 汉字Wordle 猜成语插件


### 安装

- 使用 nb-cli

```
nb plugin install nonebot_plugin_handle
```

- 使用 pip

```
pip install nonebot_plugin_handle
```


### 配置项

> 以下配置项可在 `.env.*` 文件中设置,具体参考 [NoneBot 配置方式](https://nonebot.dev/docs/appendices/config)

#### `handle_strict_mode`
 - 类型:`bool`
 - 默认:`False`
 - 说明:是否启用严格模式,开启后猜测的短语必须是成语

#### `handle_color_enhance`
 - 类型:`bool`
 - 默认:`False`
 - 说明:是否启用色彩增强模式


### 使用

**以下命令需要加[命令前缀](https://nonebot.dev/docs/appendices/config#command-start-和-command-separator) (默认为`/`),可自行设置为空,此处省略**

```
@机器人 + 猜成语/handle
```


### 规则

你有十次的机会猜一个四字词语;

每次猜测后,汉字与拼音的颜色将会标识其与正确答案的区别;

汉字的右上角标的数字1、2、3、4分别对应一、二、三、四声;

青色 表示其出现在答案中且在正确的位置;

橙色 表示其出现在答案中但不在正确的位置,至多着色 **此单词中有这个字母的数量** 次;

每个格子的 汉字、声母、韵母、声调 都会独立进行颜色的指示。

当四个格子都为青色时,你便赢得了游戏!

可发送“结束”结束游戏;可发送“提示”查看提示。

使用 `--strict` 选项开启成语检查,即猜测的短语必须是成语,如:

```
handle --strict
```
注:`--strict` 仅在 `handle_strict_mode` 被设置为 `False` 时生效。


### 示例

<div align="left">
  <img src="https://s2.loli.net/2023/01/29/SplDtuFNQaKvEHR.png" width="400" />
</div>


### 说明

#### 橙色块着色规则为:

```
橙色块至多着色 此成语中有这个元素的数量 次。
```
同时其满足:

```
橙色块着色数量 + 青色块着色数量 <= 此成语中有这个元素的数量。
```

类似Wordle,这意味着:

**如果答案是 `zu2 bu4 chu1 hu4`。**

玩家猜测 `hu1 xx1 xx1 xx1`(x代表无关),则

`h` 标为橙色。

`1` 声在第 3 格标记青色,其他为灰色。(因为着青色的数量达到最大值 1)

玩家猜测 `hu4 hu4 su4 su4`,则

第 1 个 `h` 着橙色,第 2 个 `h` 着灰色。(因为着青色的数量达到最大值 1)

`4` 声在第 2、4 格着青色,在第 1、3 格着灰色。(因为着青色的数量达到最大值 2)

四个 `u` 全部标记为青色。


#### 特殊标记

在旧版 nonebot-plugin-handle(<0.3.2) 中,若出现连续标黄的拼音,玩家无法判断其是出自同一个字还是不同的字,如下图所示。

![image.png](https://s2.loli.net/2023/12/04/NOydSPkYQAh3HDV.png)

> 更新后,若所猜拼音下,出现双下划线,则代表该声母/韵母是出自同一个出现在答案中的字。

这张图片的含义是:成语中出现了 xin 这个拼音的字,但位置不正确。

![image.png](https://s2.loli.net/2023/12/04/wDuFtoGST9byMZp.png)

这张图片的含义是:成语中,所猜位置是 xin1,但不是新这个字。(正确答案是心)

![image.png](https://s2.loli.net/2023/12/04/VcrwlLaS3ht9uj7.png)


### 特别感谢

- [antfu/handle](https://github.com/antfu/handle) A Chinese Hanzi variation of Wordle - 汉字 Wordle
- [AllanChain/chinese-wordle](https://github.com/AllanChain/chinese-wordle) Chinese idiom wordle game | 仿 wordle 的拼成语游戏

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/noneplugin/nonebot-plugin-handle",
    "name": "nonebot_plugin_handle",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "meetwq",
    "author_email": "meetwq@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/44/cc/f9c96b61478ee9498d59ffc5463d0c6d8e263f6ad77bfeeb26dbd6c5d221/nonebot_plugin_handle-0.4.1.tar.gz",
    "platform": null,
    "description": "# nonebot-plugin-handle\n\n\u9002\u7528\u4e8e [Nonebot2](https://github.com/nonebot/nonebot2) \u7684 \u6c49\u5b57Wordle \u731c\u6210\u8bed\u63d2\u4ef6\n\n\n### \u5b89\u88c5\n\n- \u4f7f\u7528 nb-cli\n\n```\nnb plugin install nonebot_plugin_handle\n```\n\n- \u4f7f\u7528 pip\n\n```\npip install nonebot_plugin_handle\n```\n\n\n### \u914d\u7f6e\u9879\n\n> \u4ee5\u4e0b\u914d\u7f6e\u9879\u53ef\u5728 `.env.*` \u6587\u4ef6\u4e2d\u8bbe\u7f6e\uff0c\u5177\u4f53\u53c2\u8003 [NoneBot \u914d\u7f6e\u65b9\u5f0f](https://nonebot.dev/docs/appendices/config)\n\n#### `handle_strict_mode`\n - \u7c7b\u578b\uff1a`bool`\n - \u9ed8\u8ba4\uff1a`False`\n - \u8bf4\u660e\uff1a\u662f\u5426\u542f\u7528\u4e25\u683c\u6a21\u5f0f\uff0c\u5f00\u542f\u540e\u731c\u6d4b\u7684\u77ed\u8bed\u5fc5\u987b\u662f\u6210\u8bed\n\n#### `handle_color_enhance`\n - \u7c7b\u578b\uff1a`bool`\n - \u9ed8\u8ba4\uff1a`False`\n - \u8bf4\u660e\uff1a\u662f\u5426\u542f\u7528\u8272\u5f69\u589e\u5f3a\u6a21\u5f0f\n\n\n### \u4f7f\u7528\n\n**\u4ee5\u4e0b\u547d\u4ee4\u9700\u8981\u52a0[\u547d\u4ee4\u524d\u7f00](https://nonebot.dev/docs/appendices/config#command-start-\u548c-command-separator) (\u9ed8\u8ba4\u4e3a`/`)\uff0c\u53ef\u81ea\u884c\u8bbe\u7f6e\u4e3a\u7a7a\uff0c\u6b64\u5904\u7701\u7565**\n\n```\n@\u673a\u5668\u4eba + \u731c\u6210\u8bed/handle\n```\n\n\n### \u89c4\u5219\n\n\u4f60\u6709\u5341\u6b21\u7684\u673a\u4f1a\u731c\u4e00\u4e2a\u56db\u5b57\u8bcd\u8bed\uff1b\n\n\u6bcf\u6b21\u731c\u6d4b\u540e\uff0c\u6c49\u5b57\u4e0e\u62fc\u97f3\u7684\u989c\u8272\u5c06\u4f1a\u6807\u8bc6\u5176\u4e0e\u6b63\u786e\u7b54\u6848\u7684\u533a\u522b\uff1b\n\n\u6c49\u5b57\u7684\u53f3\u4e0a\u89d2\u6807\u7684\u6570\u5b571\u30012\u30013\u30014\u5206\u522b\u5bf9\u5e94\u4e00\u3001\u4e8c\u3001\u4e09\u3001\u56db\u58f0\uff1b\n\n\u9752\u8272 \u8868\u793a\u5176\u51fa\u73b0\u5728\u7b54\u6848\u4e2d\u4e14\u5728\u6b63\u786e\u7684\u4f4d\u7f6e\uff1b\n\n\u6a59\u8272 \u8868\u793a\u5176\u51fa\u73b0\u5728\u7b54\u6848\u4e2d\u4f46\u4e0d\u5728\u6b63\u786e\u7684\u4f4d\u7f6e\uff0c\u81f3\u591a\u7740\u8272 **\u6b64\u5355\u8bcd\u4e2d\u6709\u8fd9\u4e2a\u5b57\u6bcd\u7684\u6570\u91cf** \u6b21\uff1b\n\n\u6bcf\u4e2a\u683c\u5b50\u7684 \u6c49\u5b57\u3001\u58f0\u6bcd\u3001\u97f5\u6bcd\u3001\u58f0\u8c03 \u90fd\u4f1a\u72ec\u7acb\u8fdb\u884c\u989c\u8272\u7684\u6307\u793a\u3002\n\n\u5f53\u56db\u4e2a\u683c\u5b50\u90fd\u4e3a\u9752\u8272\u65f6\uff0c\u4f60\u4fbf\u8d62\u5f97\u4e86\u6e38\u620f\uff01\n\n\u53ef\u53d1\u9001\u201c\u7ed3\u675f\u201d\u7ed3\u675f\u6e38\u620f\uff1b\u53ef\u53d1\u9001\u201c\u63d0\u793a\u201d\u67e5\u770b\u63d0\u793a\u3002\n\n\u4f7f\u7528 `--strict` \u9009\u9879\u5f00\u542f\u6210\u8bed\u68c0\u67e5\uff0c\u5373\u731c\u6d4b\u7684\u77ed\u8bed\u5fc5\u987b\u662f\u6210\u8bed\uff0c\u5982\uff1a\n\n```\nhandle --strict\n```\n\u6ce8\uff1a`--strict` \u4ec5\u5728 `handle_strict_mode` \u88ab\u8bbe\u7f6e\u4e3a `False` \u65f6\u751f\u6548\u3002\n\n\n### \u793a\u4f8b\n\n<div align=\"left\">\n  <img src=\"https://s2.loli.net/2023/01/29/SplDtuFNQaKvEHR.png\" width=\"400\" />\n</div>\n\n\n### \u8bf4\u660e\n\n#### \u6a59\u8272\u5757\u7740\u8272\u89c4\u5219\u4e3a\uff1a\n\n```\n\u6a59\u8272\u5757\u81f3\u591a\u7740\u8272 \u6b64\u6210\u8bed\u4e2d\u6709\u8fd9\u4e2a\u5143\u7d20\u7684\u6570\u91cf \u6b21\u3002\n```\n\u540c\u65f6\u5176\u6ee1\u8db3\uff1a\n\n```\n\u6a59\u8272\u5757\u7740\u8272\u6570\u91cf + \u9752\u8272\u5757\u7740\u8272\u6570\u91cf <= \u6b64\u6210\u8bed\u4e2d\u6709\u8fd9\u4e2a\u5143\u7d20\u7684\u6570\u91cf\u3002\n```\n\n\u7c7b\u4f3cWordle\uff0c\u8fd9\u610f\u5473\u7740\uff1a\n\n**\u5982\u679c\u7b54\u6848\u662f `zu2 bu4 chu1 hu4`\u3002**\n\n\u73a9\u5bb6\u731c\u6d4b `hu1 xx1 xx1 xx1`(x\u4ee3\u8868\u65e0\u5173)\uff0c\u5219\n\n`h` \u6807\u4e3a\u6a59\u8272\u3002\n\n`1` \u58f0\u5728\u7b2c 3 \u683c\u6807\u8bb0\u9752\u8272\uff0c\u5176\u4ed6\u4e3a\u7070\u8272\u3002\uff08\u56e0\u4e3a\u7740\u9752\u8272\u7684\u6570\u91cf\u8fbe\u5230\u6700\u5927\u503c 1\uff09\n\n\u73a9\u5bb6\u731c\u6d4b `hu4 hu4 su4 su4`\uff0c\u5219\n\n\u7b2c 1 \u4e2a `h` \u7740\u6a59\u8272\uff0c\u7b2c 2 \u4e2a `h` \u7740\u7070\u8272\u3002\uff08\u56e0\u4e3a\u7740\u9752\u8272\u7684\u6570\u91cf\u8fbe\u5230\u6700\u5927\u503c 1\uff09\n\n`4` \u58f0\u5728\u7b2c 2\u30014 \u683c\u7740\u9752\u8272\uff0c\u5728\u7b2c 1\u30013 \u683c\u7740\u7070\u8272\u3002\uff08\u56e0\u4e3a\u7740\u9752\u8272\u7684\u6570\u91cf\u8fbe\u5230\u6700\u5927\u503c 2\uff09\n\n\u56db\u4e2a `u` \u5168\u90e8\u6807\u8bb0\u4e3a\u9752\u8272\u3002\n\n\n#### \u7279\u6b8a\u6807\u8bb0\n\n\u5728\u65e7\u7248 nonebot-plugin-handle(<0.3.2) \u4e2d\uff0c\u82e5\u51fa\u73b0\u8fde\u7eed\u6807\u9ec4\u7684\u62fc\u97f3\uff0c\u73a9\u5bb6\u65e0\u6cd5\u5224\u65ad\u5176\u662f\u51fa\u81ea\u540c\u4e00\u4e2a\u5b57\u8fd8\u662f\u4e0d\u540c\u7684\u5b57\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002\n\n![image.png](https://s2.loli.net/2023/12/04/NOydSPkYQAh3HDV.png)\n\n> \u66f4\u65b0\u540e\uff0c\u82e5\u6240\u731c\u62fc\u97f3\u4e0b\uff0c\u51fa\u73b0\u53cc\u4e0b\u5212\u7ebf\uff0c\u5219\u4ee3\u8868\u8be5\u58f0\u6bcd/\u97f5\u6bcd\u662f\u51fa\u81ea\u540c\u4e00\u4e2a\u51fa\u73b0\u5728\u7b54\u6848\u4e2d\u7684\u5b57\u3002\n\n\u8fd9\u5f20\u56fe\u7247\u7684\u542b\u4e49\u662f\uff1a\u6210\u8bed\u4e2d\u51fa\u73b0\u4e86 xin \u8fd9\u4e2a\u62fc\u97f3\u7684\u5b57\uff0c\u4f46\u4f4d\u7f6e\u4e0d\u6b63\u786e\u3002\n\n![image.png](https://s2.loli.net/2023/12/04/wDuFtoGST9byMZp.png)\n\n\u8fd9\u5f20\u56fe\u7247\u7684\u542b\u4e49\u662f\uff1a\u6210\u8bed\u4e2d\uff0c\u6240\u731c\u4f4d\u7f6e\u662f xin1\uff0c\u4f46\u4e0d\u662f\u65b0\u8fd9\u4e2a\u5b57\u3002\uff08\u6b63\u786e\u7b54\u6848\u662f\u5fc3\uff09\n\n![image.png](https://s2.loli.net/2023/12/04/VcrwlLaS3ht9uj7.png)\n\n\n### \u7279\u522b\u611f\u8c22\n\n- [antfu/handle](https://github.com/antfu/handle) A Chinese Hanzi variation of Wordle - \u6c49\u5b57 Wordle\n- [AllanChain/chinese-wordle](https://github.com/AllanChain/chinese-wordle) Chinese idiom wordle game | \u4eff wordle \u7684\u62fc\u6210\u8bed\u6e38\u620f\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Nonebot2 \u6c49\u5b57Wordle \u63d2\u4ef6",
    "version": "0.4.1",
    "project_urls": {
        "Homepage": "https://github.com/noneplugin/nonebot-plugin-handle",
        "Repository": "https://github.com/noneplugin/nonebot-plugin-handle"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cce0bc316655449c8d6ea2853a401d0f6751279416b727331d1ef8f63d2d39f4",
                "md5": "684abc36987f2728097b7801b63e0cb9",
                "sha256": "5cc5ca55ec8916073575b5f09b497a8fad69c71b9ba99facb8fd64bb6d94bdf3"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_handle-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "684abc36987f2728097b7801b63e0cb9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 9958700,
            "upload_time": "2024-03-03T14:32:13",
            "upload_time_iso_8601": "2024-03-03T14:32:13.372089Z",
            "url": "https://files.pythonhosted.org/packages/cc/e0/bc316655449c8d6ea2853a401d0f6751279416b727331d1ef8f63d2d39f4/nonebot_plugin_handle-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44ccf9c96b61478ee9498d59ffc5463d0c6d8e263f6ad77bfeeb26dbd6c5d221",
                "md5": "29b78acd0fa82aea5429ab55c6f73d62",
                "sha256": "66492910711fa3a12e9efb910fe3ea5982c09a424e2925f237eb42f95c50a82a"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_handle-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "29b78acd0fa82aea5429ab55c6f73d62",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 9955979,
            "upload_time": "2024-03-03T14:32:15",
            "upload_time_iso_8601": "2024-03-03T14:32:15.609852Z",
            "url": "https://files.pythonhosted.org/packages/44/cc/f9c96b61478ee9498d59ffc5463d0c6d8e263f6ad77bfeeb26dbd6c5d221/nonebot_plugin_handle-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-03 14:32:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "noneplugin",
    "github_project": "nonebot-plugin-handle",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebot_plugin_handle"
}
        
Elapsed time: 0.18943s