NoneBot 可自定义骰子的骰子插件
Project description
📖 介绍
可以自定义骰子和卡组的桌面游戏辅助插件
骰子功能示例
add_dice 攻击 未命中 命中 命中|命中
roll 攻击 2d6
骰子结果
攻击 ×1:命中|命中
d6 ×2:2,1
合计3,2命中
卡组功能示例
add_deck 扑克牌 黑桃1|黑桃 黑桃K|黑桃 红心1|红心 红心K|红心
draw 扑克牌 2
抽卡结果(扑克牌 ×2):
- 黑桃1, 黑桃
- 红心K, 红心
标记统计:
黑桃1 ×1、黑桃 ×1、红心K ×1、红心 ×1
剩余:2张
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-dice-helper
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-dice-helper
pdm
pdm add nonebot-plugin-dice-helper
poetry
poetry add nonebot-plugin-dice-helper
conda
conda install nonebot-plugin-dice-helper
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot-plugin-dice-helper"]
⚙️ 配置
可以在nonebot_plugin_localstore的plugin_config_dir里面建立一个default_data.json,配置全局的自定义骰子和卡组(不能被命令删除)。 格式如下
{
"custom_dice": {
"硬币": [
["正面"],
["反面"]
]
},
"card_decks": {
"扑克牌": {
"cards": [
["黑桃1", "黑桃"],
["黑桃K", "黑桃"],
["红心1", "红心"],
["红心K", "红心"]
],
"shuffle_on_init": true // 可选,默认true,设为false时创建/重置保持固定顺序
}
}
}
🎉 使用
骰子指令
| 指令 | 权限(私聊不需要) | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
| roll/投掷 | 群员 | 否 | 群聊/私聊 | 投指定骰子 参数为 数量骰子名1 数量骰子名2... 数量1可以省略 dn为数字骰,不需要定义 eg. roll 4d6 硬币 |
| dice_list | 群员 | 否 | 群聊/私聊 | 查看所有骰子 |
| add_dice | 群管理/超级用户 | 否 | 群聊/私聊 | 增加自定义骰子 参数为 骰子名 面1 面2... 一面可以有多个标记,用|隔开 eg. add_dice 攻击 未命中 命中 命中|命中 |
| del_dice | 群管理/超级用户 | 否 | 群聊/私聊 | 删除自定义骰子 |
卡组指令
| 指令 | 权限(私聊不需要) | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
| deck_list/卡组列表 | 群员 | 否 | 群聊/私聊 | 查看所有卡组 |
| add_deck/添加卡组 | 群管理/超级用户 | 否 | 群聊/私聊 | 增加自定义卡组 参数为 卡组名 卡1 卡2... 每张卡可以有多个标记,用|隔开 eg. add_deck 扑克牌 黑桃1|黑桃 红心K|红心 |
| del_deck/删除卡组 | 群管理/超级用户 | 否 | 群聊/私聊 | 删除自定义卡组 |
| config_deck/配置卡组 | 群管理/超级用户 | 否 | 群聊/私聊 | 配置卡组参数 eg. config_deck 扑克牌 shuffle_on_init=false 设为false时创建/重置保持固定顺序 |
| draw_top/顶部抽卡/抽卡/draw | 群员 | 否 | 群聊/私聊 | 从卡组顶部抽卡 参数为 卡组名 [数量=1] eg. draw 扑克牌 2 |
| draw_bottom/底部抽卡 | 群员 | 否 | 群聊/私聊 | 从卡组底部抽卡 参数为 卡组名 [数量=1] eg. draw_bottom 扑克牌 1 |
| shuffle/洗混 | 群员 | 否 | 群聊/私聊 | 打乱卡组顺序 参数为 卡组名 eg. shuffle 扑克牌 |
| put_top/放顶部 | 群员 | 否 | 群聊/私聊 | 将卡牌放入卡组顶部 参数为 卡组名 卡1 [卡2]... eg. put_top 扑克牌 黑桃1|黑桃 |
| put_bottom/放底部 | 群员 | 否 | 群聊/私聊 | 将卡牌放入卡组底部 参数为 卡组名 卡1 [卡2]... eg. put_bottom 扑克牌 红心K|红心 |
| reset_deck/重置卡组 | 群员 | 否 | 群聊/私聊 | 恢复卡组到初始状态 参数为 卡组名 eg. reset_deck 扑克牌 |
| view_deck/查看卡组 | 群员 | 否 | 群聊/私聊 | 查看卡组剩余卡牌 超过20张时显示前后各10张 eg. view_deck 扑克牌 |
效果图
有时间上传
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_dice_helper-0.1.3.tar.gz.
File metadata
- Download URL: nonebot_plugin_dice_helper-0.1.3.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
945404197097b4db79e39d4efdfed8fa1408b94c3abb329e11080e522fa1c292
|
|
| MD5 |
73b06d0e1451ed3ab95e729df2c95d00
|
|
| BLAKE2b-256 |
f302f862c6ec54d65f9ac30925bc7b13032073e3e59b94d70a70262f113f7e61
|
File details
Details for the file nonebot_plugin_dice_helper-0.1.3-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_dice_helper-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e12629e09de5a9fde8451723a7de821dffcb404e3cb1c599724856081943118
|
|
| MD5 |
9d4484babc7eb2b083944efefe527640
|
|
| BLAKE2b-256 |
2f532c25e3be30580d89068fa78ab1c9ff31a682a28d1dd440256cb4461c0fa3
|