nonebot-plugin-werewolf 1.1.12__tar.gz → 1.1.13__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.
Files changed (44) hide show
  1. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/PKG-INFO +18 -9
  2. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/README.md +17 -8
  3. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/__init__.py +1 -1
  4. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/config.py +15 -2
  5. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/edit_behavior.py +1 -0
  6. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/edit_preset.py +1 -0
  7. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/message_in_game.py +1 -1
  8. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/start_game.py +1 -0
  9. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/superuser_ops.py +1 -0
  10. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf.egg-info/PKG-INFO +18 -9
  11. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/pyproject.toml +1 -1
  12. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/LICENSE +0 -0
  13. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/constant.py +0 -0
  14. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/dead_channel.py +0 -0
  15. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/exception.py +0 -0
  16. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/game.py +0 -0
  17. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/__init__.py +0 -0
  18. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/_prepare_game.py +0 -0
  19. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/depends.py +0 -0
  20. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/poke/__init__.py +0 -0
  21. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/poke/chronocat_poke.py +0 -0
  22. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/matchers/poke/ob11_poke.py +0 -0
  23. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/models.py +0 -0
  24. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/player.py +0 -0
  25. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/player_set.py +0 -0
  26. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/__init__.py +0 -0
  27. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/civilian.py +0 -0
  28. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/guard.py +0 -0
  29. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/hunter.py +0 -0
  30. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/idiot.py +0 -0
  31. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/jester.py +0 -0
  32. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/prophet.py +0 -0
  33. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/shooter.py +0 -0
  34. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/werewolf.py +0 -0
  35. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/witch.py +0 -0
  36. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/players/wolfking.py +0 -0
  37. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf/utils.py +0 -0
  38. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf.egg-info/SOURCES.txt +0 -0
  39. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf.egg-info/dependency_links.txt +0 -0
  40. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf.egg-info/requires.txt +0 -0
  41. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/nonebot_plugin_werewolf.egg-info/top_level.txt +0 -0
  42. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/setup.cfg +0 -0
  43. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/tests/test_start_game.py +0 -0
  44. {nonebot_plugin_werewolf-1.1.12 → nonebot_plugin_werewolf-1.1.13}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-werewolf
3
- Version: 1.1.12
3
+ Version: 1.1.13
4
4
  Summary: 适用于 Nonebot2 的狼人杀插件
5
5
  Author-email: wyf7685 <wyf7685@163.com>
6
6
  License: MIT
@@ -53,7 +53,8 @@ _✨ 简单的狼人杀插件 ✨_
53
53
  <!-- ref: https://github.com/KomoriDev/Starify -->
54
54
 
55
55
  > [!IMPORTANT]
56
- > **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
56
+ >
57
+ > **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~ ⭐️
57
58
 
58
59
  <img width="100%" src="https://starify.komoridevs.icu/api/starify?owner=wyf7685&repo=nonebot-plugin-werewolf" alt="starify" />
59
60
 
@@ -126,13 +127,14 @@ _✨ 简单的狼人杀插件 ✨_
126
127
 
127
128
  在 nonebot2 项目的 `.env` 文件中添加如下配置:
128
129
 
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 注册的优先级 |
130
+ | 配置项 | 必填 | 默认值 | 类型 | 说明 |
131
+ | :--------------------------: | :--: | :-----: | :-----------------------: | :-------------------------------------------: |
132
+ | `werewolf__enable_poke` | 否 | `True` | `bool` | 是否使用戳一戳简化操作流程 |
133
+ | `werewolf__enable_button` | 否 | `False` | `bool` | 是否在交互中添加按钮 |
134
+ | `werewolf__stop_command` | 否 | `stop` | `str \| set[str]` | 修改游戏进程中的 `stop` 命令 |
135
+ | `werewolf__require_at` | 否 | `True` | `bool \| RequireAtConfig` | 部分命令是否需要 at 机器人触发 |
136
+ | `werewolf__matcher_priority` | 否 | - | `MatcherPriorityConfig` | 配置插件 matcher 注册的优先级 |
137
+ | `werewolf__use_cmd_start` | 否 | `None` | `bool \| None` | 是否使用配置项 `COMMAND_START` 来作为命令前缀 |
136
138
 
