server启动之后,填入callback

This commit is contained in:
liuwei
2025-04-23 11:47:39 +08:00
parent 1ab34cde0a
commit b8ea01ce4b
5 changed files with 5 additions and 5 deletions

View File

@@ -5,7 +5,7 @@ import uvicorn
from fastapi import FastAPI from fastapi import FastAPI
from gewechat.api.callback import router as callback_router from gewechat.api.callback import router as callback_router
from gewechat.client import gewe_client from gewechat.client import gewe_client, Client
# 配置日志 # 配置日志
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -54,4 +54,4 @@ class Client:
logger.error("set_callback 多次重试后仍失败请检查server状态。") logger.error("set_callback 多次重试后仍失败请检查server状态。")
# 项目全局唯一 client 实例 # 项目全局唯一 client 实例
gewe_client = Client().client gewe_client = Client()

View File

@@ -31,7 +31,7 @@ def main(chat_type: int):
register_robot(gewe_client.app_id, robot) register_robot(gewe_client.app_id, robot)
# 机器人启动发送测试消息 # 机器人启动发送测试消息
gewe_client.post_text(gewe_client.app_id, send_msg_wxid, "client 启动成功!") gewe_client.client.post_text(gewe_client.app_id, send_msg_wxid, "client 启动成功!")
# #
# # 每天 8:30 发送新闻 # # 每天 8:30 发送新闻
# robot.onEveryTime("08:30", robot.news_baidu_report_auto) # robot.onEveryTime("08:30", robot.news_baidu_report_auto)

View File

@@ -19,7 +19,7 @@ class MessageUtil:
# 修改 MessageUtil 类的初始化方法,接受联系人管理器而不是联系人字典 # 修改 MessageUtil 类的初始化方法,接受联系人管理器而不是联系人字典
def __init__(self): def __init__(self):
self.app_id = gewe_client.app_id self.app_id = gewe_client.app_id
self.client = gewe_client self.client = gewe_client.client
self.contact_manager = ContactManager.get_instance() self.contact_manager = ContactManager.get_instance()
self.LOG = logging.getLogger("MessageUtil") self.LOG = logging.getLogger("MessageUtil")

View File

@@ -39,7 +39,7 @@ class Robot(Job):
""" """
def __init__(self, config: Config) -> None: def __init__(self, config: Config) -> None:
self.client = gewe_client self.client = gewe_client.client
self.config = config self.config = config
self.LOG = logging.getLogger("Robot") self.LOG = logging.getLogger("Robot")