|
6 | 6 | from astrbot.core.star.filter.command import CommandFilter |
7 | 7 | from astrbot.core.star.filter.command_group import CommandGroupFilter |
8 | 8 | from astrbot.core.star.filter.permission import PermissionTypeFilter |
9 | | -from enum import Enum |
10 | | - |
11 | | - |
12 | | -class RstScene(Enum): |
13 | | - GROUP_UNIQUE_ON = ("group_unique_on", "群聊+会话隔离开启") |
14 | | - GROUP_UNIQUE_OFF = ("group_unique_off", "群聊+会话隔离关闭") |
15 | | - PRIVATE = ("private", "私聊") |
16 | | - |
17 | | - @property |
18 | | - def key(self) -> str: |
19 | | - return self.value[0] |
20 | | - |
21 | | - @property |
22 | | - def name(self) -> str: |
23 | | - return self.value[1] |
24 | | - |
25 | | - @classmethod |
26 | | - def from_index(cls, index: int) -> "RstScene": |
27 | | - mapping = {1: cls.GROUP_UNIQUE_ON, 2: cls.GROUP_UNIQUE_OFF, 3: cls.PRIVATE} |
28 | | - return mapping[index] |
| 9 | +from .utils.rst_scene import RstScene |
29 | 10 |
|
30 | 11 |
|
31 | 12 | class AlterCmdCommands(CommandParserMixin): |
@@ -58,8 +39,9 @@ async def alter_cmd(self, event: AstrMessageEvent): |
58 | 39 | ) |
59 | 40 | return |
60 | 41 |
|
61 | | - cmd_name = " ".join(token.tokens[1:-1]) |
62 | | - cmd_type = token.get(-1) |
| 42 | + # 兼容 reset scene 的专门配置 |
| 43 | + cmd_name = token.get(1) |
| 44 | + cmd_type = token.get(2) |
63 | 45 |
|
64 | 46 | if cmd_name == "reset" and cmd_type == "config": |
65 | 47 | from astrbot.api import sp |
@@ -123,6 +105,8 @@ async def alter_cmd(self, event: AstrMessageEvent): |
123 | 105 | return |
124 | 106 |
|
125 | 107 | # 查找指令 |
| 108 | + cmd_name = " ".join(token.tokens[1:-1]) |
| 109 | + cmd_type = token.get(-1) |
126 | 110 | found_command = None |
127 | 111 | cmd_group = False |
128 | 112 | for handler in star_handlers_registry: |
|
0 commit comments