137
139
  `werewolf__enable_poke` 仅在 `OneBot V11` 适配器 / `Satori/chronocat` 下生效
138
140
 
@@ -160,6 +162,8 @@ werewolf__require_at='{"start": true, "terminate": false}'
160
162
  - 如果遇到与其他插件的命令冲突, 可考虑修改此处的优先级配置
161
163
  - 配置应填入 JSON 对象, 可用键: `start` `terminate` `preset` `behavior` `in_game` `stop`
162
164
 
165
+ `werewolf__use_cmd_start` 为 `None` 时,使用 alc 的 [全局配置](https://nonebot.dev/docs/next/best-practice/alconna/config#alconna_use_command_start)
166
+
163
167
  ## 🚀 使用
164
168
 
165
169
  > [!note]
@@ -295,6 +299,11 @@ werewolf__require_at='{"start": true, "terminate": false}'
295
299
 
296
300
  <!-- CHANGELOG -->
297
301
 
302
+ - 2025.06.04 v1.1.13
303
+
304
+ - 添加配置项 `werewolf__use_cmd_start`, 用于配置插件命令前缀
305
+ - 调整 v1.1.11 优先级配置的默认值
306
+
298
307
  - 2025.06.01 v1.1.12
299
308
 
300
309
  - 禁用 `discord` 适配器中的按钮操作 ~~以后会写适配的...吗?~~
@@ -33,7 +33,8 @@ _✨ 简单的狼人杀插件 ✨_
33
33
  <!-- ref: https://github.com/KomoriDev/Starify -->
34
34
 
35
35
  > [!IMPORTANT]
36
- > **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
36
+ >
37
+ > **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~ ⭐️
37
38
 
38
39
  <img width="100%" src="https://starify.komoridevs.icu/api/starify?owner=wyf7685&repo=nonebot-plugin-werewolf" alt="starify" />
39
40
 
@@ -106,13 +107,14 @@ _✨ 简单的狼人杀插件 ✨_
106
107
 
107
108
  在 nonebot2 项目的 `.env` 文件中添加如下配置:
108
109
 
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 注册的优先级 |
110
+ | 配置项 | 必填 | 默认值 | 类型 | 说明 |
111
+ | :--------------------------: | :--: | :-----: | :-----------------------: | :-------------------------------------------: |
112
+ | `werewolf__enable_poke` | 否 | `True` | `bool` | 是否使用戳一戳简化操作流程 |
113
+ | `werewolf__enable_button` | 否 | `False` | `bool` | 是否在交互中添加按钮 |
114
+ | `werewolf__stop_command` | 否 | `stop` | `str \| set[str]` | 修改游戏进程中的 `stop` 命令 |
115
+ | `werewolf__require_at` | 否 | `True` | `bool \| RequireAtConfig` | 部分命令是否需要 at 机器人触发 |
116
+ | `werewolf__matcher_priority` | 否 | - | `MatcherPriorityConfig` | 配置插件 matcher 注册的优先级 |
117
+ | `werewolf__use_cmd_start` | 否 | `None` | `bool \| None` | 是否使用配置项 `COMMAND_START` 来作为命令前缀 |
116
118
 
117
119
  `werewolf__enable_poke` 仅在 `OneBot V11` 适配器 / `Satori/chronocat` 下生效
118
120
 
@@ -140,6 +142,8 @@ werewolf__require_at='{"start": true, "terminate": false}'
140
142
  - 如果遇到与其他插件的命令冲突, 可考虑修改此处的优先级配置
141
143
  - 配置应填入 JSON 对象, 可用键: `start` `terminate` `preset` `behavior` `in_game` `stop`
142
144
 
145
+ `werewolf__use_cmd_start` 为 `None` 时,使用 alc 的 [全局配置](https://nonebot.dev/docs/next/best-practice/alconna/config#alconna_use_command_start)
146
+
143
147
  ## 🚀 使用
144
148
 
145
149
  > [!note]
@@ -275,6 +279,11 @@ werewolf__require_at='{"start": true, "terminate": false}'
275
279
 
276
280
  <!-- CHANGELOG -->
277
281
 
282
+ - 2025.06.04 v1.1.13
283
+
284
+ - 添加配置项 `werewolf__use_cmd_start`, 用于配置插件命令前缀
285
+ - 调整 v1.1.11 优先级配置的默认值
286
+
278
287
  - 2025.06.01 v1.1.12
279
288
 
280
289
  - 禁用 `discord` 适配器中的按钮操作 ~~以后会写适配的...吗?~~
@@ -10,7 +10,7 @@ from . import matchers as matchers
10
10
  from . import players as players
11
11
  from .config import Config
12
12
 
13
- __version__ = "1.1.12"
13
+ __version__ = "1.1.13"
14
14
  __plugin_meta__ = PluginMetadata(
15
15
  name="狼人杀",
16
16
  description="适用于 Nonebot2 的狼人杀插件",
@@ -1,10 +1,11 @@
1
1
  import json
2
+ import warnings
2
3
  from pathlib import Path
3
4
  from typing import Any, ClassVar, Final, Literal
4
5
  from typing_extensions import Self
5
6
 
6
7
  import nonebot
7
- from nonebot.compat import model_dump, type_validate_json
8
+ from nonebot.compat import model_dump, model_validator, type_validate_json
8
9
  from nonebot_plugin_localstore import get_plugin_data_file
9
10
  from pydantic import BaseModel, Field
10
11
 
@@ -90,7 +91,18 @@ class MatcherPriorityConfig(BaseModel):
90
91
  preset: int = 1
91
92
  behavior: int = 1
92
93
  in_game: int = 10
93
- stop: int = 10
94
+ stop: int = 9
95
+
96
+ @model_validator(mode="after")
97
+ @classmethod
98
+ def _validate(cls, model: Self) -> Self:
99
+ if model.in_game <= model.stop:
100
+ model.in_game = model.stop + 1
101
+ warnings.warn(
102
+ "in_game 的优先级必须低于 stop,已自动调整为 stop + 1",
103
+ stacklevel=2,
104
+ )
105
+ return model
94
106
 
95
107
 
96
108
  class PluginConfig(BaseModel):
@@ -99,6 +111,7 @@ class PluginConfig(BaseModel):
99
111
  stop_command: str | set[str] = "stop"
100
112
  require_at: bool | RequireAtConfig = True
101
113
  matcher_priority: MatcherPriorityConfig = MatcherPriorityConfig()
114
+ use_cmd_start: bool | None = None
102
115
 
103
116
  def get_stop_command(self) -> list[str]:
104
117
  return (
@@ -118,6 +118,7 @@ alc = Alconna(
118
118
  edit_behavior = on_alconna(
119
119
  alc,
120
120
  permission=SUPERUSER,
121
+ use_cmd_start=config.use_cmd_start,
121
122
  priority=config.matcher_priority.behavior,
122
123
  )
123
124
 
@@ -72,6 +72,7 @@ alc = Alconna(
72
72
  edit_preset = on_alconna(
73
73
  alc,
74
74
  permission=SUPERUSER,
75
+ use_cmd_start=config.use_cmd_start,
75
76
  priority=config.matcher_priority.preset,
76
77
  )
77
78
 
@@ -25,8 +25,8 @@ stopcmd = on_alconna(
25
25
  Alconna(config.get_stop_command()[0]),
26
26
  rule=rule_in_game,
27
27
  block=True,
28
- use_cmd_start=True,
29
28
  aliases=set(aliases) if (aliases := config.get_stop_command()[1:]) else None,
29
+ use_cmd_start=config.use_cmd_start,
30
30
  priority=config.matcher_priority.stop,
31
31
  )
32
32
 
@@ -32,6 +32,7 @@ start_game = on_alconna(
32
32
  if config.get_require_at("start")
33
33
  else rule_not_in_game,
34
34
  aliases={"狼人杀"},
35
+ use_cmd_start=config.use_cmd_start,
35
36
  priority=config.matcher_priority.start,
36
37
  )
37
38
  player_data_file = get_plugin_data_file("players.json")
@@ -12,6 +12,7 @@ terminate = on_alconna(
12
12
  Alconna("中止游戏"),
13
13
  rule=to_me() if config.get_require_at("terminate") else None,
14
14
  permission=SUPERUSER,
15
+ use_cmd_start=config.use_cmd_start,
15
16
  priority=config.matcher_priority.terminate,
16
17
  )
17
18
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-werewolf
3
- Version: 1.1.12
3
+ Version: 1.1.13
4
4
  Summary: 适用于 Nonebot2 的狼人杀插件
5
5
  Author-email: wyf7685 <wyf7685@163.com>
6
6
  License: MIT
@@ -53,7 +53,8 @@ _✨ 简单的狼人杀插件 ✨_
53
53
  <!-- ref: https://github.com/KomoriDev/Starify -->
54
54
 
55
55
  > [!IMPORTANT]
56
- > **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
56
+ >
57
+ > **收藏项目**,你将从 GitHub 上无延迟地接收所有发布通知~ ⭐️
57
58
 
58
59
  <img width="100%" src="https://starify.komoridevs.icu/api/starify?owner=wyf7685&repo=nonebot-plugin-werewolf" alt="starify" />
59
60
 
@@ -126,13 +127,14 @@ _✨ 简单的狼人杀插件 ✨_
126
127
 
127
128
  在 nonebot2 项目的 `.env` 文件中添加如下配置:
128
129
 
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 注册的优先级 |
130
+ | 配置项 | 必填 | 默认值 | 类型 | 说明 |
131
+ | :--------------------------: | :--: | :-----: | :-----------------------: | :-------------------------------------------: |
132
+ | `werewolf__enable_poke` | 否 | `True` | `bool` | 是否使用戳一戳简化操作流程 |
133
+ | `werewolf__enable_button` | 否 | `False` | `bool` | 是否在交互中添加按钮 |
134
+ | `werewolf__stop_command` | 否 | `stop` | `str \| set[str]` | 修改游戏进程中的 `stop` 命令 |
135
+ | `werewolf__require_at` | 否 | `True` | `bool \| RequireAtConfig` | 部分命令是否需要 at 机器人触发 |
136
+ | `werewolf__matcher_priority` | 否 | - | `MatcherPriorityConfig` | 配置插件 matcher 注册的优先级 |
137
+ | `werewolf__use_cmd_start` | 否 | `None` | `bool \| None` | 是否使用配置项 `COMMAND_START` 来作为命令前缀 |
136
138
 
137
139
  `werewolf__enable_poke` 仅在 `OneBot V11` 适配器 / `Satori/chronocat` 下生效
138
140
 
@@ -160,6 +162,8 @@ werewolf__require_at='{"start": true, "terminate": false}'
160
162
  - 如果遇到与其他插件的命令冲突, 可考虑修改此处的优先级配置
161
163
  - 配置应填入 JSON 对象, 可用键: `start` `terminate` `preset` `behavior` `in_game` `stop`
162
164
 
165
+ `werewolf__use_cmd_start` 为 `None` 时,使用 alc 的 [全局配置](https://nonebot.dev/docs/next/best-practice/alconna/config#alconna_use_command_start)
166
+
163
167
  ## 🚀 使用
164
168
 
165
169
  > [!note]
@@ -295,6 +299,11 @@ werewolf__require_at='{"start": true, "terminate": false}'
295
299
 
296
300
  <!-- CHANGELOG -->
297
301
 
302
+ - 2025.06.04 v1.1.13
303
+
304
+ - 添加配置项 `werewolf__use_cmd_start`, 用于配置插件命令前缀
305
+ - 调整 v1.1.11 优先级配置的默认值
306
+
298
307
  - 2025.06.01 v1.1.12
299
308
 
300
309
  - 禁用 `discord` 适配器中的按钮操作 ~~以后会写适配的...吗?~~
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-werewolf"
3
- version = "1.1.12"
3
+ version = "1.1.13"
4
4
  description = "适用于 Nonebot2 的狼人杀插件"
5
5
  authors = [{ name = "wyf7685", email = "wyf7685@163.com" }]
6
6
  dependencies = [