nonebot-plugin-werewolf 1.1.10__tar.gz → 1.1.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/PKG-INFO +122 -58
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/README.md +117 -53
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/__init__.py +1 -1
- nonebot_plugin_werewolf-1.1.12/nonebot_plugin_werewolf/config.py +126 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/constant.py +0 -19
- nonebot_plugin_werewolf-1.1.12/nonebot_plugin_werewolf/dead_channel.py +79 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/game.py +48 -117
- nonebot_plugin_werewolf-1.1.12/nonebot_plugin_werewolf/matchers/_prepare_game.py +223 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/depends.py +4 -4
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/edit_behavior.py +2 -2
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/edit_preset.py +20 -20
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/message_in_game.py +5 -1
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/poke/__init__.py +2 -1
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/poke/chronocat_poke.py +7 -12
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/poke/ob11_poke.py +8 -11
- nonebot_plugin_werewolf-1.1.12/nonebot_plugin_werewolf/matchers/start_game.py +123 -0
- nonebot_plugin_werewolf-1.1.12/nonebot_plugin_werewolf/matchers/superuser_ops.py +28 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/models.py +19 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/player.py +35 -31
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/player_set.py +10 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/guard.py +2 -2
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/prophet.py +2 -2
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/shooter.py +2 -2
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/werewolf.py +18 -19
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/witch.py +4 -4
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/utils.py +18 -56
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf.egg-info/PKG-INFO +122 -58
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf.egg-info/SOURCES.txt +5 -1
- nonebot_plugin_werewolf-1.1.12/nonebot_plugin_werewolf.egg-info/requires.txt +6 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/pyproject.toml +39 -16
- nonebot_plugin_werewolf-1.1.12/tests/test_start_game.py +145 -0
- nonebot_plugin_werewolf-1.1.12/tests/test_utils.py +16 -0
- nonebot_plugin_werewolf-1.1.10/nonebot_plugin_werewolf/config.py +0 -104
- nonebot_plugin_werewolf-1.1.10/nonebot_plugin_werewolf/matchers/start_game.py +0 -333
- nonebot_plugin_werewolf-1.1.10/nonebot_plugin_werewolf/matchers/superuser_ops.py +0 -24
- nonebot_plugin_werewolf-1.1.10/nonebot_plugin_werewolf.egg-info/requires.txt +0 -6
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/LICENSE +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/exception.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/matchers/__init__.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/__init__.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/civilian.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/hunter.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/idiot.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/jester.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf/players/wolfking.py +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf.egg-info/dependency_links.txt +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/nonebot_plugin_werewolf.egg-info/top_level.txt +0 -0
- {nonebot_plugin_werewolf-1.1.10 → nonebot_plugin_werewolf-1.1.12}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nonebot-plugin-werewolf
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.12
|
4
4
|
Summary: 适用于 Nonebot2 的狼人杀插件
|
5
5
|
Author-email: wyf7685 <wyf7685@163.com>
|
6
6
|
License: MIT
|
@@ -10,11 +10,11 @@ Project-URL: bug-tracker, https://github.com/wyf7685/nonebot-plugin-werewolf/iss
|
|
10
10
|
Requires-Python: >=3.10
|
11
11
|
Description-Content-Type: text/markdown
|
12
12
|
License-File: LICENSE
|
13
|
-
Requires-Dist: nonebot2>=2.
|
14
|
-
Requires-Dist: nonebot-plugin-alconna>=0.
|
13
|
+
Requires-Dist: nonebot2>=2.4.0
|
14
|
+
Requires-Dist: nonebot-plugin-alconna>=0.58.0
|
15
15
|
Requires-Dist: nonebot-plugin-localstore>=0.7.1
|
16
|
-
Requires-Dist: nonebot-plugin-uninfo>=0.
|
17
|
-
Requires-Dist: nonebot-plugin-waiter>=0.
|
16
|
+
Requires-Dist: nonebot-plugin-uninfo>=0.8.0
|
17
|
+
Requires-Dist: nonebot-plugin-waiter>=0.8.0
|
18
18
|
Requires-Dist: anyio>=4.6.0
|
19
19
|
Dynamic: license-file
|
20
20
|
|
@@ -39,7 +39,8 @@ _✨ 简单的狼人杀插件 ✨_
|
|
39
39
|
[](https://results.pre-commit.ci/latest/github/wyf7685/nonebot-plugin-werewolf/master)
|
40
40
|
[](https://github.com/wyf7685/nonebot-plugin-werewolf/actions/workflows/lint.yml)
|
41
41
|
|
42
|
-
<!-- https://github.com/lgc2333/nonebot-registry-badge -->
|
42
|
+
<!-- ref: https://github.com/lgc2333/nonebot-registry-badge -->
|
43
|
+
|
43
44
|
[](https://registry.nonebot.dev/plugin/nonebot-plugin-werewolf:nonebot_plugin_werewolf)
|
44
45
|
[](https://registry.nonebot.dev/plugin/nonebot-plugin-werewolf:nonebot_plugin_werewolf)
|
45
46
|
|
@@ -49,11 +50,26 @@ _✨ 简单的狼人杀插件 ✨_
|
|
49
50
|
|
50
51
|
和朋友们来一场紧张刺激的狼人杀游戏
|
51
52
|
|
53
|
+
<!-- ref: https://github.com/KomoriDev/Starify -->
|
54
|
+
|
55
|
+
> [!IMPORTANT]
|
56
|
+
> **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
|
57
|
+
|
58
|
+
<img width="100%" src="https://starify.komoridevs.icu/api/starify?owner=wyf7685&repo=nonebot-plugin-werewolf" alt="starify" />
|
59
|
+
|
60
|
+
<details>
|
61
|
+
<summary><kbd>Star History</kbd></summary>
|
62
|
+
<picture>
|
63
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=wyf7685/nonebot-plugin-werewolf&theme=dark&type=Date" />
|
64
|
+
<img width="100%" src="https://star-history.com/#wyf7685/nonebot-plugin-werewolf&Date" />
|
65
|
+
</picture>
|
66
|
+
</details>
|
67
|
+
|
52
68
|
## 💿 安装
|
53
69
|
|
54
70
|
> [!note]
|
55
71
|
>
|
56
|
-
> 请确保 NoneBot2 使用的 Python 解释器版本 >=3.10
|
72
|
+
> 请确保 [NoneBot2](https://nonebot.dev/) 使用的 Python 解释器版本 >=3.10
|
57
73
|
|
58
74
|
<details open>
|
59
75
|
<summary>使用 nb-cli 安装</summary>
|
@@ -65,12 +81,14 @@ _✨ 简单的狼人杀插件 ✨_
|
|
65
81
|
|
66
82
|
<details>
|
67
83
|
<summary>使用包管理器安装</summary>
|
84
|
+
<!-- 会用包管理器的用户真的需要这节吗 -->
|
85
|
+
|
68
86
|
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
|
69
87
|
|
70
|
-
<details>
|
71
|
-
<summary>
|
88
|
+
<details open>
|
89
|
+
<summary>uv</summary>
|
72
90
|
|
73
|
-
|
91
|
+
uv add nonebot-plugin-werewolf
|
74
92
|
|
75
93
|
</details>
|
76
94
|
<details>
|
@@ -90,6 +108,12 @@ _✨ 简单的狼人杀插件 ✨_
|
|
90
108
|
|
91
109
|
conda install nonebot-plugin-werewolf
|
92
110
|
|
111
|
+
</details>
|
112
|
+
<details>
|
113
|
+
<summary>pip</summary>
|
114
|
+
|
115
|
+
pip install nonebot-plugin-werewolf
|
116
|
+
|
93
117
|
</details>
|
94
118
|
|
95
119
|
打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
|
@@ -102,17 +126,41 @@ _✨ 简单的狼人杀插件 ✨_
|
|
102
126
|
|
103
127
|
在 nonebot2 项目的 `.env` 文件中添加如下配置:
|
104
128
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
129
|
+
| 配置项 | 必填 | 默认值 | 类型 | 说明 |
|
130
|
+
| :--------------------------: | :--: | :-----: | :-----------------------: | :----------------------------: |
|
131
|
+
| `werewolf__enable_poke` | 否 | `True` | `bool` | 是否使用戳一戳简化操作流程 |
|
132
|
+
| `werewolf__enable_button` | 否 | `False` | `bool` | 是否在交互中添加按钮 |
|
133
|
+
| `werewolf__stop_command` | 否 | `stop` | `str \| set[str]` | 修改游戏进程中的 `stop` 命令 |
|
134
|
+
| `werewolf__require_at` | 否 | `True` | `bool \| RequireAtConfig` | 部分命令是否需要 at 机器人触发 |
|
135
|
+
| `werewolf__matcher_priority` | 否 | - | `MatcherPriorityConfig` | 配置插件 matcher 注册的优先级 |
|
110
136
|
|
111
137
|
`werewolf__enable_poke` 仅在 `OneBot V11` 适配器 / `Satori/chronocat` 下生效
|
112
138
|
|
113
|
-
`werewolf__enable_button` 仅在 `Telegram`
|
139
|
+
`werewolf__enable_button` 仅在 `Telegram` 适配器下通过测试,不保证在其他适配器的可用性,如有疑问欢迎提出。
|
114
140
|
|
115
|
-
|
141
|
+
<details>
|
142
|
+
<summary> werewolf__require_at 示例 </summary>
|
143
|
+
|
144
|
+
```ini
|
145
|
+
# 所有命令均需 at 触发
|
146
|
+
werewolf__require_at=true
|
147
|
+
|
148
|
+
# 所有命令均不需 at 触发
|
149
|
+
werewolf__require_at=false
|
150
|
+
|
151
|
+
# 狼人杀命令需要 at, 中止游戏命令不需要 at
|
152
|
+
werewolf__require_at='{"start": true, "terminate": false}'
|
153
|
+
```
|
154
|
+
|
155
|
+
</details>
|
156
|
+
|
157
|
+
`werewolf__matcher_priority` 的 matcher 优先级参考 [官方文档](https://nonebot.dev/docs/advanced/matcher#%E5%93%8D%E5%BA%94%E4%BC%98%E5%85%88%E7%BA%A7)
|
158
|
+
|
159
|
+
- 一般情况下不需要修改此配置, 插件的默认优先级可以参考 [这里](./nonebot_plugin_werewolf/config.py) 的 `MatcherPriorityConfig`
|
160
|
+
- 如果遇到与其他插件的命令冲突, 可考虑修改此处的优先级配置
|
161
|
+
- 配置应填入 JSON 对象, 可用键: `start` `terminate` `preset` `behavior` `in_game` `stop`
|
162
|
+
|
163
|
+
## 🚀 使用
|
116
164
|
|
117
165
|
> [!note]
|
118
166
|
>
|
@@ -133,32 +181,33 @@ _✨ 简单的狼人杀插件 ✨_
|
|
133
181
|
|
134
182
|
</details>
|
135
183
|
|
136
|
-
### 指令表
|
184
|
+
### 📋 指令表
|
137
185
|
|
138
|
-
| 指令 | 权限 | 需要@ |
|
139
|
-
| :-----------------: | :-----------------: | :---: |
|
140
|
-
| `werewolf`/`狼人杀` | 群员 | 是 |
|
141
|
-
| `开始游戏` | 游戏发起者 | 否 | 群聊
|
142
|
-
| `结束游戏` | 游戏发起者/超级用户 | 否 | 群聊
|
143
|
-
| `当前玩家` | 群员 | 否 | 群聊
|
144
|
-
| `加入游戏` | 群员 | 否 | 群聊
|
145
|
-
| `退出游戏` | 群员 | 否 | 群聊
|
146
|
-
| `中止游戏` | 超级用户 | 是 |
|
147
|
-
| `狼人杀预设` | 超级用户 | 否 |
|
148
|
-
| `狼人杀配置` | 超级用户 | 否 |
|
186
|
+
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|
187
|
+
| :-----------------: | :-----------------: | :---: | :---------------: | :--------------------------: |
|
188
|
+
| `werewolf`/`狼人杀` | 群员 | 是 | 群聊 _[游戏外]_ | 发起游戏 (进入准备阶段) |
|
189
|
+
| `开始游戏` | 游戏发起者 | 否 | 群聊 _[准备阶段]_ | 游戏发起者开始游戏 |
|
190
|
+
| `结束游戏` | 游戏发起者/超级用户 | 否 | 群聊 _[准备阶段]_ | 游戏发起者/超级用户 结束游戏 |
|
191
|
+
| `当前玩家` | 群员 | 否 | 群聊 _[准备阶段]_ | 列出参与游戏的玩家列表 |
|
192
|
+
| `加入游戏` | 群员 | 否 | 群聊 _[准备阶段]_ | 玩家加入游戏 |
|
193
|
+
| `退出游戏` | 群员 | 否 | 群聊 _[准备阶段]_ | 玩家退出游戏 |
|
194
|
+
| `中止游戏` | 超级用户 | 是 | 群聊 _[游戏内]_ | 超级用户强制中止游戏 |
|
195
|
+
| `狼人杀预设` | 超级用户 | 否 | 任意 _[游戏外]_ | 超级用户编辑游戏预设 |
|
196
|
+
| `狼人杀配置` | 超级用户 | 否 | 任意 _[游戏外]_ | 超级用户编辑游戏配置 |
|
149
197
|
|
150
|
-
|
198
|
+
- `超级用户` 为 nonebot2 配置项中的 `SUPERUSERS`, 配置说明参考 [官方文档](https://nonebot.dev/docs/appendices/config#superusers)
|
151
199
|
|
152
|
-
|
200
|
+
- 发起游戏时添加 `restart`/`重开`, 可加载上一次游戏的玩家列表, 快速发起游戏。例: `werewolf restart`/`狼人杀 重开`
|
153
201
|
|
154
|
-
|
202
|
+
- `狼人杀预设` 命令用法可通过 `狼人杀预设 --help` 获取,或参考 [游戏内容](#游戏内容) 部分的介绍
|
155
203
|
|
156
|
-
|
204
|
+
- `狼人杀配置` 命令用法可通过 `狼人杀预设 --help` 获取
|
157
205
|
|
158
|
-
|
206
|
+
- 对于 `OneBot V11` 适配器和 `Satori` 适配器的 `chronocat`, 启用配置项 `werewolf__enable_poke` 后, 可以使用戳一戳代替 _准备阶段_ 的 `加入游戏` 操作 和 游戏内的 `stop` 命令
|
159
207
|
|
208
|
+
- _其他交互参考游戏内提示_
|
160
209
|
|
161
|
-
### 游戏内容
|
210
|
+
### 🎭 游戏内容
|
162
211
|
|
163
212
|
> [!note]
|
164
213
|
>
|
@@ -169,23 +218,23 @@ _✨ 简单的狼人杀插件 ✨_
|
|
169
218
|
插件中保存了一份 [职业预设](./nonebot_plugin_werewolf/constant.py), 内容如下
|
170
219
|
|
171
220
|
| 总人数 | 狼人 | 神职 | 平民 |
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
221
|
+
| :----: | :--: | :--: | :--: |
|
222
|
+
| 6 | 1 | 2 | 3 |
|
223
|
+
| 7 | 2 | 2 | 3 |
|
224
|
+
| 8 | 2 | 3 | 3 |
|
225
|
+
| 9 | 2 | 4 | 3 |
|
226
|
+
| 10 | 3 | 4 | 3 |
|
227
|
+
| 11 | 3 | 5 | 3 |
|
228
|
+
| 12 | 4 | 5 | 3 |
|
180
229
|
|
181
230
|
职业预设可以通过命令 `狼人杀预设 职业 ...` 修改
|
182
231
|
|
183
232
|
<details>
|
184
233
|
<summary>示例</summary>
|
185
234
|
|
186
|
-
|
235
|
+
- 命令: `狼人杀预设 职业 6 1 3 2`
|
187
236
|
|
188
|
-
|
237
|
+
- 上述命令指定当总人数为 6 时,狼人、神职、平民的数量分别为 1、3、2
|
189
238
|
|
190
239
|
</details>
|
191
240
|
<br/>
|
@@ -202,36 +251,42 @@ _✨ 简单的狼人杀插件 ✨_
|
|
202
251
|
|
203
252
|
#### 命令 `狼人杀预设 狼人`
|
204
253
|
|
205
|
-
|
254
|
+
- 命令: `狼人杀预设 狼人 狼 狼王 狼 狼`
|
206
255
|
|
207
|
-
|
256
|
+
- 上述命令指定狼人的职业优先级为 `狼人`, `狼王`, `狼人`, `狼人`
|
208
257
|
|
209
258
|
#### 命令 `狼人杀预设 神职`
|
210
259
|
|
211
|
-
|
260
|
+
- 命令: `狼人杀预设 神职 预言家 女巫 猎人 守卫 白痴`
|
212
261
|
|
213
|
-
|
262
|
+
- 上述命令指定神职的职业优先级为 `预言家`, `女巫`, `猎人`, `守卫`, `白痴`
|
214
263
|
|
215
264
|
> [!note]
|
216
265
|
>
|
217
|
-
> 以上两条命令均支持交互式输入
|
266
|
+
> 以上两条命令均支持交互式输入 ~~waiter 真好用~~
|
218
267
|
>
|
219
268
|
> 例:向机器人发送命令 `狼人杀预设 狼人`,在接下来的一条消息中发送 `狼人 狼王 狼人 狼人`
|
220
269
|
>
|
221
270
|
> 其效果等同于以上描述中的单条命令 `狼人杀预设 狼人 狼人 狼王 狼人 狼人`
|
222
271
|
|
223
272
|
</details>
|
224
|
-
<br/>
|
225
273
|
|
226
|
-
对于 `小丑` 职业,当预设中的平民数量大于或等于 2 时,将有
|
274
|
+
对于 `小丑` 职业,当预设中的平民数量大于或等于 2 时,将有 _一定概率_ 将其中一个平民替换为小丑。
|
227
275
|
|
228
276
|
小丑属于第三方阵营,胜利条件为在投票阶段被票出,在预言家查验及游戏进程判断时视作平民。
|
229
277
|
|
230
278
|
小丑生成概率可以通过命令 `狼人杀预设 小丑 <概率>` 设置,默认值为 0 (不生成小丑)。
|
231
279
|
|
232
|
-
### 已知问题
|
280
|
+
### 🔧 已知问题
|
233
281
|
|
234
|
-
|
282
|
+
<details>
|
283
|
+
<summary>已知问题</summary>
|
284
|
+
|
285
|
+
- 截止 chronocat [v0.2.19](https://github.com/chrononeko/chronocat/tree/v0.2.19), 调用 [`guild.member.get`](https://github.com/chrononeko/chronocat/blob/8558ad9ff4319395d86abbfda22136939bf66780/packages/engine-chronocat-api/src/api/guild/member/get.ts) / [`user.get`](https://github.com/chrononeko/chronocat/blob/8558ad9ff4319395d86abbfda22136939bf66780/packages/engine-chronocat-api/src/api/user/get.ts) 均无法获取用户名,这将导致在交互过程中的玩家名显示为用户 ID
|
286
|
+
|
287
|
+
- v1.1.6 添加的按钮操作在 `discord` 适配器中不可用, 已在 v1.1.12 禁用 (2e31d43)
|
288
|
+
|
289
|
+
</details>
|
235
290
|
|
236
291
|
## 📝 更新日志
|
237
292
|
|
@@ -240,16 +295,25 @@ _✨ 简单的狼人杀插件 ✨_
|
|
240
295
|
|
241
296
|
<!-- CHANGELOG -->
|
242
297
|
|
298
|
+
- 2025.06.01 v1.1.12
|
299
|
+
|
300
|
+
- 禁用 `discord` 适配器中的按钮操作 ~~以后会写适配的...吗?~~
|
301
|
+
|
302
|
+
- 2025.04.20 v1.1.11
|
303
|
+
|
304
|
+
- 添加配置项 `werewolf__require_at`, 用于配置命令是否需要 at 机器人触发
|
305
|
+
- 添加配置项 `werewolf__matcher_priority`, 用于配置插件 matcher 注册优先级
|
306
|
+
|
243
307
|
- 2025.04.17 v1.1.10
|
244
308
|
|
245
309
|
- 添加狼人多选目标配置项显示
|
246
|
-
- 在游戏开始时打乱并固定轮流发言模式的发言顺序
|
310
|
+
- 在游戏开始时打乱并固定轮流发言模式的发言顺序 (#20)
|
247
311
|
|
248
312
|
- 2025.04.15 v1.1.9
|
249
313
|
|
250
314
|
- 添加游戏行为配置 `werewolf_multi_select`
|
251
315
|
- 重构玩家类
|
252
|
-
- 添加轮流发言模式缺失的 at 消息段
|
316
|
+
- 添加轮流发言模式缺失的 at 消息段 (#19)
|
253
317
|
|
254
318
|
- 2025.02.13 v1.1.8
|
255
319
|
|
@@ -259,7 +323,7 @@ _✨ 简单的狼人杀插件 ✨_
|
|
259
323
|
|
260
324
|
- 2024.10.31 v1.1.7
|
261
325
|
|
262
|
-
-
|
326
|
+
- _Bug fix_
|
263
327
|
|
264
328
|
- 2024.10.31 v1.1.6
|
265
329
|
|
@@ -319,7 +383,7 @@ _✨ 简单的狼人杀插件 ✨_
|
|
319
383
|
|
320
384
|
</details>
|
321
385
|
|
322
|
-
## 鸣谢
|
386
|
+
## 🎉 鸣谢
|
323
387
|
|
324
388
|
- [`nonebot/nonebot2`](https://github.com/nonebot/nonebot2): 跨平台 Python 异步机器人框架
|
325
389
|
- [`nonebot/plugin-alconna`](https://github.com/nonebot/plugin-alconna): 跨平台的消息处理接口
|
@@ -19,7 +19,8 @@ _✨ 简单的狼人杀插件 ✨_
|
|
19
19
|
[](https://results.pre-commit.ci/latest/github/wyf7685/nonebot-plugin-werewolf/master)
|
20
20
|
[](https://github.com/wyf7685/nonebot-plugin-werewolf/actions/workflows/lint.yml)
|
21
21
|
|
22
|
-
<!-- https://github.com/lgc2333/nonebot-registry-badge -->
|
22
|
+
<!-- ref: https://github.com/lgc2333/nonebot-registry-badge -->
|
23
|
+
|
23
24
|
[](https://registry.nonebot.dev/plugin/nonebot-plugin-werewolf:nonebot_plugin_werewolf)
|
24
25
|
[](https://registry.nonebot.dev/plugin/nonebot-plugin-werewolf:nonebot_plugin_werewolf)
|
25
26
|
|
@@ -29,11 +30,26 @@ _✨ 简单的狼人杀插件 ✨_
|
|
29
30
|
|
30
31
|
和朋友们来一场紧张刺激的狼人杀游戏
|
31
32
|
|
33
|
+
<!-- ref: https://github.com/KomoriDev/Starify -->
|
34
|
+
|
35
|
+
> [!IMPORTANT]
|
36
|
+
> **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
|
37
|
+
|
38
|
+
<img width="100%" src="https://starify.komoridevs.icu/api/starify?owner=wyf7685&repo=nonebot-plugin-werewolf" alt="starify" />
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Star History</kbd></summary>
|
42
|
+
<picture>
|
43
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=wyf7685/nonebot-plugin-werewolf&theme=dark&type=Date" />
|
44
|
+
<img width="100%" src="https://star-history.com/#wyf7685/nonebot-plugin-werewolf&Date" />
|
45
|
+
</picture>
|
46
|
+
</details>
|
47
|
+
|
32
48
|
## 💿 安装
|
33
49
|
|
34
50
|
> [!note]
|
35
51
|
>
|
36
|
-
> 请确保 NoneBot2 使用的 Python 解释器版本 >=3.10
|
52
|
+
> 请确保 [NoneBot2](https://nonebot.dev/) 使用的 Python 解释器版本 >=3.10
|
37
53
|
|
38
54
|
<details open>
|
39
55
|
<summary>使用 nb-cli 安装</summary>
|
@@ -45,12 +61,14 @@ _✨ 简单的狼人杀插件 ✨_
|
|
45
61
|
|
46
62
|
<details>
|
47
63
|
<summary>使用包管理器安装</summary>
|
64
|
+
<!-- 会用包管理器的用户真的需要这节吗 -->
|
65
|
+
|
48
66
|
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
|
49
67
|
|
50
|
-
<details>
|
51
|
-
<summary>
|
68
|
+
<details open>
|
69
|
+
<summary>uv</summary>
|
52
70
|
|
53
|
-
|
71
|
+
uv add nonebot-plugin-werewolf
|
54
72
|
|
55
73
|
</details>
|
56
74
|
<details>
|
@@ -70,6 +88,12 @@ _✨ 简单的狼人杀插件 ✨_
|
|
70
88
|
|
71
89
|
conda install nonebot-plugin-werewolf
|
72
90
|
|
91
|
+
</details>
|
92
|
+
<details>
|
93
|
+
<summary>pip</summary>
|
94
|
+
|
95
|
+
pip install nonebot-plugin-werewolf
|
96
|
+
|
73
97
|
</details>
|
74
98
|
|
75
99
|
打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
|
@@ -82,17 +106,41 @@ _✨ 简单的狼人杀插件 ✨_
|
|
82
106
|
|
83
107
|
在 nonebot2 项目的 `.env` 文件中添加如下配置:
|
84
108
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
109
|
+
| 配置项 | 必填 | 默认值 | 类型 | 说明 |
|
110
|
+
| :--------------------------: | :--: | :-----: | :-----------------------: | :----------------------------: |
|
111
|
+
| `werewolf__enable_poke` | 否 | `True` | `bool` | 是否使用戳一戳简化操作流程 |
|
112
|
+
| `werewolf__enable_button` | 否 | `False` | `bool` | 是否在交互中添加按钮 |
|
113
|
+
| `werewolf__stop_command` | 否 | `stop` | `str \| set[str]` | 修改游戏进程中的 `stop` 命令 |
|
114
|
+
| `werewolf__require_at` | 否 | `True` | `bool \| RequireAtConfig` | 部分命令是否需要 at 机器人触发 |
|
115
|
+
| `werewolf__matcher_priority` | 否 | - | `MatcherPriorityConfig` | 配置插件 matcher 注册的优先级 |
|
90
116
|
|
91
117
|
`werewolf__enable_poke` 仅在 `OneBot V11` 适配器 / `Satori/chronocat` 下生效
|
92
118
|
|
93
|
-
`werewolf__enable_button` 仅在 `Telegram`
|
119
|
+
`werewolf__enable_button` 仅在 `Telegram` 适配器下通过测试,不保证在其他适配器的可用性,如有疑问欢迎提出。
|
94
120
|
|
95
|
-
|
121
|
+
<details>
|
122
|
+
<summary> werewolf__require_at 示例 </summary>
|
123
|
+
|
124
|
+
```ini
|
125
|
+
# 所有命令均需 at 触发
|
126
|
+
werewolf__require_at=true
|
127
|
+
|
128
|
+
# 所有命令均不需 at 触发
|
129
|
+
werewolf__require_at=false
|
130
|
+
|
131
|
+
# 狼人杀命令需要 at, 中止游戏命令不需要 at
|
132
|
+
werewolf__require_at='{"start": true, "terminate": false}'
|
133
|
+
```
|
134
|
+
|
135
|
+
</details>
|
136
|
+
|
137
|
+
`werewolf__matcher_priority` 的 matcher 优先级参考 [官方文档](https://nonebot.dev/docs/advanced/matcher#%E5%93%8D%E5%BA%94%E4%BC%98%E5%85%88%E7%BA%A7)
|
138
|
+
|
139
|
+
- 一般情况下不需要修改此配置, 插件的默认优先级可以参考 [这里](./nonebot_plugin_werewolf/config.py) 的 `MatcherPriorityConfig`
|
140
|
+
- 如果遇到与其他插件的命令冲突, 可考虑修改此处的优先级配置
|
141
|
+
- 配置应填入 JSON 对象, 可用键: `start` `terminate` `preset` `behavior` `in_game` `stop`
|
142
|
+
|
143
|
+
## 🚀 使用
|
96
144
|
|
97
145
|
> [!note]
|
98
146
|
>
|
@@ -113,32 +161,33 @@ _✨ 简单的狼人杀插件 ✨_
|
|
113
161
|
|
114
162
|
</details>
|
115
163
|
|
116
|
-
### 指令表
|
164
|
+
### 📋 指令表
|
117
165
|
|
118
|
-
| 指令 | 权限 | 需要@ |
|
119
|
-
| :-----------------: | :-----------------: | :---: |
|
120
|
-
| `werewolf`/`狼人杀` | 群员 | 是 |
|
121
|
-
| `开始游戏` | 游戏发起者 | 否 | 群聊
|
122
|
-
| `结束游戏` | 游戏发起者/超级用户 | 否 | 群聊
|
123
|
-
| `当前玩家` | 群员 | 否 | 群聊
|
124
|
-
| `加入游戏` | 群员 | 否 | 群聊
|
125
|
-
| `退出游戏` | 群员 | 否 | 群聊
|
126
|
-
| `中止游戏` | 超级用户 | 是 |
|
127
|
-
| `狼人杀预设` | 超级用户 | 否 |
|
128
|
-
| `狼人杀配置` | 超级用户 | 否 |
|
166
|
+
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|
167
|
+
| :-----------------: | :-----------------: | :---: | :---------------: | :--------------------------: |
|
168
|
+
| `werewolf`/`狼人杀` | 群员 | 是 | 群聊 _[游戏外]_ | 发起游戏 (进入准备阶段) |
|
169
|
+
| `开始游戏` | 游戏发起者 | 否 | 群聊 _[准备阶段]_ | 游戏发起者开始游戏 |
|
170
|
+
| `结束游戏` | 游戏发起者/超级用户 | 否 | 群聊 _[准备阶段]_ | 游戏发起者/超级用户 结束游戏 |
|
171
|
+
| `当前玩家` | 群员 | 否 | 群聊 _[准备阶段]_ | 列出参与游戏的玩家列表 |
|
172
|
+
| `加入游戏` | 群员 | 否 | 群聊 _[准备阶段]_ | 玩家加入游戏 |
|
173
|
+
| `退出游戏` | 群员 | 否 | 群聊 _[准备阶段]_ | 玩家退出游戏 |
|
174
|
+
| `中止游戏` | 超级用户 | 是 | 群聊 _[游戏内]_ | 超级用户强制中止游戏 |
|
175
|
+
| `狼人杀预设` | 超级用户 | 否 | 任意 _[游戏外]_ | 超级用户编辑游戏预设 |
|
176
|
+
| `狼人杀配置` | 超级用户 | 否 | 任意 _[游戏外]_ | 超级用户编辑游戏配置 |
|
129
177
|
|
130
|
-
|
178
|
+
- `超级用户` 为 nonebot2 配置项中的 `SUPERUSERS`, 配置说明参考 [官方文档](https://nonebot.dev/docs/appendices/config#superusers)
|
131
179
|
|
132
|
-
|
180
|
+
- 发起游戏时添加 `restart`/`重开`, 可加载上一次游戏的玩家列表, 快速发起游戏。例: `werewolf restart`/`狼人杀 重开`
|
133
181
|
|
134
|
-
|
182
|
+
- `狼人杀预设` 命令用法可通过 `狼人杀预设 --help` 获取,或参考 [游戏内容](#游戏内容) 部分的介绍
|
135
183
|
|
136
|
-
|
184
|
+
- `狼人杀配置` 命令用法可通过 `狼人杀预设 --help` 获取
|
137
185
|
|
138
|
-
|
186
|
+
- 对于 `OneBot V11` 适配器和 `Satori` 适配器的 `chronocat`, 启用配置项 `werewolf__enable_poke` 后, 可以使用戳一戳代替 _准备阶段_ 的 `加入游戏` 操作 和 游戏内的 `stop` 命令
|
139
187
|
|
188
|
+
- _其他交互参考游戏内提示_
|
140
189
|
|
141
|
-
### 游戏内容
|
190
|
+
### 🎭 游戏内容
|
142
191
|
|
143
192
|
> [!note]
|
144
193
|
>
|
@@ -149,23 +198,23 @@ _✨ 简单的狼人杀插件 ✨_
|
|
149
198
|
插件中保存了一份 [职业预设](./nonebot_plugin_werewolf/constant.py), 内容如下
|
150
199
|
|
151
200
|
| 总人数 | 狼人 | 神职 | 平民 |
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
201
|
+
| :----: | :--: | :--: | :--: |
|
202
|
+
| 6 | 1 | 2 | 3 |
|
203
|
+
| 7 | 2 | 2 | 3 |
|
204
|
+
| 8 | 2 | 3 | 3 |
|
205
|
+
| 9 | 2 | 4 | 3 |
|
206
|
+
| 10 | 3 | 4 | 3 |
|
207
|
+
| 11 | 3 | 5 | 3 |
|
208
|
+
| 12 | 4 | 5 | 3 |
|
160
209
|
|
161
210
|
职业预设可以通过命令 `狼人杀预设 职业 ...` 修改
|
162
211
|
|
163
212
|
<details>
|
164
213
|
<summary>示例</summary>
|
165
214
|
|
166
|
-
|
215
|
+
- 命令: `狼人杀预设 职业 6 1 3 2`
|
167
216
|
|
168
|
-
|
217
|
+
- 上述命令指定当总人数为 6 时,狼人、神职、平民的数量分别为 1、3、2
|
169
218
|
|
170
219
|
</details>
|
171
220
|
<br/>
|
@@ -182,36 +231,42 @@ _✨ 简单的狼人杀插件 ✨_
|
|
182
231
|
|
183
232
|
#### 命令 `狼人杀预设 狼人`
|
184
233
|
|
185
|
-
|
234
|
+
- 命令: `狼人杀预设 狼人 狼 狼王 狼 狼`
|
186
235
|
|
187
|
-
|
236
|
+
- 上述命令指定狼人的职业优先级为 `狼人`, `狼王`, `狼人`, `狼人`
|
188
237
|
|
189
238
|
#### 命令 `狼人杀预设 神职`
|
190
239
|
|
191
|
-
|
240
|
+
- 命令: `狼人杀预设 神职 预言家 女巫 猎人 守卫 白痴`
|
192
241
|
|
193
|
-
|
242
|
+
- 上述命令指定神职的职业优先级为 `预言家`, `女巫`, `猎人`, `守卫`, `白痴`
|
194
243
|
|
195
244
|
> [!note]
|
196
245
|
>
|
197
|
-
> 以上两条命令均支持交互式输入
|
246
|
+
> 以上两条命令均支持交互式输入 ~~waiter 真好用~~
|
198
247
|
>
|
199
248
|
> 例:向机器人发送命令 `狼人杀预设 狼人`,在接下来的一条消息中发送 `狼人 狼王 狼人 狼人`
|
200
249
|
>
|
201
250
|
> 其效果等同于以上描述中的单条命令 `狼人杀预设 狼人 狼人 狼王 狼人 狼人`
|
202
251
|
|
203
252
|
</details>
|
204
|
-
<br/>
|
205
253
|
|
206
|
-
对于 `小丑` 职业,当预设中的平民数量大于或等于 2 时,将有
|
254
|
+
对于 `小丑` 职业,当预设中的平民数量大于或等于 2 时,将有 _一定概率_ 将其中一个平民替换为小丑。
|
207
255
|
|
208
256
|
小丑属于第三方阵营,胜利条件为在投票阶段被票出,在预言家查验及游戏进程判断时视作平民。
|
209
257
|
|
210
258
|
小丑生成概率可以通过命令 `狼人杀预设 小丑 <概率>` 设置,默认值为 0 (不生成小丑)。
|
211
259
|
|
212
|
-
### 已知问题
|
260
|
+
### 🔧 已知问题
|
213
261
|
|
214
|
-
|
262
|
+
<details>
|
263
|
+
<summary>已知问题</summary>
|
264
|
+
|
265
|
+
- 截止 chronocat [v0.2.19](https://github.com/chrononeko/chronocat/tree/v0.2.19), 调用 [`guild.member.get`](https://github.com/chrononeko/chronocat/blob/8558ad9ff4319395d86abbfda22136939bf66780/packages/engine-chronocat-api/src/api/guild/member/get.ts) / [`user.get`](https://github.com/chrononeko/chronocat/blob/8558ad9ff4319395d86abbfda22136939bf66780/packages/engine-chronocat-api/src/api/user/get.ts) 均无法获取用户名,这将导致在交互过程中的玩家名显示为用户 ID
|
266
|
+
|
267
|
+
- v1.1.6 添加的按钮操作在 `discord` 适配器中不可用, 已在 v1.1.12 禁用 (2e31d43)
|
268
|
+
|
269
|
+
</details>
|
215
270
|
|
216
271
|
## 📝 更新日志
|
217
272
|
|
@@ -220,16 +275,25 @@ _✨ 简单的狼人杀插件 ✨_
|
|
220
275
|
|
221
276
|
<!-- CHANGELOG -->
|
222
277
|
|
278
|
+
- 2025.06.01 v1.1.12
|
279
|
+
|
280
|
+
- 禁用 `discord` 适配器中的按钮操作 ~~以后会写适配的...吗?~~
|
281
|
+
|
282
|
+
- 2025.04.20 v1.1.11
|
283
|
+
|
284
|
+
- 添加配置项 `werewolf__require_at`, 用于配置命令是否需要 at 机器人触发
|
285
|
+
- 添加配置项 `werewolf__matcher_priority`, 用于配置插件 matcher 注册优先级
|
286
|
+
|
223
287
|
- 2025.04.17 v1.1.10
|
224
288
|
|
225
289
|
- 添加狼人多选目标配置项显示
|
226
|
-
- 在游戏开始时打乱并固定轮流发言模式的发言顺序
|
290
|
+
- 在游戏开始时打乱并固定轮流发言模式的发言顺序 (#20)
|
227
291
|
|
228
292
|
- 2025.04.15 v1.1.9
|
229
293
|
|
230
294
|
- 添加游戏行为配置 `werewolf_multi_select`
|
231
295
|
- 重构玩家类
|
232
|
-
- 添加轮流发言模式缺失的 at 消息段
|
296
|
+
- 添加轮流发言模式缺失的 at 消息段 (#19)
|
233
297
|
|
234
298
|
- 2025.02.13 v1.1.8
|
235
299
|
|
@@ -239,7 +303,7 @@ _✨ 简单的狼人杀插件 ✨_
|
|
239
303
|
|
240
304
|
- 2024.10.31 v1.1.7
|
241
305
|
|
242
|
-
-
|
306
|
+
- _Bug fix_
|
243
307
|
|
244
308
|
- 2024.10.31 v1.1.6
|
245
309
|
|
@@ -299,7 +363,7 @@ _✨ 简单的狼人杀插件 ✨_
|
|
299
363
|
|
300
364
|
</details>
|
301
365
|
|
302
|
-
## 鸣谢
|
366
|
+
## 🎉 鸣谢
|
303
367
|
|
304
368
|
- [`nonebot/nonebot2`](https://github.com/nonebot/nonebot2): 跨平台 Python 异步机器人框架
|
305
369
|
- [`nonebot/plugin-alconna`](https://github.com/nonebot/plugin-alconna): 跨平台的消息处理接口
|