nonebot-plugin-7s-roll


Namenonebot-plugin-7s-roll JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/7sDream/nonebot_plugin_7s_roll
SummaryA roll dice plugin for nonebot
upload_time2023-06-21 03:49:40
maintainer
docs_urlNone
author7sDream
requires_python>=3.9,<4.0
licenseMIT
keywords nonebot dice roll trpg
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Roll Dice

扔骰子小工具。

0.2.0 版本支持 NoneBot2 2.0 正式版 API,不依赖任何特定 Adapter。

在 OneBot V11 下回复时支持 At。

## 使用

```python
# load your driver, set adapter, builtin plugin etc.
nonebot.load_plugin("nonebot_plugin_7s_roll")
nonebot.run()
```

其中 .env 文件除了 nonebot 的常规配置项外,还有可添加以下配置属性(示例中的是默认值):

```env
# 命令名(在 at 机器人时使用, `@bot /roll 1d10`)
I7S_ROLL_COMMAND="roll"
# 关键字(直接使用,无需 at, `roll 1d10`)
I7S_ROLL_TRIGGER="roll"
```

## 命令

`roll <expr>[[ ]<operator>[ ]<target>]`

其中:

- `<expr>` 计算表达式,格式为
  - `<roll>[[ ][+|-][ ]<roll>]...`,其中 `roll` 不超过 20 项,其格式为:
    - `<times>[d|D]<faces>[ ][<policy>]`,其中
      - `<times>` 为投掷次数,不超过 20 次
      - `<faces>` 为骰子面数,不超过 1000 面
      - `<policy>` 为投掷方式,默认为 `sum`,可选方式有:
        - `sum` 求和
        - `min` 取最小值
        - `max` 取最大值
        - `avg` 取平均值
- `operator` 为比较运算,可以为
  - `>`、`大于`
  - `<`、`小于`
  - `>=`、`大于等于`
  - `<=`、`小于等于`
- `target` 为期望目标

## 举例

`roll 3d6`(在只有一个 `roll` 时,会显示的比较详细):

```text
3d6 投掷结果

第 1 颗:5
第 2 颗:5
第 3 颗:6

总和为 16
```

`roll 3d10+2d6+1 >20`:

```text
3d10+2d6+1 投掷结果(目标 > 20):
(5 + 1 + 9) + (4 + 5) + 1 = 25,通过
```

`roll 3d100max+4d10`

```text
3d100max+4d10 投掷结果
(max[35, 60, 29] = 60) + (1 + 1 + 5 + 8) = 75
```

## 截图

![screenshot-dice]

## LICENSE

MIT.

