Skip to main content

Roll Dice

扔骰子小工具。

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

在 OneBot V11 下回复时支持 At。

使用

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

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

# 命令名(在 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 时,会显示的比较详细):

3d6 投掷结果

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

总和为 16

roll 3d10+2d6+1 >20:

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

roll 3d100max+4d10

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

截图

screenshot-dice

LICENSE

MIT.

Metadata

Release files for nonebot-plugin-7s-roll 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-7s-roll 0.2.0
File Size Uploaded Provenance
nonebot_plugin_7s_roll-0.2.0.tar.gz 6.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-7s-roll 0.2.0
File Interpreter ABI Platform
nonebot_plugin_7s_roll-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / nonebot_plugin_7s_roll-0.2.0.tar.gz

Download URL nonebot_plugin_7s_roll-0.2.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
056d61d7405eb8ec31fefe528c6957515d27cccd649cd8c83f386237275927b6
BLAKE2b-256 checksum
How to use checksums
7f03c64e25370f642c260c4e5516ec9894ad4670caeb6f8aea34581ea710a7a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.3 Darwin/22.5.0

Release files / nonebot_plugin_7s_roll-0.2.0-py3-none-any.whl

Download URL nonebot_plugin_7s_roll-0.2.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
412368e031cf6cf6eab4c1304c2718a074160f794eca578b2ed606f4fbf7c719
BLAKE2b-256 checksum
How to use checksums
5b4aed6940e10515b286080416324a8f36c8ae94ca262be1e6314783d0de6e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.3 Darwin/22.5.0

Security for nonebot-plugin-7s-roll 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page