Skip to content

Commit

Permalink
Merge pull request #124 from MetaLe0/main
Browse files Browse the repository at this point in the history
QQ:内置NapCat协议端
  • Loading branch information
lunzhiPenxil authored May 28, 2024
2 parents ff6a406 + ed51ad8 commit a517938
Show file tree
Hide file tree
Showing 8 changed files with 806 additions and 24 deletions.
1 change: 1 addition & 0 deletions OlivOS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
from .libBooter import libWQEXEModelAPI
from .libBooter import libCWCBEXEModelAPI
from .libBooter import libOPQBotEXEModelAPI
from .libBooter import libNapCatEXEModelAPI
from .nativeGUI import nativeWinUIAPI
from .nativeGUI import webviewUIAPI
from . import userModule
6 changes: 5 additions & 1 deletion OlivOS/adapter/onebotV11/flaskServerAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
'gocqhttp_show_Android_Watch',
'gocqhttp_show_iPad',
'gocqhttp_show_iMac',
'gocqhttp_show_old'
'gocqhttp_show_old',
'napcat',
'napcat_hide',
'napcat_show',
'napcat_show_old'
]

class server(OlivOS.API.Proc_templet):
Expand Down
1 change: 0 additions & 1 deletion OlivOS/adapter/onebotV11/onebotSDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def format_cq_code_msg(msg):
def get_Event_from_SDK(target_event):
target_event.base_info['time'] = target_event.sdk_event.base_info.get('time', int(time.time()))
target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id'])
print(target_event.base_info['self_id'])
target_event.base_info['type'] = target_event.sdk_event.base_info['post_type']
target_event.platform['sdk'] = target_event.sdk_event.platform['sdk']
target_event.platform['platform'] = target_event.sdk_event.platform['platform']
Expand Down
14 changes: 14 additions & 0 deletions OlivOS/core/boot/bootAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,20 @@ def start(self):
'tmp_proc_mode': tmp_proc_mode
}
).start()
elif basic_conf_models_this['type'] == 'napcat_lib_exe_model':
if platform.system() == 'Windows':
threading.Thread(
target = OlivOS.libNapCatEXEModelAPI.startNapCatLibExeModel,
kwargs = {
'plugin_bot_info_dict': plugin_bot_info_dict,
'basic_conf_models_this': basic_conf_models_this,
'multiprocessing_dict': multiprocessing_dict,
'Proc_dict': Proc_dict,
'Proc_Proc_dict': Proc_Proc_dict,
'basic_conf_models': basic_conf_models,
'tmp_proc_mode': tmp_proc_mode
}
).start()
elif basic_conf_models_this['type'] == 'update_get':
threading.Thread(target=update_get_func,
args=(Proc_dict, basic_conf_models, basic_conf_models_this)).start()
Expand Down
17 changes: 17 additions & 0 deletions OlivOS/core/boot/bootDataAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"OlivOS_walleq_lib_exe_model",
"OlivOS_cwcb_lib_exe_model",
"OlivOS_opqbot_lib_exe_model",
"OlivOS_napcat_lib_exe_model",
"OlivOS_hackChat_link",
"OlivOS_OPQBot_link",
"OlivOS_qqRed_link",
Expand Down Expand Up @@ -78,6 +79,7 @@
"OlivOS_walleq_lib_exe_model",
"OlivOS_cwcb_lib_exe_model",
"OlivOS_opqbot_lib_exe_model",
"OlivOS_napcat_lib_exe_model",
"OlivOS_hackChat_link",
"OlivOS_OPQBot_link",
"OlivOS_qqRed_link",
Expand All @@ -102,6 +104,7 @@
"walleq_lib_exe_model",
"cwcb_lib_exe_model",
"opqbot_lib_exe_model",
"napcat_lib_exe_model",
"hackChat_link",
"OPQBot_link",
"qqRed_link",
Expand Down Expand Up @@ -134,6 +137,7 @@
"OlivOS_walleq_lib_rx_queue",
"OlivOS_cwcb_lib_rx_queue",
"OlivOS_opqbot_lib_rx_queue",
"OlivOS_napcat_lib_rx_queue",
"OlivOS_virtual_terminal_queue",
"OlivOS_hackChat_queue",
"OlivOS_OPQBot_queue",
Expand Down Expand Up @@ -516,6 +520,19 @@
"control_queue": "OlivOS_control_queue",
"debug": False
},
"OlivOS_napcat_lib_exe_model": {
"enable": True,
"name": "OlivOS_napcat_lib_exe_model",
"type": "napcat_lib_exe_model",
"interval": 0.2,
"dead_interval": 1,
"rx_queue": "OlivOS_napcat_lib_rx_queue",
"tx_queue": "OlivOS_rx_queue",
"logger_proc": "OlivOS_logger",
"target_proc": None,
"control_queue": "OlivOS_control_queue",
"debug": False
},
"OlivOS_webview_page": {
"enable": True,
"name": "OlivOS_webview_page",
Expand Down
Loading

0 comments on commit a517938

Please sign in to comment.