summaryrefslogtreecommitdiff
path: root/ATRI/plugins/help/data_source.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/help/data_source.py')
-rw-r--r--ATRI/plugins/help/data_source.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/ATRI/plugins/help/data_source.py b/ATRI/plugins/help/data_source.py
index 831d1e0..f5104e5 100644
--- a/ATRI/plugins/help/data_source.py
+++ b/ATRI/plugins/help/data_source.py
@@ -24,9 +24,10 @@ COMMAND_INFO_FORMAT = """
class Helper(Service):
+
def __init__(self):
Service.__init__(self, "帮助", "bot的食用指南~")
-
+
@staticmethod
def menu() -> str:
return (
@@ -34,9 +35,9 @@ class Helper(Service):
"关于 -查看bot基本信息\n"
"服务列表 -以查看所有可用服务\n"
"帮助 [服务] -以查看对应服务帮助\n"
- "Tip: 均需要at触发。菜单 打开此页面"
+ "Tip: 均需要at触发。菜单 以打开此页面"
)
-
+
@staticmethod
def about() -> str:
temp_list = list()
@@ -50,7 +51,7 @@ class Helper(Service):
"想进一步了解:\n"
"https://github.com/Kyomotoi/ATRI"
)
-
+
@staticmethod
def service_list() -> str:
files = os.listdir(SERVICES_DIR)
@@ -58,42 +59,42 @@ class Helper(Service):
for i in files:
service = i.replace(".json", "")
temp_list.append(service)
-
+
msg0 = "咱搭载了以下服务~\n"
services = " | ".join(map(str, temp_list))
msg0 = msg0 + services
- repo = msg0 + "\n帮助 [服务] -以查看对应服务帮助"
+ repo = msg0 + "\n@ 帮助 [服务] -以查看对应服务帮助"
return repo
-
+
@staticmethod
def service_info(service: str) -> str:
try:
data = ServiceTools().load_service(service)
except ReadFileError:
return "请检查是否输入错误呢..."
-
+
service_name = data.get("service", "error")
service_docs = data.get("docs", "error")
service_enabled = data.get("enabled", True)
-
+
_service_cmd_list = list(data.get("cmd_list", {"error"}))
service_cmd_list = "\n".join(map(str, _service_cmd_list))
-
+
repo = SERVICE_INFO_FORMAT.format(
service=service_name,
docs=service_docs,
cmd_list=service_cmd_list,
- enabled=service_enabled,
+ enabled=service_enabled
)
return repo
-
+
@staticmethod
def cmd_info(service: str, cmd: str) -> str:
try:
data = ServiceTools().load_service(service)
except ReadFileError:
return "请检查是否输入错误..."
-
+
cmd_list: dict = data["cmd_list"]
cmd_info = cmd_list.get(cmd, dict())
if not cmd_info:
@@ -101,8 +102,11 @@ class Helper(Service):
cmd_type = cmd_info.get("type", "ignore")
docs = cmd_info.get("docs", "ignore")
aliases = cmd_info.get("aliases", "ignore")
-
+
repo = COMMAND_INFO_FORMAT.format(
- cmd=cmd, cmd_type=cmd_type, docs=docs, aliases=aliases
+ cmd=cmd,
+ cmd_type=cmd_type,
+ docs=docs,
+ aliases=aliases
)
return repo