diff --git a/main.py b/main.py index 2e45257..f2f2a51 100644 --- a/main.py +++ b/main.py @@ -2,8 +2,10 @@ # -*- coding: utf-8 -*- import signal + from wcferry import Wcf +from configuration import Config from robot import Robot @@ -23,6 +25,7 @@ def weather_report(robot: Robot) -> None: def main(): + config = Config() wcf = Wcf(debug=True) def handler(sig, frame): @@ -31,7 +34,7 @@ def main(): signal.signal(signal.SIGINT, handler) - robot = Robot(wcf) + robot = Robot(config, wcf) robot.LOG.info("正在启动机器人···") # 机器人启动发送测试消息 diff --git a/robot.py b/robot.py index e197e9e..5a22e5a 100644 --- a/robot.py +++ b/robot.py @@ -5,7 +5,6 @@ import re import time import xml.etree.ElementTree as ET -import uvicorn from wcferry import Wcf from configuration import Config @@ -19,9 +18,9 @@ class Robot(Job): """个性化自己的机器人 """ - def __init__(self, wcf: Wcf) -> None: + def __init__(self, config: Config, wcf: Wcf) -> None: self.wcf = wcf - self.config = Config() + self.config = config self.LOG = logging.getLogger("Robot") self.wxid = self.wcf.get_self_wxid() self.allContacts = self.getAllContacts()