ruff,修config
parent
224c3029b4
commit
a2ffb6fa8b
|
|
@ -23,12 +23,7 @@ class Config:
|
||||||
self.config_path = os.path.join(self.root_path, "config.toml")
|
self.config_path = os.path.join(self.root_path, "config.toml")
|
||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
include_configs = [
|
include_configs = ["Nickname", "Napcat_Server", "MaiBot_Server", "Debug"]
|
||||||
"Nickname",
|
|
||||||
"Napcat_Server",
|
|
||||||
"MaiBot_Server",
|
|
||||||
"Debug"
|
|
||||||
]
|
|
||||||
if os.path.exists(self.config_path):
|
if os.path.exists(self.config_path):
|
||||||
with open(self.config_path, "rb") as f:
|
with open(self.config_path, "rb") as f:
|
||||||
try:
|
try:
|
||||||
|
|
@ -50,7 +45,7 @@ class Config:
|
||||||
self.napcat_heartbeat_interval = raw_config["Napcat_Server"].get("heartbeat", 30)
|
self.napcat_heartbeat_interval = raw_config["Napcat_Server"].get("heartbeat", 30)
|
||||||
self.mai_host = raw_config["MaiBot_Server"].get("host", "localhost")
|
self.mai_host = raw_config["MaiBot_Server"].get("host", "localhost")
|
||||||
self.mai_port = raw_config["MaiBot_Server"].get("port", 8000)
|
self.mai_port = raw_config["MaiBot_Server"].get("port", 8000)
|
||||||
self.debug_level = raw_config["Debug"].get("debug_level", "INFO")
|
self.debug_level = raw_config["Debug"].get("level", "INFO")
|
||||||
else:
|
else:
|
||||||
logger.error("配置文件不存在!")
|
logger.error("配置文件不存在!")
|
||||||
logger.info("正在创建配置文件...")
|
logger.info("正在创建配置文件...")
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,6 @@ class RecvHandler:
|
||||||
return Seg(type="text", data="回复QQ用户的消息,说:")
|
return Seg(type="text", data="回复QQ用户的消息,说:")
|
||||||
else:
|
else:
|
||||||
return Seg(type="text", data=f"回复{sender_nickname}的消息,说:")
|
return Seg(type="text", data=f"回复{sender_nickname}的消息,说:")
|
||||||
|
|
||||||
|
|
||||||
async def handle_notice(self, raw_message: dict) -> None:
|
async def handle_notice(self, raw_message: dict) -> None:
|
||||||
notice_type = raw_message.get("notice_type")
|
notice_type = raw_message.get("notice_type")
|
||||||
|
|
|
||||||
|
|
@ -152,4 +152,4 @@ class SendHandler:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
send_handler = SendHandler()
|
send_handler = SendHandler()
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ async def get_stranger_info(websocket: Server.ServerConnection, user_id: int) ->
|
||||||
logger.debug(response)
|
logger.debug(response)
|
||||||
return response.get("data")
|
return response.get("data")
|
||||||
|
|
||||||
|
|
||||||
async def get_message_detail(websocket: Server.ServerConnection, message_id: str) -> dict:
|
async def get_message_detail(websocket: Server.ServerConnection, message_id: str) -> dict:
|
||||||
"""
|
"""
|
||||||
获取消息详情
|
获取消息详情
|
||||||
|
|
@ -140,4 +141,4 @@ async def get_message_detail(websocket: Server.ServerConnection, message_id: str
|
||||||
await websocket.send(payload)
|
await websocket.send(payload)
|
||||||
response: dict = await get_response()
|
response: dict = await get_response()
|
||||||
logger.debug(response)
|
logger.debug(response)
|
||||||
return response.get("data")
|
return response.get("data")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue