ErisPulse-HelpModule 1.0.0__tar.gz → 2.1.0__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.
- erispulse_helpmodule-2.1.0/ErisPulse_HelpModule/Core.py +204 -0
- erispulse_helpmodule-2.1.0/ErisPulse_HelpModule/templates.py +460 -0
- erispulse_helpmodule-2.1.0/ErisPulse_HelpModule.egg-info/PKG-INFO +57 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/ErisPulse_HelpModule.egg-info/SOURCES.txt +1 -0
- erispulse_helpmodule-2.1.0/PKG-INFO +57 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/README.md +3 -9
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/pyproject.toml +7 -3
- erispulse_helpmodule-1.0.0/ErisPulse_HelpModule/Core.py +0 -316
- erispulse_helpmodule-1.0.0/ErisPulse_HelpModule.egg-info/PKG-INFO +0 -69
- erispulse_helpmodule-1.0.0/PKG-INFO +0 -69
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/ErisPulse_HelpModule/__init__.py +0 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/ErisPulse_HelpModule.egg-info/dependency_links.txt +0 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/ErisPulse_HelpModule.egg-info/entry_points.txt +0 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/ErisPulse_HelpModule.egg-info/top_level.txt +0 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/LICENSE +0 -0
- {erispulse_helpmodule-1.0.0 → erispulse_helpmodule-2.1.0}/setup.cfg +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from ErisPulse import sdk
|
|
2
|
+
from ErisPulse.Core.Event import command
|
|
3
|
+
from ErisPulse.Core import config
|
|
4
|
+
from ErisPulse.Core.Bases import BaseModule
|
|
5
|
+
from typing import Dict, List, Optional
|
|
6
|
+
from .templates import HelpTemplates
|
|
7
|
+
|
|
8
|
+
class HelpModule(BaseModule):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
self.sdk = sdk
|
|
11
|
+
self.logger = sdk.logger.get_child("HelpModule")
|
|
12
|
+
self.command_list = []
|
|
13
|
+
self.command_map = {}
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def should_eager_load():
|
|
17
|
+
return True
|
|
18
|
+
|
|
19
|
+
async def on_load(self, event):
|
|
20
|
+
self._register_commands()
|
|
21
|
+
self.logger.info("HelpModule 已加载")
|
|
22
|
+
return True
|
|
23
|
+
|
|
24
|
+
async def on_unload(self, event):
|
|
25
|
+
self._unregister_commands()
|
|
26
|
+
self.logger.info("HelpModule 已卸载")
|
|
27
|
+
return True
|
|
28
|
+
|
|
29
|
+
def _get_config(self):
|
|
30
|
+
module_config = config.getConfig("HelpModule")
|
|
31
|
+
if not module_config:
|
|
32
|
+
default_config = {
|
|
33
|
+
"show_hidden_commands": False,
|
|
34
|
+
"group_commands": True
|
|
35
|
+
}
|
|
36
|
+
config.setConfig("HelpModule", default_config)
|
|
37
|
+
self.logger.warning("未找到HelpModule配置,已创建默认配置")
|
|
38
|
+
return default_config
|
|
39
|
+
return module_config
|
|
40
|
+
|
|
41
|
+
def _get_command_prefix(self) -> str:
|
|
42
|
+
event_config = config.getConfig("ErisPulse.event", {})
|
|
43
|
+
command_config = event_config.get("command", {})
|
|
44
|
+
return command_config.get("prefix", "/")
|
|
45
|
+
|
|
46
|
+
def _register_commands(self):
|
|
47
|
+
self.help_command_func = self._create_help_command()
|
|
48
|
+
command(
|
|
49
|
+
"help",
|
|
50
|
+
aliases=["h", "帮助"],
|
|
51
|
+
help="显示帮助信息",
|
|
52
|
+
usage="help [序号] - 显示命令列表或查看指定序号的命令详情"
|
|
53
|
+
)(self.help_command_func)
|
|
54
|
+
|
|
55
|
+
def _unregister_commands(self):
|
|
56
|
+
if hasattr(self, 'help_command_func'):
|
|
57
|
+
command.unregister(self.help_command_func)
|
|
58
|
+
|
|
59
|
+
def _create_help_command(self):
|
|
60
|
+
async def help_command(event):
|
|
61
|
+
await self._handle_help_command(event)
|
|
62
|
+
return help_command
|
|
63
|
+
|
|
64
|
+
def _build_command_list(self) -> List[Dict]:
|
|
65
|
+
self.command_list = []
|
|
66
|
+
module_config = self._get_config()
|
|
67
|
+
show_hidden = module_config.get("show_hidden_commands", False)
|
|
68
|
+
|
|
69
|
+
if show_hidden:
|
|
70
|
+
all_commands = command.get_commands()
|
|
71
|
+
for cmd_name in all_commands:
|
|
72
|
+
cmd_info = command.get_command(cmd_name)
|
|
73
|
+
if cmd_info and cmd_name == cmd_info.get("main_name"):
|
|
74
|
+
self.command_list.append({
|
|
75
|
+
"name": cmd_name,
|
|
76
|
+
"info": cmd_info
|
|
77
|
+
})
|
|
78
|
+
else:
|
|
79
|
+
visible_commands = command.get_visible_commands()
|
|
80
|
+
for cmd_name in visible_commands:
|
|
81
|
+
cmd_info = command.get_command(cmd_name)
|
|
82
|
+
if cmd_info and cmd_name == cmd_info.get("main_name"):
|
|
83
|
+
self.command_list.append({
|
|
84
|
+
"name": cmd_name,
|
|
85
|
+
"info": cmd_info
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
return self.command_list
|
|
89
|
+
|
|
90
|
+
def _group_commands_by_category(self, commands: List[Dict]) -> Dict[str, List]:
|
|
91
|
+
grouped = {}
|
|
92
|
+
for cmd in commands:
|
|
93
|
+
group = cmd["info"].get("group") or "default"
|
|
94
|
+
if group not in grouped:
|
|
95
|
+
grouped[group] = []
|
|
96
|
+
grouped[group].append(cmd)
|
|
97
|
+
return grouped
|
|
98
|
+
|
|
99
|
+
async def _handle_help_command(self, event: Dict) -> None:
|
|
100
|
+
try:
|
|
101
|
+
platform = event["platform"]
|
|
102
|
+
if event.get("detail_type") == "group":
|
|
103
|
+
target_type = "group"
|
|
104
|
+
target_id = event["group_id"]
|
|
105
|
+
elif event.get("detail_type") == "private" or event.get("detail_type") == "user":
|
|
106
|
+
target_type = "user"
|
|
107
|
+
target_id = event["user_id"]
|
|
108
|
+
else:
|
|
109
|
+
target_type = event.get("detail_type")
|
|
110
|
+
target_id = event.get("target_id")
|
|
111
|
+
|
|
112
|
+
args = event.get("command", {}).get("args", [])
|
|
113
|
+
adapter = getattr(sdk.adapter, platform)
|
|
114
|
+
|
|
115
|
+
commands = self._build_command_list()
|
|
116
|
+
module_config = self._get_config()
|
|
117
|
+
|
|
118
|
+
if args:
|
|
119
|
+
# 显示命令详情
|
|
120
|
+
try:
|
|
121
|
+
index = int(args[0])
|
|
122
|
+
if index in self.command_map:
|
|
123
|
+
# 使用模板构建命令详情
|
|
124
|
+
templates = HelpTemplates.build_command_detail(
|
|
125
|
+
self.command_map[index],
|
|
126
|
+
self._get_command_prefix()
|
|
127
|
+
)
|
|
128
|
+
help_content = self._select_best_format(platform, templates)
|
|
129
|
+
else:
|
|
130
|
+
# 使用错误模板
|
|
131
|
+
templates = HelpTemplates.build_error(
|
|
132
|
+
"序号超出范围",
|
|
133
|
+
f"请输入 1-{len(commands)} 之间的序号"
|
|
134
|
+
)
|
|
135
|
+
help_content = self._select_best_format(platform, templates)
|
|
136
|
+
except ValueError:
|
|
137
|
+
templates = HelpTemplates.build_error(
|
|
138
|
+
"参数错误",
|
|
139
|
+
"请输入有效的序号"
|
|
140
|
+
)
|
|
141
|
+
help_content = self._select_best_format(platform, templates)
|
|
142
|
+
else:
|
|
143
|
+
# 显示命令列表
|
|
144
|
+
templates = HelpTemplates.build_help_list(
|
|
145
|
+
commands,
|
|
146
|
+
self.command_map,
|
|
147
|
+
self._get_command_prefix(),
|
|
148
|
+
module_config.get("group_commands", True)
|
|
149
|
+
)
|
|
150
|
+
help_content = self._select_best_format(platform, templates)
|
|
151
|
+
|
|
152
|
+
# 发送消息
|
|
153
|
+
await self._send_with_format(adapter, target_type, target_id, help_content)
|
|
154
|
+
except Exception as e:
|
|
155
|
+
self.logger.error(f"处理帮助命令时出错: {e}", exc_info=True)
|
|
156
|
+
|
|
157
|
+
def _select_best_format(self, platform: str, templates: Dict[str, str]) -> tuple:
|
|
158
|
+
"""
|
|
159
|
+
根据平台支持的发送方法选择最佳格式
|
|
160
|
+
优先使用 list_sends,不支持时使用 hasattr 兜底
|
|
161
|
+
|
|
162
|
+
返回: (format_name, content)
|
|
163
|
+
"""
|
|
164
|
+
# 首先尝试使用 list_sends(推荐方式)
|
|
165
|
+
try:
|
|
166
|
+
supported_methods = sdk.adapter.list_sends(platform)
|
|
167
|
+
|
|
168
|
+
# 优先级: Html > Markdown > Text
|
|
169
|
+
if "Html" in supported_methods:
|
|
170
|
+
return ("Html", templates["html"])
|
|
171
|
+
elif "Markdown" in supported_methods:
|
|
172
|
+
return ("Markdown", templates["markdown"])
|
|
173
|
+
else:
|
|
174
|
+
return ("Text", templates["text"])
|
|
175
|
+
except Exception as e:
|
|
176
|
+
self.logger.warning(f"list_sends 检测失败: {e},尝试使用 hasattr 兜底")
|
|
177
|
+
|
|
178
|
+
# 使用 hasattr 作为兜底方案
|
|
179
|
+
adapter = getattr(sdk.adapter, platform)
|
|
180
|
+
send_obj = adapter.Send if hasattr(adapter, "Send") else None
|
|
181
|
+
|
|
182
|
+
if send_obj is None:
|
|
183
|
+
self.logger.warning(f"平台 {platform} 不支持 Send 接口,使用纯文本格式")
|
|
184
|
+
return ("Text", templates["text"])
|
|
185
|
+
|
|
186
|
+
# 检查支持的方法
|
|
187
|
+
if hasattr(send_obj, "Html"):
|
|
188
|
+
return ("Html", templates["html"])
|
|
189
|
+
elif hasattr(send_obj, "Markdown"):
|
|
190
|
+
return ("Markdown", templates["markdown"])
|
|
191
|
+
else:
|
|
192
|
+
return ("Text", templates["text"])
|
|
193
|
+
|
|
194
|
+
async def _send_with_format(self, adapter, target_type: str, target_id: str,
|
|
195
|
+
format_content: tuple) -> None:
|
|
196
|
+
format_name, content = format_content
|
|
197
|
+
|
|
198
|
+
# 根据格式调用对应的发送方法
|
|
199
|
+
if format_name == "Html":
|
|
200
|
+
await adapter.Send.To(target_type, target_id).Html(content)
|
|
201
|
+
elif format_name == "Markdown":
|
|
202
|
+
await adapter.Send.To(target_type, target_id).Markdown(content)
|
|
203
|
+
else: # Text
|
|
204
|
+
await adapter.Send.To(target_type, target_id).Text(content)
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
"""
|
|
2
|
+
帮助模块模板系统
|
|
3
|
+
提供多平台支持的消息模板
|
|
4
|
+
"""
|
|
5
|
+
from typing import Dict, List, Optional
|
|
6
|
+
from ErisPulse.Core.Event import command
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HelpTemplates:
|
|
10
|
+
"""帮助模块模板类"""
|
|
11
|
+
|
|
12
|
+
# 配色方案
|
|
13
|
+
PRIMARY_COLOR = "#1565c0" # 蓝色 - 主标题
|
|
14
|
+
SUCCESS_COLOR = "#2e7d32" # 绿色 - 成功信息
|
|
15
|
+
WARNING_COLOR = "#e65100" # 橙色 - 警告信息
|
|
16
|
+
ERROR_COLOR = "#b71c1c" # 红色 - 错误信息
|
|
17
|
+
|
|
18
|
+
# 半透明背景色
|
|
19
|
+
PRIMARY_BG = "rgba(21, 101, 192, 0.05)"
|
|
20
|
+
SUCCESS_BG = "rgba(76, 175, 80, 0.1)"
|
|
21
|
+
WARNING_BG = "rgba(255, 167, 38, 0.15)"
|
|
22
|
+
ERROR_BG = "rgba(183, 28, 28, 0.1)"
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def _get_group_name(cls, group: str) -> str:
|
|
26
|
+
if group == "default":
|
|
27
|
+
return "通用命令"
|
|
28
|
+
return f"{group}命令" if group else "其他"
|
|
29
|
+
|
|
30
|
+
# ==================== 帮助列表模板 ====================
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def build_help_list(cls, commands: List[Dict], command_map: Dict[int, Dict],
|
|
34
|
+
prefix: str, group_commands: bool = True) -> Dict[str, str]:
|
|
35
|
+
# 构建 HTML
|
|
36
|
+
html = cls._build_help_list_html(commands, command_map, prefix, group_commands)
|
|
37
|
+
|
|
38
|
+
# 构建 Markdown
|
|
39
|
+
markdown = cls._build_help_list_markdown(commands, command_map, prefix, group_commands)
|
|
40
|
+
|
|
41
|
+
# 构建 Text
|
|
42
|
+
text = cls._build_help_list_text(commands, command_map, prefix, group_commands)
|
|
43
|
+
|
|
44
|
+
return {"html": html, "markdown": markdown, "text": text}
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def _build_help_list_html(cls, commands: List[Dict], command_map: Dict[int, Dict],
|
|
48
|
+
prefix: str, group_commands: bool) -> str:
|
|
49
|
+
# 重置命令映射
|
|
50
|
+
grouped = {}
|
|
51
|
+
if group_commands:
|
|
52
|
+
for cmd in commands:
|
|
53
|
+
group = cmd["info"].get("group") or "default"
|
|
54
|
+
if group not in grouped:
|
|
55
|
+
grouped[group] = []
|
|
56
|
+
grouped[group].append(cmd)
|
|
57
|
+
else:
|
|
58
|
+
grouped["default"] = commands
|
|
59
|
+
|
|
60
|
+
# 构建命令列表 HTML(带展开/折叠功能)
|
|
61
|
+
commands_html = ""
|
|
62
|
+
global_idx = 1
|
|
63
|
+
|
|
64
|
+
for group, cmds in grouped.items():
|
|
65
|
+
group_name = cls._get_group_name(group)
|
|
66
|
+
|
|
67
|
+
commands_html += f"""
|
|
68
|
+
<div style="font-size:13px; margin-bottom: 8px; font-weight: bold; color: {cls.PRIMARY_COLOR};">{group_name}</div>
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
for cmd in cmds:
|
|
72
|
+
name = cmd["name"]
|
|
73
|
+
info = cmd["info"]
|
|
74
|
+
help_text = info.get("help", "暂无描述")
|
|
75
|
+
command_map[global_idx] = cmd
|
|
76
|
+
|
|
77
|
+
# 构建命令详情内容
|
|
78
|
+
detail_content = cls._build_command_detail_inline(name, info, prefix)
|
|
79
|
+
|
|
80
|
+
commands_html += f"""<details style="margin-bottom: 8px;">
|
|
81
|
+
<summary style="cursor: pointer; font-size: 13px; padding: 4px; background: rgba(0, 0, 0, 0.02); border-radius: 4px; display: flex; align-items: center;">
|
|
82
|
+
<span style="font-weight: bold; margin-right: 8px;">{global_idx}.</span>
|
|
83
|
+
<code style="background: rgba(0, 0, 0, 0.05); padding: 2px 6px; border-radius: 3px; margin-right: 8px;">{prefix}{name}</code>
|
|
84
|
+
<span style="color: #666;">- {help_text}</span>
|
|
85
|
+
</summary>
|
|
86
|
+
<div style="padding: 8px; margin-top: 6px; border-left: 3px solid {cls.PRIMARY_BG}; background: rgba(0, 0, 0, 0.01); border-radius: 4px;">
|
|
87
|
+
{detail_content}
|
|
88
|
+
</div>
|
|
89
|
+
</details>"""
|
|
90
|
+
global_idx +=1
|
|
91
|
+
|
|
92
|
+
commands_html += "\n"
|
|
93
|
+
|
|
94
|
+
# 构建完整 HTML
|
|
95
|
+
html = f"""<div style="padding: 12px; border-radius: 8px;">
|
|
96
|
+
<div style="color: {cls.PRIMARY_COLOR}; font-size: 16px; font-weight: bold; margin-bottom: 12px;">
|
|
97
|
+
命令帮助
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div style="padding: 8px; background: {cls.PRIMARY_BG}; border-radius: 6px; margin-bottom: 12px;">
|
|
101
|
+
<div style="font-size: 13px;">
|
|
102
|
+
使用 '{prefix}help <序号>' 查看命令详情
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
{commands_html}
|
|
107
|
+
|
|
108
|
+
<div style="font-size: 12px; color: #666; margin-top: 8px;">
|
|
109
|
+
共 {len(commands)} 个可用命令
|
|
110
|
+
</div>
|
|
111
|
+
</div>"""
|
|
112
|
+
|
|
113
|
+
return html
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def _build_help_list_markdown(cls, commands: List[Dict], command_map: Dict[int, Dict],
|
|
117
|
+
prefix: str, group_commands: bool) -> str:
|
|
118
|
+
lines = [
|
|
119
|
+
"**命令帮助**",
|
|
120
|
+
"",
|
|
121
|
+
f"使用 `{prefix}help <序号>` 查看命令详情",
|
|
122
|
+
""
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
global_idx = 1
|
|
126
|
+
|
|
127
|
+
if group_commands:
|
|
128
|
+
grouped = {}
|
|
129
|
+
for cmd in commands:
|
|
130
|
+
group = cmd["info"].get("group") or "default"
|
|
131
|
+
if group not in grouped:
|
|
132
|
+
grouped[group] = []
|
|
133
|
+
grouped[group].append(cmd)
|
|
134
|
+
|
|
135
|
+
for group, cmds in grouped.items():
|
|
136
|
+
group_name = cls._get_group_name(group)
|
|
137
|
+
lines.append(f"**{group_name}**")
|
|
138
|
+
lines.append("")
|
|
139
|
+
|
|
140
|
+
for cmd in cmds:
|
|
141
|
+
name = cmd["name"]
|
|
142
|
+
help_text = cmd["info"].get("help", "暂无描述")
|
|
143
|
+
command_map[global_idx] = cmd
|
|
144
|
+
lines.append(f"{global_idx}. `{prefix}{name}` - {help_text}")
|
|
145
|
+
global_idx += 1
|
|
146
|
+
|
|
147
|
+
lines.append("")
|
|
148
|
+
else:
|
|
149
|
+
lines.append("**所有命令**")
|
|
150
|
+
lines.append("")
|
|
151
|
+
for cmd in commands:
|
|
152
|
+
name = cmd["name"]
|
|
153
|
+
help_text = cmd["info"].get("help", "暂无描述")
|
|
154
|
+
command_map[global_idx] = cmd
|
|
155
|
+
lines.append(f"{global_idx}. `{prefix}{name}` - {help_text}")
|
|
156
|
+
global_idx += 1
|
|
157
|
+
lines.append("")
|
|
158
|
+
|
|
159
|
+
lines.append("---")
|
|
160
|
+
lines.append(f"共 {len(commands)} 个可用命令")
|
|
161
|
+
|
|
162
|
+
return "\n".join(lines)
|
|
163
|
+
|
|
164
|
+
@classmethod
|
|
165
|
+
def _build_help_list_text(cls, commands: List[Dict], command_map: Dict[int, Dict],
|
|
166
|
+
prefix: str, group_commands: bool) -> str:
|
|
167
|
+
lines = [
|
|
168
|
+
"命令帮助",
|
|
169
|
+
"----------",
|
|
170
|
+
f"使用 '{prefix}help <序号>' 查看命令详情",
|
|
171
|
+
""
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
global_idx = 1
|
|
175
|
+
|
|
176
|
+
if group_commands:
|
|
177
|
+
grouped = {}
|
|
178
|
+
for cmd in commands:
|
|
179
|
+
group = cmd["info"].get("group") or "default"
|
|
180
|
+
if group not in grouped:
|
|
181
|
+
grouped[group] = []
|
|
182
|
+
grouped[group].append(cmd)
|
|
183
|
+
|
|
184
|
+
for group, cmds in grouped.items():
|
|
185
|
+
group_name = cls._get_group_name(group)
|
|
186
|
+
lines.append(f"[{group_name}]")
|
|
187
|
+
lines.append("")
|
|
188
|
+
|
|
189
|
+
for cmd in cmds:
|
|
190
|
+
name = cmd["name"]
|
|
191
|
+
help_text = cmd["info"].get("help", "暂无描述")
|
|
192
|
+
command_map[global_idx] = cmd
|
|
193
|
+
lines.append(f"{global_idx}. {prefix}{name} - {help_text}")
|
|
194
|
+
global_idx += 1
|
|
195
|
+
|
|
196
|
+
lines.append("")
|
|
197
|
+
else:
|
|
198
|
+
lines.append("[所有命令]")
|
|
199
|
+
lines.append("")
|
|
200
|
+
for cmd in commands:
|
|
201
|
+
name = cmd["name"]
|
|
202
|
+
help_text = cmd["info"].get("help", "暂无描述")
|
|
203
|
+
command_map[global_idx] = cmd
|
|
204
|
+
lines.append(f"{global_idx}. {prefix}{name} - {help_text}")
|
|
205
|
+
global_idx += 1
|
|
206
|
+
lines.append("")
|
|
207
|
+
|
|
208
|
+
lines.append("----------")
|
|
209
|
+
lines.append(f"共 {len(commands)} 个可用命令")
|
|
210
|
+
|
|
211
|
+
return "\n".join(lines)
|
|
212
|
+
|
|
213
|
+
@classmethod
|
|
214
|
+
def _build_command_detail_inline(cls, name: str, info: Dict, prefix: str) -> str:
|
|
215
|
+
"""
|
|
216
|
+
构建内联命令详情(用于展开区域)
|
|
217
|
+
"""
|
|
218
|
+
parts = []
|
|
219
|
+
|
|
220
|
+
# 描述
|
|
221
|
+
parts.append(f"""<div style="margin-bottom: 8px;">
|
|
222
|
+
<strong style="font-size: 12px; color: {cls.PRIMARY_COLOR};">描述:</strong>
|
|
223
|
+
<span style="font-size: 12px; margin-left: 8px;">{info.get('help', '暂无描述')}</span>
|
|
224
|
+
</div>""")
|
|
225
|
+
|
|
226
|
+
# 别名 - 从全局 command.aliases 获取
|
|
227
|
+
main_name = info.get('main_name', name)
|
|
228
|
+
aliases = []
|
|
229
|
+
for alias, mapped_name in command.aliases.items():
|
|
230
|
+
if mapped_name == main_name and alias != main_name:
|
|
231
|
+
aliases.append(alias)
|
|
232
|
+
|
|
233
|
+
if aliases:
|
|
234
|
+
aliases_text = ", ".join(f"<code style='font-size: 11px;'>{prefix}{a}</code>" for a in aliases)
|
|
235
|
+
parts.append(f"""<div style="margin-bottom: 8px;">
|
|
236
|
+
<strong style="font-size: 12px; color: {cls.PRIMARY_COLOR};">别名:</strong>
|
|
237
|
+
<span style="font-size: 12px; margin-left: 8px;">{aliases_text}</span>
|
|
238
|
+
</div>""")
|
|
239
|
+
|
|
240
|
+
# 用法
|
|
241
|
+
if info.get("usage"):
|
|
242
|
+
parts.append(f"""<div style="margin-bottom: 8px;">
|
|
243
|
+
<strong style="font-size: 12px; color: {cls.PRIMARY_COLOR};">用法:</strong>
|
|
244
|
+
<span style="font-size: 12px; margin-left: 8px; font-family: monospace; background: rgba(0, 0, 0, 0.03); padding: 2px 6px; border-radius: 3px;">{info['usage'].replace('/', prefix)}</span>
|
|
245
|
+
</div>""")
|
|
246
|
+
|
|
247
|
+
# 权限
|
|
248
|
+
if info.get("permission"):
|
|
249
|
+
parts.append(f"""<div style="margin-bottom: 8px;">
|
|
250
|
+
<strong style="font-size: 12px; color: {cls.PRIMARY_COLOR};">权限:</strong>
|
|
251
|
+
<span style="font-size: 12px; margin-left: 8px; color: {cls.WARNING_COLOR};">需要特殊权限</span>
|
|
252
|
+
</div>""")
|
|
253
|
+
|
|
254
|
+
# 分组
|
|
255
|
+
if info.get("group"):
|
|
256
|
+
group_name = cls._get_group_name(info["group"])
|
|
257
|
+
parts.append(f"""<div style="margin-bottom: 8px;">
|
|
258
|
+
<strong style="font-size: 12px; color: {cls.PRIMARY_COLOR};">分组:</strong>
|
|
259
|
+
<span style="font-size: 12px; margin-left: 8px;">{group_name}</span>
|
|
260
|
+
</div>""")
|
|
261
|
+
|
|
262
|
+
return "\n".join(parts)
|
|
263
|
+
|
|
264
|
+
# ==================== 命令详情模板 ====================
|
|
265
|
+
|
|
266
|
+
@classmethod
|
|
267
|
+
def build_command_detail(cls, cmd: Dict, prefix: str) -> Dict[str, str]:
|
|
268
|
+
# 构建 HTML
|
|
269
|
+
html = cls._build_command_detail_html(cmd, prefix)
|
|
270
|
+
|
|
271
|
+
# 构建 Markdown
|
|
272
|
+
markdown = cls._build_command_detail_markdown(cmd, prefix)
|
|
273
|
+
|
|
274
|
+
# 构建 Text
|
|
275
|
+
text = cls._build_command_detail_text(cmd, prefix)
|
|
276
|
+
|
|
277
|
+
return {"html": html, "markdown": markdown, "text": text}
|
|
278
|
+
|
|
279
|
+
@classmethod
|
|
280
|
+
def _build_command_detail_html(cls, cmd: Dict, prefix: str) -> str:
|
|
281
|
+
name = cmd["name"]
|
|
282
|
+
info = cmd["info"]
|
|
283
|
+
|
|
284
|
+
html_parts = [
|
|
285
|
+
f"""<div style="padding: 12px; border-radius: 8px;">
|
|
286
|
+
<div style="color: {cls.PRIMARY_COLOR}; font-size: 16px; font-weight: bold; margin-bottom: 12px;">
|
|
287
|
+
命令详情: {prefix}{name}
|
|
288
|
+
</div>"""
|
|
289
|
+
]
|
|
290
|
+
|
|
291
|
+
# 描述
|
|
292
|
+
html_parts.append(f"""
|
|
293
|
+
<div style="margin-bottom: 12px; border: 1px solid #e0e0e0; padding: 12px; border-radius: 6px;">
|
|
294
|
+
<div style="margin-bottom: 8px;">
|
|
295
|
+
<strong style="font-size: 14px;">描述:</strong>
|
|
296
|
+
</div>
|
|
297
|
+
<div style="font-size: 13px;">
|
|
298
|
+
{info.get('help', '暂无描述')}
|
|
299
|
+
</div>
|
|
300
|
+
</div>""")
|
|
301
|
+
|
|
302
|
+
# 别名 - 从全局 command.aliases 获取
|
|
303
|
+
main_name = info.get('main_name', name)
|
|
304
|
+
aliases = []
|
|
305
|
+
for alias, mapped_name in command.aliases.items():
|
|
306
|
+
if mapped_name == main_name and alias != main_name:
|
|
307
|
+
aliases.append(alias)
|
|
308
|
+
|
|
309
|
+
if aliases:
|
|
310
|
+
aliases_text = ", ".join(f"{prefix}{a}" for a in aliases)
|
|
311
|
+
html_parts.append(f"""
|
|
312
|
+
<div style="margin-bottom: 8px;">
|
|
313
|
+
<div style="font-size: 13px; margin-bottom: 4px;">
|
|
314
|
+
<strong>别名:</strong>
|
|
315
|
+
</div>
|
|
316
|
+
<div style="font-size: 13px;">
|
|
317
|
+
{aliases_text}
|
|
318
|
+
</div>
|
|
319
|
+
</div>""")
|
|
320
|
+
|
|
321
|
+
# 用法
|
|
322
|
+
if info.get("usage"):
|
|
323
|
+
html_parts.append(f"""
|
|
324
|
+
<div style="margin-bottom: 8px;">
|
|
325
|
+
<div style="font-size: 13px; margin-bottom: 4px;">
|
|
326
|
+
<strong>用法:</strong>
|
|
327
|
+
</div>
|
|
328
|
+
<div style="font-size: 13px; font-family: monospace; background: rgba(0, 0, 0, 0.03); padding: 6px; border-radius: 4px;">
|
|
329
|
+
{info['usage'].replace('/', prefix)}
|
|
330
|
+
</div>
|
|
331
|
+
</div>""")
|
|
332
|
+
|
|
333
|
+
# 权限
|
|
334
|
+
if info.get("permission"):
|
|
335
|
+
html_parts.append(f"""
|
|
336
|
+
<div style="margin-bottom: 8px;">
|
|
337
|
+
<div style="font-size: 13px; margin-bottom: 4px;">
|
|
338
|
+
<strong>权限:</strong>
|
|
339
|
+
</div>
|
|
340
|
+
<div style="font-size: 13px; color: {cls.WARNING_COLOR};">
|
|
341
|
+
需要特殊权限
|
|
342
|
+
</div>
|
|
343
|
+
</div>""")
|
|
344
|
+
|
|
345
|
+
# 分组
|
|
346
|
+
if info.get("group"):
|
|
347
|
+
group_name = cls._get_group_name(info["group"])
|
|
348
|
+
html_parts.append(f"""
|
|
349
|
+
<div style="margin-bottom: 8px;">
|
|
350
|
+
<div style="font-size: 13px; margin-bottom: 4px;">
|
|
351
|
+
<strong>分组:</strong>
|
|
352
|
+
</div>
|
|
353
|
+
<div style="font-size: 13px;">
|
|
354
|
+
{group_name}
|
|
355
|
+
</div>
|
|
356
|
+
</div>""")
|
|
357
|
+
|
|
358
|
+
html_parts.append("</div>")
|
|
359
|
+
|
|
360
|
+
return "\n".join(html_parts)
|
|
361
|
+
|
|
362
|
+
@classmethod
|
|
363
|
+
def _build_command_detail_markdown(cls, cmd: Dict, prefix: str) -> str:
|
|
364
|
+
name = cmd["name"]
|
|
365
|
+
info = cmd["info"]
|
|
366
|
+
|
|
367
|
+
lines = [
|
|
368
|
+
f"**命令详情:** `{prefix}{name}`",
|
|
369
|
+
"",
|
|
370
|
+
f"**描述:** {info.get('help', '暂无描述')}",
|
|
371
|
+
""
|
|
372
|
+
]
|
|
373
|
+
|
|
374
|
+
# 别名 - 从全局 command.aliases 获取
|
|
375
|
+
main_name = info.get('main_name', name)
|
|
376
|
+
aliases = []
|
|
377
|
+
for alias, mapped_name in command.aliases.items():
|
|
378
|
+
if mapped_name == main_name and alias != main_name:
|
|
379
|
+
aliases.append(alias)
|
|
380
|
+
|
|
381
|
+
if aliases:
|
|
382
|
+
aliases_text = ", ".join(f"`{prefix}{a}`" for a in aliases)
|
|
383
|
+
lines.append(f"**别名:** {aliases_text}")
|
|
384
|
+
lines.append("")
|
|
385
|
+
|
|
386
|
+
# 用法
|
|
387
|
+
if info.get("usage"):
|
|
388
|
+
lines.append(f"**用法:** `{info['usage'].replace('/', prefix)}`")
|
|
389
|
+
lines.append("")
|
|
390
|
+
|
|
391
|
+
# 权限
|
|
392
|
+
if info.get("permission"):
|
|
393
|
+
lines.append("**权限:** 需要特殊权限")
|
|
394
|
+
lines.append("")
|
|
395
|
+
|
|
396
|
+
# 分组
|
|
397
|
+
if info.get("group"):
|
|
398
|
+
group_name = cls._get_group_name(info["group"])
|
|
399
|
+
lines.append(f"**分组:** {group_name}")
|
|
400
|
+
lines.append("")
|
|
401
|
+
|
|
402
|
+
return "\n".join(lines)
|
|
403
|
+
|
|
404
|
+
@classmethod
|
|
405
|
+
def _build_command_detail_text(cls, cmd: Dict, prefix: str) -> str:
|
|
406
|
+
name = cmd["name"]
|
|
407
|
+
info = cmd["info"]
|
|
408
|
+
|
|
409
|
+
lines = [
|
|
410
|
+
f"命令详情: {prefix}{name}",
|
|
411
|
+
"----------",
|
|
412
|
+
f"描述: {info.get('help', '暂无描述')}",
|
|
413
|
+
""
|
|
414
|
+
]
|
|
415
|
+
|
|
416
|
+
# 别名 - 从全局 command.aliases 获取
|
|
417
|
+
main_name = info.get('main_name', name)
|
|
418
|
+
aliases = []
|
|
419
|
+
for alias, mapped_name in command.aliases.items():
|
|
420
|
+
if mapped_name == main_name and alias != main_name:
|
|
421
|
+
aliases.append(alias)
|
|
422
|
+
|
|
423
|
+
if aliases:
|
|
424
|
+
aliases_text = ", ".join(f"{prefix}{a}" for a in aliases)
|
|
425
|
+
lines.append(f"别名: {aliases_text}")
|
|
426
|
+
lines.append("")
|
|
427
|
+
|
|
428
|
+
# 用法
|
|
429
|
+
if info.get("usage"):
|
|
430
|
+
lines.append(f"用法: {info['usage'].replace('/', prefix)}")
|
|
431
|
+
lines.append("")
|
|
432
|
+
|
|
433
|
+
# 权限
|
|
434
|
+
if info.get("permission"):
|
|
435
|
+
lines.append("权限: 需要特殊权限")
|
|
436
|
+
lines.append("")
|
|
437
|
+
|
|
438
|
+
# 分组
|
|
439
|
+
if info.get("group"):
|
|
440
|
+
group_name = cls._get_group_name(info["group"])
|
|
441
|
+
lines.append(f"分组: {group_name}")
|
|
442
|
+
lines.append("")
|
|
443
|
+
|
|
444
|
+
return "\n".join(lines)
|
|
445
|
+
|
|
446
|
+
# ==================== 错误消息模板 ====================
|
|
447
|
+
|
|
448
|
+
@classmethod
|
|
449
|
+
def build_error(cls, title: str, message: str) -> Dict[str, str]:
|
|
450
|
+
html = f"""
|
|
451
|
+
<div style="padding: 12px; border-radius: 8px;">
|
|
452
|
+
<div style="color: {cls.ERROR_COLOR}; font-size: 14px; font-weight: bold; margin-bottom: 8px;">{title}</div>
|
|
453
|
+
<div style="font-size: 13px;">{message}</div>
|
|
454
|
+
</div>"""
|
|
455
|
+
|
|
456
|
+
markdown = f"**{title}**\n\n{message}"
|
|
457
|
+
|
|
458
|
+
text = f"{title}\n\n{message}"
|
|
459
|
+
|
|
460
|
+
return {"html": html, "markdown": markdown, "text": text}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ErisPulse-HelpModule
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
5
|
+
Author-email: wsu2059q <wsu2059@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/wsu2059q/ErisPulse-HelpModule
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# ErisPulse-HelpModule
|
|
14
|
+
ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
15
|
+
|
|
16
|
+
## 功能特性
|
|
17
|
+
提供 Event 子模块中 command 模块中统一的命令帮助功能
|
|
18
|
+
- 自动收集并显示所有已注册的命令
|
|
19
|
+
- 支持通过序号查看特定命令的详细帮助信息
|
|
20
|
+
- 支持命令分组显示
|
|
21
|
+
- 可配置是否显示隐藏命令
|
|
22
|
+
- 支持命令别名显示
|
|
23
|
+
|
|
24
|
+
## 使用方法
|
|
25
|
+
|
|
26
|
+
### 基本命令
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/help # 显示所有可用命令的列表
|
|
30
|
+
/help <序号> # 显示指定序号命令的详细帮助信息
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 命令别名
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
/h # 等同于 /help
|
|
37
|
+
/帮助 # 等同于 /help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 配置选项
|
|
41
|
+
|
|
42
|
+
模块支持以下配置选项,可以在 config.toml 中进行自定义:
|
|
43
|
+
|
|
44
|
+
```toml
|
|
45
|
+
[HelpModule]
|
|
46
|
+
show_hidden_commands = false # 是否显示隐藏命令
|
|
47
|
+
group_commands = true # 是否按组显示命令
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 配置说明
|
|
51
|
+
|
|
52
|
+
- `show_hidden_commands`: 设置为 `true` 时,帮助命令会显示被标记为隐藏的命令
|
|
53
|
+
- `group_commands`: 设置为 `false` 时,不按组显示命令,所有命令将在同一列表中显示
|
|
54
|
+
|
|
55
|
+
## 依赖
|
|
56
|
+
|
|
57
|
+
- ErisPulse SDK 2.2.0+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ErisPulse-HelpModule
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
5
|
+
Author-email: wsu2059q <wsu2059@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/wsu2059q/ErisPulse-HelpModule
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# ErisPulse-HelpModule
|
|
14
|
+
ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
15
|
+
|
|
16
|
+
## 功能特性
|
|
17
|
+
提供 Event 子模块中 command 模块中统一的命令帮助功能
|
|
18
|
+
- 自动收集并显示所有已注册的命令
|
|
19
|
+
- 支持通过序号查看特定命令的详细帮助信息
|
|
20
|
+
- 支持命令分组显示
|
|
21
|
+
- 可配置是否显示隐藏命令
|
|
22
|
+
- 支持命令别名显示
|
|
23
|
+
|
|
24
|
+
## 使用方法
|
|
25
|
+
|
|
26
|
+
### 基本命令
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/help # 显示所有可用命令的列表
|
|
30
|
+
/help <序号> # 显示指定序号命令的详细帮助信息
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 命令别名
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
/h # 等同于 /help
|
|
37
|
+
/帮助 # 等同于 /help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 配置选项
|
|
41
|
+
|
|
42
|
+
模块支持以下配置选项,可以在 config.toml 中进行自定义:
|
|
43
|
+
|
|
44
|
+
```toml
|
|
45
|
+
[HelpModule]
|
|
46
|
+
show_hidden_commands = false # 是否显示隐藏命令
|
|
47
|
+
group_commands = true # 是否按组显示命令
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 配置说明
|
|
51
|
+
|
|
52
|
+
- `show_hidden_commands`: 设置为 `true` 时,帮助命令会显示被标记为隐藏的命令
|
|
53
|
+
- `group_commands`: 设置为 `false` 时,不按组显示命令,所有命令将在同一列表中显示
|
|
54
|
+
|
|
55
|
+
## 依赖
|
|
56
|
+
|
|
57
|
+
- ErisPulse SDK 2.2.0+
|
|
@@ -4,10 +4,9 @@ ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查
|
|
|
4
4
|
## 功能特性
|
|
5
5
|
提供 Event 子模块中 command 模块中统一的命令帮助功能
|
|
6
6
|
- 自动收集并显示所有已注册的命令
|
|
7
|
-
-
|
|
7
|
+
- 支持通过序号查看特定命令的详细帮助信息
|
|
8
8
|
- 支持命令分组显示
|
|
9
9
|
- 可配置是否显示隐藏命令
|
|
10
|
-
- 提供简洁和详细两种显示样式
|
|
11
10
|
- 支持命令别名显示
|
|
12
11
|
|
|
13
12
|
## 使用方法
|
|
@@ -15,8 +14,8 @@ ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查
|
|
|
15
14
|
### 基本命令
|
|
16
15
|
|
|
17
16
|
```
|
|
18
|
-
/help #
|
|
19
|
-
/help
|
|
17
|
+
/help # 显示所有可用命令的列表
|
|
18
|
+
/help <序号> # 显示指定序号命令的详细帮助信息
|
|
20
19
|
```
|
|
21
20
|
|
|
22
21
|
### 命令别名
|
|
@@ -24,7 +23,6 @@ ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查
|
|
|
24
23
|
```
|
|
25
24
|
/h # 等同于 /help
|
|
26
25
|
/帮助 # 等同于 /help
|
|
27
|
-
/命令帮助 # 等同于 /help
|
|
28
26
|
```
|
|
29
27
|
|
|
30
28
|
## 配置选项
|
|
@@ -34,16 +32,12 @@ ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查
|
|
|
34
32
|
```toml
|
|
35
33
|
[HelpModule]
|
|
36
34
|
show_hidden_commands = false # 是否显示隐藏命令
|
|
37
|
-
style = "simple" # 显示样式: "simple" 或 "detailed"
|
|
38
35
|
group_commands = true # 是否按组显示命令
|
|
39
36
|
```
|
|
40
37
|
|
|
41
38
|
### 配置说明
|
|
42
39
|
|
|
43
40
|
- `show_hidden_commands`: 设置为 `true` 时,帮助命令会显示被标记为隐藏的命令
|
|
44
|
-
- `style`:
|
|
45
|
-
- `"simple"`: 简洁显示模式,只显示命令名称和简要描述
|
|
46
|
-
- `"detailed"`: 详细显示模式,显示命令的更多详细信息
|
|
47
41
|
- `group_commands`: 设置为 `false` 时,不按组显示命令,所有命令将在同一列表中显示
|
|
48
42
|
|
|
49
43
|
## 依赖
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ErisPulse-HelpModule"
|
|
3
|
-
version = "1.0
|
|
3
|
+
version = "2.1.0"
|
|
4
4
|
description = "ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明"
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.
|
|
7
|
-
license =
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
8
9
|
authors = [ { name = "wsu2059q", email = "wsu2059@qq.com" } ]
|
|
9
10
|
|
|
10
11
|
dependencies = [
|
|
@@ -15,3 +16,6 @@ dependencies = [
|
|
|
15
16
|
|
|
16
17
|
[project.entry-points."erispulse.module"]
|
|
17
18
|
"HelpModule" = "ErisPulse_HelpModule:HelpModule"
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
include = ["ErisPulse_HelpModule*"]
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
from ErisPulse import sdk
|
|
2
|
-
from ErisPulse.Core.Event import command, message
|
|
3
|
-
from ErisPulse.Core import config
|
|
4
|
-
from typing import Dict, List, Optional
|
|
5
|
-
|
|
6
|
-
class HelpModule:
|
|
7
|
-
def __init__(self):
|
|
8
|
-
self.sdk = sdk
|
|
9
|
-
self.logger = sdk.logger.get_child("HelpModule")
|
|
10
|
-
self._register_commands()
|
|
11
|
-
|
|
12
|
-
@staticmethod
|
|
13
|
-
def should_eager_load():
|
|
14
|
-
return True
|
|
15
|
-
|
|
16
|
-
def _get_config(self):
|
|
17
|
-
"""获取模块配置,如果不存在则创建默认配置"""
|
|
18
|
-
module_config = config.getConfig("HelpModule")
|
|
19
|
-
if not module_config:
|
|
20
|
-
default_config = {
|
|
21
|
-
"show_hidden_commands": False,
|
|
22
|
-
"style": "simple",
|
|
23
|
-
"group_commands": True
|
|
24
|
-
}
|
|
25
|
-
config.setConfig("HelpModule", default_config)
|
|
26
|
-
self.logger.warning("未找到HelpModule配置,已创建默认配置")
|
|
27
|
-
return default_config
|
|
28
|
-
return module_config
|
|
29
|
-
|
|
30
|
-
def _get_command_prefix(self) -> str:
|
|
31
|
-
event_config = config.getConfig("ErisPulse.event", {})
|
|
32
|
-
command_config = event_config.get("command", {})
|
|
33
|
-
return command_config.get("prefix", "/")
|
|
34
|
-
|
|
35
|
-
def _register_commands(self):
|
|
36
|
-
prefix = self._get_command_prefix()
|
|
37
|
-
|
|
38
|
-
@command(
|
|
39
|
-
"help",
|
|
40
|
-
aliases=["h", "帮助", "命令帮助"],
|
|
41
|
-
help="显示帮助信息",
|
|
42
|
-
usage="help [命令名] - 显示所有命令或指定命令的详细信息"
|
|
43
|
-
)
|
|
44
|
-
async def help_command(event):
|
|
45
|
-
await self._handle_help_command(event)
|
|
46
|
-
|
|
47
|
-
async def _handle_help_command(self, event: Dict) -> None:
|
|
48
|
-
try:
|
|
49
|
-
platform = event["platform"]
|
|
50
|
-
if event.get("detail_type") == "group":
|
|
51
|
-
target_type = "group"
|
|
52
|
-
target_id = event["group_id"]
|
|
53
|
-
else:
|
|
54
|
-
target_type = "user"
|
|
55
|
-
target_id = event["user_id"]
|
|
56
|
-
|
|
57
|
-
# 获取命令参数
|
|
58
|
-
args = event.get("command", {}).get("args", [])
|
|
59
|
-
|
|
60
|
-
# 获取适配器实例
|
|
61
|
-
adapter = getattr(sdk.adapter, platform)
|
|
62
|
-
|
|
63
|
-
if args:
|
|
64
|
-
# 查看特定命令的详细帮助
|
|
65
|
-
cmd_name = args[0].lower()
|
|
66
|
-
help_text = self._get_command_detail(cmd_name)
|
|
67
|
-
else:
|
|
68
|
-
# 显示所有命令的简要帮助
|
|
69
|
-
# 根据配置决定是否显示隐藏命令
|
|
70
|
-
module_config = self._get_config()
|
|
71
|
-
show_hidden = module_config.get("show_hidden_commands", False)
|
|
72
|
-
|
|
73
|
-
if show_hidden:
|
|
74
|
-
# 显示所有命令(包括隐藏命令)
|
|
75
|
-
commands_info = {}
|
|
76
|
-
all_commands = command.get_commands()
|
|
77
|
-
for cmd_name in all_commands:
|
|
78
|
-
# 只获取主命令,避免重复显示别名
|
|
79
|
-
cmd_info = command.get_command(cmd_name)
|
|
80
|
-
if cmd_info and cmd_name == cmd_info.get("main_name"):
|
|
81
|
-
commands_info[cmd_name] = cmd_info
|
|
82
|
-
else:
|
|
83
|
-
# 只显示可见命令
|
|
84
|
-
commands_info = {}
|
|
85
|
-
visible_commands = command.get_visible_commands()
|
|
86
|
-
for cmd_name in visible_commands:
|
|
87
|
-
cmd_info = command.get_command(cmd_name)
|
|
88
|
-
if cmd_info:
|
|
89
|
-
commands_info[cmd_name] = cmd_info
|
|
90
|
-
|
|
91
|
-
help_text = self._format_help_text(commands_info, show_hidden)
|
|
92
|
-
|
|
93
|
-
# 发送帮助信息
|
|
94
|
-
await adapter.Send.To(target_type, target_id).Text(help_text)
|
|
95
|
-
except Exception as e:
|
|
96
|
-
self.logger.error(f"处理帮助命令时出错: {e}")
|
|
97
|
-
if 'adapter' in locals():
|
|
98
|
-
error_msg = "处理帮助命令时发生错误,请稍后再试"
|
|
99
|
-
await adapter.Send.To(target_type, target_id).Text(error_msg)
|
|
100
|
-
|
|
101
|
-
def _format_help_text(self, commands_info: Dict[str, Dict], show_hidden: bool = False) -> str:
|
|
102
|
-
prefix = self._get_command_prefix()
|
|
103
|
-
module_config = self._get_config()
|
|
104
|
-
style = module_config.get("style", "simple")
|
|
105
|
-
|
|
106
|
-
if style == "detailed":
|
|
107
|
-
return self._format_detailed_help_text(commands_info, show_hidden)
|
|
108
|
-
else:
|
|
109
|
-
return self._format_simple_help_text(commands_info, show_hidden)
|
|
110
|
-
|
|
111
|
-
def _format_simple_help_text(self, commands_info: Dict[str, Dict], show_hidden: bool = False) -> str:
|
|
112
|
-
prefix = self._get_command_prefix()
|
|
113
|
-
module_config = self._get_config()
|
|
114
|
-
|
|
115
|
-
help_lines = [
|
|
116
|
-
"=" * 50,
|
|
117
|
-
"命令帮助",
|
|
118
|
-
"=" * 50,
|
|
119
|
-
]
|
|
120
|
-
|
|
121
|
-
if show_hidden:
|
|
122
|
-
help_lines.append("[注意] 当前显示所有命令(包括隐藏命令)")
|
|
123
|
-
|
|
124
|
-
help_lines.append(f"使用 '{prefix}help <命令名>' 查看具体命令的详细用法")
|
|
125
|
-
help_lines.append("")
|
|
126
|
-
|
|
127
|
-
# 根据配置决定是否按组显示命令
|
|
128
|
-
if module_config.get("group_commands", True):
|
|
129
|
-
# 按命令组分组
|
|
130
|
-
grouped_commands = self._group_commands_by_category(commands_info)
|
|
131
|
-
|
|
132
|
-
# 添加默认组的命令
|
|
133
|
-
if "default" in grouped_commands:
|
|
134
|
-
help_lines.append("[通用命令]")
|
|
135
|
-
for cmd_name, cmd_info in grouped_commands["default"]:
|
|
136
|
-
help_lines.append(self._format_command_brief(cmd_name, cmd_info, prefix))
|
|
137
|
-
help_lines.append("")
|
|
138
|
-
|
|
139
|
-
# 添加其他组的命令
|
|
140
|
-
for group, cmds in grouped_commands.items():
|
|
141
|
-
if group == "default":
|
|
142
|
-
continue
|
|
143
|
-
# 安全处理组名
|
|
144
|
-
group_name = str(group) if group else "其他"
|
|
145
|
-
help_lines.append(f"[{group_name}命令]")
|
|
146
|
-
for cmd_name, cmd_info in cmds:
|
|
147
|
-
help_lines.append(self._format_command_brief(cmd_name, cmd_info, prefix))
|
|
148
|
-
help_lines.append("")
|
|
149
|
-
else:
|
|
150
|
-
# 不分组显示所有命令
|
|
151
|
-
help_lines.append("[所有命令]")
|
|
152
|
-
for cmd_name, cmd_info in commands_info.items():
|
|
153
|
-
help_lines.append(self._format_command_brief(cmd_name, cmd_info, prefix))
|
|
154
|
-
help_lines.append("")
|
|
155
|
-
|
|
156
|
-
# 添加页脚信息
|
|
157
|
-
help_lines.append("-" * 50)
|
|
158
|
-
help_lines.append(f"共 {len(commands_info)} 个可用命令")
|
|
159
|
-
help_lines.append("=" * 50)
|
|
160
|
-
|
|
161
|
-
return "\n".join(help_lines)
|
|
162
|
-
|
|
163
|
-
def _format_detailed_help_text(self, commands_info: Dict[str, Dict], show_hidden: bool = False) -> str:
|
|
164
|
-
prefix = self._get_command_prefix()
|
|
165
|
-
module_config = self._get_config()
|
|
166
|
-
|
|
167
|
-
help_lines = [
|
|
168
|
-
"=" * 50,
|
|
169
|
-
"命令帮助",
|
|
170
|
-
"=" * 50,
|
|
171
|
-
]
|
|
172
|
-
|
|
173
|
-
if show_hidden:
|
|
174
|
-
help_lines.append("[注意] 当前显示所有命令(包括隐藏命令)")
|
|
175
|
-
|
|
176
|
-
help_lines.append(f"使用 '{prefix}help <命令名>' 查看具体命令的详细用法")
|
|
177
|
-
help_lines.append("")
|
|
178
|
-
|
|
179
|
-
# 根据配置决定是否按组显示命令
|
|
180
|
-
if module_config.get("group_commands", True):
|
|
181
|
-
# 按命令组分组
|
|
182
|
-
grouped_commands = self._group_commands_by_category(commands_info)
|
|
183
|
-
|
|
184
|
-
# 添加默认组的命令
|
|
185
|
-
if "default" in grouped_commands:
|
|
186
|
-
help_lines.append("[通用命令]")
|
|
187
|
-
for cmd_name, cmd_info in grouped_commands["default"]:
|
|
188
|
-
help_lines.append(self._format_command_detailed(cmd_name, cmd_info, prefix))
|
|
189
|
-
help_lines.append("")
|
|
190
|
-
|
|
191
|
-
# 添加其他组的命令
|
|
192
|
-
for group, cmds in grouped_commands.items():
|
|
193
|
-
if group == "default":
|
|
194
|
-
continue
|
|
195
|
-
# 安全处理组名
|
|
196
|
-
group_name = str(group) if group else "其他"
|
|
197
|
-
help_lines.append(f"[{group_name}命令]")
|
|
198
|
-
for cmd_name, cmd_info in cmds:
|
|
199
|
-
help_lines.append(self._format_command_detailed(cmd_name, cmd_info, prefix))
|
|
200
|
-
help_lines.append("")
|
|
201
|
-
else:
|
|
202
|
-
# 不分组显示所有命令
|
|
203
|
-
help_lines.append("[所有命令]")
|
|
204
|
-
for cmd_name, cmd_info in commands_info.items():
|
|
205
|
-
help_lines.append(self._format_command_detailed(cmd_name, cmd_info, prefix))
|
|
206
|
-
help_lines.append("")
|
|
207
|
-
|
|
208
|
-
# 添加页脚信息
|
|
209
|
-
help_lines.append("-" * 50)
|
|
210
|
-
help_lines.append(f"共 {len(commands_info)} 个可用命令")
|
|
211
|
-
help_lines.append("=" * 50)
|
|
212
|
-
|
|
213
|
-
return "\n".join(help_lines)
|
|
214
|
-
|
|
215
|
-
def _group_commands_by_category(self, commands_info: Dict[str, Dict]) -> Dict[str, List]:
|
|
216
|
-
grouped_commands = {}
|
|
217
|
-
for cmd_name, cmd_info in commands_info.items():
|
|
218
|
-
group = cmd_info.get("group")
|
|
219
|
-
group = "default" if group is None else group
|
|
220
|
-
if group not in grouped_commands:
|
|
221
|
-
grouped_commands[group] = []
|
|
222
|
-
grouped_commands[group].append((cmd_name, cmd_info))
|
|
223
|
-
return grouped_commands
|
|
224
|
-
|
|
225
|
-
def _format_command_brief(self, cmd_name: str, cmd_info: Dict, prefix: str) -> str:
|
|
226
|
-
# 主命令名
|
|
227
|
-
formatted = f" {prefix}{cmd_name}"
|
|
228
|
-
|
|
229
|
-
# 帮助文本
|
|
230
|
-
help_text = cmd_info.get("help", "暂无描述")
|
|
231
|
-
formatted += f" - {help_text}"
|
|
232
|
-
|
|
233
|
-
return formatted
|
|
234
|
-
|
|
235
|
-
def _format_command_detailed(self, cmd_name: str, cmd_info: Dict, prefix: str) -> str:
|
|
236
|
-
# 主命令名
|
|
237
|
-
formatted = f" {prefix}{cmd_name}"
|
|
238
|
-
|
|
239
|
-
# 帮助文本
|
|
240
|
-
help_text = cmd_info.get("help", "暂无描述")
|
|
241
|
-
formatted += f"\n 描述: {help_text}"
|
|
242
|
-
|
|
243
|
-
# 别名信息
|
|
244
|
-
aliases = []
|
|
245
|
-
for alias, main_name in command.aliases.items():
|
|
246
|
-
if main_name == cmd_info['main_name'] and alias != cmd_info['main_name']:
|
|
247
|
-
aliases.append(alias)
|
|
248
|
-
|
|
249
|
-
if aliases:
|
|
250
|
-
formatted += f"\n 别名: {', '.join(f'{prefix}{a}' for a in aliases)}"
|
|
251
|
-
|
|
252
|
-
# 使用示例
|
|
253
|
-
if cmd_info.get("usage"):
|
|
254
|
-
usage = cmd_info['usage'].replace("/", prefix)
|
|
255
|
-
formatted += f"\n 用法: {usage}"
|
|
256
|
-
|
|
257
|
-
# 权限信息
|
|
258
|
-
if cmd_info.get("permission"):
|
|
259
|
-
formatted += f"\n 权限: 需要特殊权限"
|
|
260
|
-
|
|
261
|
-
# 隐藏状态
|
|
262
|
-
if cmd_info.get("hidden"):
|
|
263
|
-
formatted += f"\n 状态: 隐藏命令"
|
|
264
|
-
|
|
265
|
-
return formatted
|
|
266
|
-
|
|
267
|
-
def _get_command_detail(self, cmd_name: str) -> str:
|
|
268
|
-
prefix = self._get_command_prefix()
|
|
269
|
-
|
|
270
|
-
# 查找命令(支持别名) 使用安全访问方式
|
|
271
|
-
cmd_info = command.get_command(cmd_name)
|
|
272
|
-
|
|
273
|
-
if not cmd_info:
|
|
274
|
-
return f"错误: 未找到命令 '{cmd_name}'"
|
|
275
|
-
|
|
276
|
-
# 构建详细帮助
|
|
277
|
-
lines = [
|
|
278
|
-
"=" * 50,
|
|
279
|
-
f"命令详情: {prefix}{cmd_info['main_name']}",
|
|
280
|
-
"=" * 50,
|
|
281
|
-
f"描述: {cmd_info.get('help', '暂无描述')}"
|
|
282
|
-
]
|
|
283
|
-
|
|
284
|
-
# 别名信息
|
|
285
|
-
aliases = []
|
|
286
|
-
for alias, main_name in command.aliases.items():
|
|
287
|
-
if main_name == cmd_info['main_name'] and alias != cmd_info['main_name']:
|
|
288
|
-
aliases.append(alias)
|
|
289
|
-
|
|
290
|
-
if aliases:
|
|
291
|
-
lines.append(f"别名: {', '.join(f'{prefix}{a}' for a in aliases)}")
|
|
292
|
-
|
|
293
|
-
# 使用示例
|
|
294
|
-
if cmd_info.get("usage"):
|
|
295
|
-
lines.append("")
|
|
296
|
-
lines.append("使用示例:")
|
|
297
|
-
usage = cmd_info['usage'].replace("/", prefix)
|
|
298
|
-
lines.append(f" {usage}")
|
|
299
|
-
|
|
300
|
-
# 权限信息
|
|
301
|
-
if cmd_info.get("permission"):
|
|
302
|
-
lines.append("")
|
|
303
|
-
lines.append("权限: 需要特殊权限才能使用此命令")
|
|
304
|
-
|
|
305
|
-
# 隐藏状态
|
|
306
|
-
if cmd_info.get("hidden"):
|
|
307
|
-
lines.append("")
|
|
308
|
-
lines.append("注意: 这是一个隐藏命令,不会在常规帮助中显示")
|
|
309
|
-
|
|
310
|
-
# 显示命令组信息
|
|
311
|
-
if cmd_info.get("group"):
|
|
312
|
-
lines.append("")
|
|
313
|
-
lines.append(f"分组: {cmd_info['group']}")
|
|
314
|
-
|
|
315
|
-
lines.append("=" * 50)
|
|
316
|
-
return "\n".join(lines)
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ErisPulse-HelpModule
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
5
|
-
Author-email: wsu2059q <wsu2059@qq.com>
|
|
6
|
-
License: Copyright 2025 wsu2059q
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
13
|
-
Project-URL: homepage, https://github.com/wsu2059q/ErisPulse-HelpModule
|
|
14
|
-
Requires-Python: >=3.9
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# ErisPulse-HelpModule
|
|
20
|
-
ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
21
|
-
|
|
22
|
-
## 功能特性
|
|
23
|
-
提供 Event 子模块中 command 模块中统一的命令帮助功能
|
|
24
|
-
- 自动收集并显示所有已注册的命令
|
|
25
|
-
- 支持查看特定命令的详细帮助信息
|
|
26
|
-
- 支持命令分组显示
|
|
27
|
-
- 可配置是否显示隐藏命令
|
|
28
|
-
- 提供简洁和详细两种显示样式
|
|
29
|
-
- 支持命令别名显示
|
|
30
|
-
|
|
31
|
-
## 使用方法
|
|
32
|
-
|
|
33
|
-
### 基本命令
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
/help # 显示所有可用命令的简要帮助
|
|
37
|
-
/help <命令名> # 显示指定命令的详细帮助信息
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### 命令别名
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
/h # 等同于 /help
|
|
44
|
-
/帮助 # 等同于 /help
|
|
45
|
-
/命令帮助 # 等同于 /help
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 配置选项
|
|
49
|
-
|
|
50
|
-
模块支持以下配置选项,可以在 config.toml 中进行自定义:
|
|
51
|
-
|
|
52
|
-
```toml
|
|
53
|
-
[HelpModule]
|
|
54
|
-
show_hidden_commands = false # 是否显示隐藏命令
|
|
55
|
-
style = "simple" # 显示样式: "simple" 或 "detailed"
|
|
56
|
-
group_commands = true # 是否按组显示命令
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 配置说明
|
|
60
|
-
|
|
61
|
-
- `show_hidden_commands`: 设置为 `true` 时,帮助命令会显示被标记为隐藏的命令
|
|
62
|
-
- `style`:
|
|
63
|
-
- `"simple"`: 简洁显示模式,只显示命令名称和简要描述
|
|
64
|
-
- `"detailed"`: 详细显示模式,显示命令的更多详细信息
|
|
65
|
-
- `group_commands`: 设置为 `false` 时,不按组显示命令,所有命令将在同一列表中显示
|
|
66
|
-
|
|
67
|
-
## 依赖
|
|
68
|
-
|
|
69
|
-
- ErisPulse SDK 2.2.0+
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ErisPulse-HelpModule
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
5
|
-
Author-email: wsu2059q <wsu2059@qq.com>
|
|
6
|
-
License: Copyright 2025 wsu2059q
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
13
|
-
Project-URL: homepage, https://github.com/wsu2059q/ErisPulse-HelpModule
|
|
14
|
-
Requires-Python: >=3.9
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# ErisPulse-HelpModule
|
|
20
|
-
ErisPulse 帮助命令模块,提供自动化的命令帮助系统,支持查看所有可用命令及其用法说明
|
|
21
|
-
|
|
22
|
-
## 功能特性
|
|
23
|
-
提供 Event 子模块中 command 模块中统一的命令帮助功能
|
|
24
|
-
- 自动收集并显示所有已注册的命令
|
|
25
|
-
- 支持查看特定命令的详细帮助信息
|
|
26
|
-
- 支持命令分组显示
|
|
27
|
-
- 可配置是否显示隐藏命令
|
|
28
|
-
- 提供简洁和详细两种显示样式
|
|
29
|
-
- 支持命令别名显示
|
|
30
|
-
|
|
31
|
-
## 使用方法
|
|
32
|
-
|
|
33
|
-
### 基本命令
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
/help # 显示所有可用命令的简要帮助
|
|
37
|
-
/help <命令名> # 显示指定命令的详细帮助信息
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### 命令别名
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
/h # 等同于 /help
|
|
44
|
-
/帮助 # 等同于 /help
|
|
45
|
-
/命令帮助 # 等同于 /help
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 配置选项
|
|
49
|
-
|
|
50
|
-
模块支持以下配置选项,可以在 config.toml 中进行自定义:
|
|
51
|
-
|
|
52
|
-
```toml
|
|
53
|
-
[HelpModule]
|
|
54
|
-
show_hidden_commands = false # 是否显示隐藏命令
|
|
55
|
-
style = "simple" # 显示样式: "simple" 或 "detailed"
|
|
56
|
-
group_commands = true # 是否按组显示命令
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 配置说明
|
|
60
|
-
|
|
61
|
-
- `show_hidden_commands`: 设置为 `true` 时,帮助命令会显示被标记为隐藏的命令
|
|
62
|
-
- `style`:
|
|
63
|
-
- `"simple"`: 简洁显示模式,只显示命令名称和简要描述
|
|
64
|
-
- `"detailed"`: 详细显示模式,显示命令的更多详细信息
|
|
65
|
-
- `group_commands`: 设置为 `false` 时,不按组显示命令,所有命令将在同一列表中显示
|
|
66
|
-
|
|
67
|
-
## 依赖
|
|
68
|
-
|
|
69
|
-
- ErisPulse SDK 2.2.0+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|