插件化项目优化,支持将代码改造为插件,支持自动加载
This commit is contained in:
10
main.py
10
main.py
@@ -2,6 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import signal
|
||||
import sys # 添加sys模块导入
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from configuration import Config
|
||||
@@ -15,6 +16,8 @@ def main(chat_type: int):
|
||||
wcf = Wcf(debug=True)
|
||||
|
||||
def handler(sig, frame):
|
||||
# 在退出前先关闭插件系统
|
||||
robot.plugin_manager.shutdown_plugins()
|
||||
wcf.cleanup() # 退出前清理环境
|
||||
exit(0)
|
||||
|
||||
@@ -29,10 +32,13 @@ def main(chat_type: int):
|
||||
# 接收消息
|
||||
# robot.enableRecvMsg() # 可能会丢消息?
|
||||
robot.enableReceivingMsg() # 加队列
|
||||
|
||||
|
||||
# 加载插件系统
|
||||
robot.plugin_manager.load_all_plugins()
|
||||
|
||||
# 每天 8:30 发送新闻
|
||||
robot.onEveryTime("08:30", robot.news_baidu_report_auto)
|
||||
|
||||
|
||||
# epic
|
||||
robot.onEveryTime("10:30", robot.send_epic_free_games)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user