[screenshot-dice]: https://rikka.7sdre.am/files/8c6c5b15-0343-4d14-a203-422c7d6c634e.png

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/7sDream/nonebot_plugin_7s_roll",
    "name": "nonebot-plugin-7s-roll",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "nonebot,dice,roll,trpg",
    "author": "7sDream",
    "author_email": "i@7sdre.am",
    "download_url": "https://files.pythonhosted.org/packages/7f/03/c64e25370f642c260c4e5516ec9894ad4670caeb6f8aea34581ea710a7a8/nonebot_plugin_7s_roll-0.2.0.tar.gz",
    "platform": null,
    "description": "# Roll Dice\n\n\u6254\u9ab0\u5b50\u5c0f\u5de5\u5177\u3002\n\n0.2.0 \u7248\u672c\u652f\u6301 NoneBot2 2.0 \u6b63\u5f0f\u7248 API\uff0c\u4e0d\u4f9d\u8d56\u4efb\u4f55\u7279\u5b9a Adapter\u3002\n\n\u5728 OneBot V11 \u4e0b\u56de\u590d\u65f6\u652f\u6301 At\u3002\n\n## \u4f7f\u7528\n\n```python\n# load your driver, set adapter, builtin plugin etc.\nnonebot.load_plugin(\"nonebot_plugin_7s_roll\")\nnonebot.run()\n```\n\n\u5176\u4e2d .env \u6587\u4ef6\u9664\u4e86 nonebot \u7684\u5e38\u89c4\u914d\u7f6e\u9879\u5916\uff0c\u8fd8\u6709\u53ef\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\u5c5e\u6027\uff08\u793a\u4f8b\u4e2d\u7684\u662f\u9ed8\u8ba4\u503c\uff09\uff1a\n\n```env\n# \u547d\u4ee4\u540d\uff08\u5728 at \u673a\u5668\u4eba\u65f6\u4f7f\u7528\uff0c `@bot /roll 1d10`\uff09\nI7S_ROLL_COMMAND=\"roll\"\n# \u5173\u952e\u5b57\uff08\u76f4\u63a5\u4f7f\u7528\uff0c\u65e0\u9700 at, `roll 1d10`\uff09\nI7S_ROLL_TRIGGER=\"roll\"\n```\n\n## \u547d\u4ee4\n\n`roll <expr>[[ ]<operator>[ ]<target>]`\n\n\u5176\u4e2d\uff1a\n\n- `<expr>` \u8ba1\u7b97\u8868\u8fbe\u5f0f\uff0c\u683c\u5f0f\u4e3a\n  - `<roll>[[ ][+|-][ ]<roll>]...`\uff0c\u5176\u4e2d `roll` \u4e0d\u8d85\u8fc7 20 \u9879\uff0c\u5176\u683c\u5f0f\u4e3a\uff1a\n    - `<times>[d|D]<faces>[ ][<policy>]`\uff0c\u5176\u4e2d\n      - `<times>` \u4e3a\u6295\u63b7\u6b21\u6570\uff0c\u4e0d\u8d85\u8fc7 20 \u6b21\n      - `<faces>` \u4e3a\u9ab0\u5b50\u9762\u6570\uff0c\u4e0d\u8d85\u8fc7 1000 \u9762\n      - `<policy>` \u4e3a\u6295\u63b7\u65b9\u5f0f\uff0c\u9ed8\u8ba4\u4e3a `sum`\uff0c\u53ef\u9009\u65b9\u5f0f\u6709\uff1a\n        - `sum` \u6c42\u548c\n        - `min` \u53d6\u6700\u5c0f\u503c\n        - `max` \u53d6\u6700\u5927\u503c\n        - `avg` \u53d6\u5e73\u5747\u503c\n- `operator` \u4e3a\u6bd4\u8f83\u8fd0\u7b97\uff0c\u53ef\u4ee5\u4e3a\n  - `>`\u3001`\u5927\u4e8e`\n  - `<`\u3001`\u5c0f\u4e8e`\n  - `>=`\u3001`\u5927\u4e8e\u7b49\u4e8e`\n  - `<=`\u3001`\u5c0f\u4e8e\u7b49\u4e8e`\n- `target` \u4e3a\u671f\u671b\u76ee\u6807\n\n## \u4e3e\u4f8b\n\n`roll 3d6`\uff08\u5728\u53ea\u6709\u4e00\u4e2a `roll` \u65f6\uff0c\u4f1a\u663e\u793a\u7684\u6bd4\u8f83\u8be6\u7ec6\uff09:\n\n```text\n3d6 \u6295\u63b7\u7ed3\u679c\n\n\u7b2c 1 \u9897\uff1a5\n\u7b2c 2 \u9897\uff1a5\n\u7b2c 3 \u9897\uff1a6\n\n\u603b\u548c\u4e3a 16\n```\n\n`roll 3d10+2d6+1 >20`:\n\n```text\n3d10+2d6+1 \u6295\u63b7\u7ed3\u679c(\u76ee\u6807 > 20)\uff1a\n(5 + 1 + 9) + (4 + 5) + 1 = 25\uff0c\u901a\u8fc7\n```\n\n`roll 3d100max+4d10`\n\n```text\n3d100max+4d10 \u6295\u63b7\u7ed3\u679c\n(max[35, 60, 29] = 60) + (1 + 1 + 5 + 8) = 75\n```\n\n## \u622a\u56fe\n\n![screenshot-dice]\n\n## LICENSE\n\nMIT.\n\n[screenshot-dice]: https://rikka.7sdre.am/files/8c6c5b15-0343-4d14-a203-422c7d6c634e.png\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A roll dice plugin for nonebot",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/7sDream/nonebot_plugin_7s_roll",
        "Repository": "https://github.com/7sDream/nonebot_plugin_7s_roll"
    },
    "split_keywords": [
        "nonebot",
        "dice",
        "roll",
        "trpg"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b4aed6940e10515b286080416324a8f36c8ae94ca262be1e6314783d0de6e8d",
                "md5": "3118a0429f3b0007b1d1e81af8f264d0",
                "sha256": "412368e031cf6cf6eab4c1304c2718a074160f794eca578b2ed606f4fbf7c719"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_7s_roll-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3118a0429f3b0007b1d1e81af8f264d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 8527,
            "upload_time": "2023-06-21T03:49:38",
            "upload_time_iso_8601": "2023-06-21T03:49:38.647448Z",
            "url": "https://files.pythonhosted.org/packages/5b/4a/ed6940e10515b286080416324a8f36c8ae94ca262be1e6314783d0de6e8d/nonebot_plugin_7s_roll-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f03c64e25370f642c260c4e5516ec9894ad4670caeb6f8aea34581ea710a7a8",
                "md5": "141bf6b8a02ed9e4ea376883fd3ba203",
                "sha256": "056d61d7405eb8ec31fefe528c6957515d27cccd649cd8c83f386237275927b6"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_7s_roll-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "141bf6b8a02ed9e4ea376883fd3ba203",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 6175,
            "upload_time": "2023-06-21T03:49:40",
            "upload_time_iso_8601": "2023-06-21T03:49:40.312374Z",
            "url": "https://files.pythonhosted.org/packages/7f/03/c64e25370f642c260c4e5516ec9894ad4670caeb6f8aea34581ea710a7a8/nonebot_plugin_7s_roll-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-21 03:49:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "7sDream",
    "github_project": "nonebot_plugin_7s_roll",
    "github_not_found": true,
    "lcname": "nonebot-plugin-7s-roll"
}
        
Elapsed time: 0.09275s