chore: 整理代码

This commit is contained in:
RockChinQ 2024-02-08 13:37:27 +08:00
parent e705e707e5
commit d95e18c202
4 changed files with 19 additions and 20 deletions

View File

@ -29,10 +29,6 @@ class PluginOperator(operator.CommandOperator):
plugin.plugin_version, plugin.plugin_author)
# TODO 从元数据调远程地址
# if updater.is_repo("/".join(plugin['path'].split('/')[:-1])):
# remote_url = updater.get_remote_url("/".join(plugin['path'].split('/')[:-1]))
# if remote_url != "https://github.com/RockChinQ/QChatGPT" and remote_url != "https://gitee.com/RockChin/QChatGPT":
# reply_str += "源码: "+remote_url+"\n"
idx += 1

View File

@ -28,7 +28,8 @@ class StageProcessResult(pydantic.BaseModel):
user_notice: typing.Optional[typing.Union[str, list[mirai_message.MessageComponent], mirai.MessageChain, None]] = []
"""只要设置了就会发送给用户"""
admin_notice: typing.Optional[typing.Union[str, list[mirai_message.MessageComponent], mirai.MessageChain, None]] = []
# TODO delete
# admin_notice: typing.Optional[typing.Union[str, list[mirai_message.MessageComponent], mirai.MessageChain, None]] = []
"""只要设置了就会发送给管理员"""
console_notice: typing.Optional[str] = ''
@ -37,5 +38,3 @@ class StageProcessResult(pydantic.BaseModel):
debug_notice: typing.Optional[str] = ''
error_notice: typing.Optional[str] = ''

View File

@ -150,22 +150,23 @@ class PlatformManager:
)
# 通知系统管理员
async def notify_admin(self, message: str):
await self.notify_admin_message_chain(MessageChain([Plain("[bot]{}".format(message))]))
# TODO delete
# async def notify_admin(self, message: str):
# await self.notify_admin_message_chain(MessageChain([Plain("[bot]{}".format(message))]))
async def notify_admin_message_chain(self, message: mirai.MessageChain):
if self.ap.system_cfg.data['admin-sessions'] != []:
# async def notify_admin_message_chain(self, message: mirai.MessageChain):
# if self.ap.system_cfg.data['admin-sessions'] != []:
admin_list = []
for admin in self.ap.system_cfg.data['admin-sessions']:
admin_list.append(admin)
# admin_list = []
# for admin in self.ap.system_cfg.data['admin-sessions']:
# admin_list.append(admin)
for adm in admin_list:
self.adapter.send_message(
adm.split("_")[0],
adm.split("_")[1],
message
)
# for adm in admin_list:
# self.adapter.send_message(
# adm.split("_")[0],
# adm.split("_")[1],
# message
# )
async def run(self):
try:

View File

@ -6,6 +6,9 @@ asciiart = r"""
/ _ \ / __| |_ __ _| |_ / __| _ \_ _|
| (_) | (__| ' \/ _` | _| (_ | _/ | |
\__\_\\___|_||_\__,_|\__|\___|_| |_|
开源地址: https://github.com/RockChinQ/QChatGPT
📖文档地址: https://q.rkcn.top
"""
if __name__ == '__main__':