Files
abot/main.py
2025-03-18 15:45:07 +08:00

46 lines
1.1 KiB
Python

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import signal
from argparse import ArgumentParser
from configuration import Config
from constants import ChatType
from robot import Robot, __version__
from wcferry import Wcf
def main(chat_type: int):
config = Config()
wcf = Wcf(debug=True)
def handler(sig, frame):
# 在退出前先关闭插件系统
robot.plugin_manager.shutdown_plugins()
wcf.cleanup() # 退出前清理环境
exit(0)
signal.signal(signal.SIGINT, handler)
robot = Robot(config, wcf, chat_type)
robot.LOG.info(f"WeChatRobot【{__version__}】成功启动···")
# 机器人启动发送测试消息
robot.send_text_msg("启动成功!", "filehelper")
# 接收消息
robot.enableReceivingMsg() # 加队列
# 加载插件系统
robot.plugin_manager.load_all_plugins()
# 让机器人一直跑
robot.keep_running_and_block_process()
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument('-c', type=int, default=0, help=f'选择模型参数序号: {ChatType.help_hint()}')
args = parser.parse_args().c
main(args)