A roll dice plugin for nonebot
Project description
Roll Dice
扔骰子小工具。
使用
# 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
截图
LICENSE
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for nonebot_plugin_7s_roll-0.2.0a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a388946a12aa91a22eff21cbc2cb92c7c36ca6090c4ac2de08ba36919089402b |
|
MD5 | 64ab18cf488699e51eec2079da1361c7 |
|
BLAKE2b-256 | ad4db7b2c2dc12988dc5990e6b1b470e94789e1cbc6e7364a35c1c029e42043a |
Close
Hashes for nonebot_plugin_7s_roll-0.2.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059d975f6e9ac083a74ffe52c5c6f5458c0b4b9613908d3512e051417c66a84a |
|
MD5 | c09643b3d706d9cba15fcd2aa355cd8d |
|
BLAKE2b-256 | 422766c9d394aa18a2e013c32e18acd636c5ceee4c0e79befe5e86439db8975a |