优化初始化流程,启动时不同步通讯录,只是从数据库里面提取。
This commit is contained in:
24
main.py
24
main.py
@@ -121,7 +121,7 @@ def main(chat_type: int):
|
||||
register_robot(app_id, robot)
|
||||
|
||||
# 机器人启动发送测试消息
|
||||
client.post_text(app_id, send_msg_wxid, "gewechat client 启动成功!")
|
||||
client.post_text(app_id, send_msg_wxid, "client 启动成功!")
|
||||
#
|
||||
# # 每天 8:30 发送新闻
|
||||
# robot.onEveryTime("08:30", robot.news_baidu_report_auto)
|
||||
@@ -145,17 +145,17 @@ def main(chat_type: int):
|
||||
|
||||
# 启动Dashboard服务器
|
||||
dashboard_server = None
|
||||
# try:
|
||||
# # 创建Dashboard服务器实例,共享robot对象
|
||||
# from admin.dashboard.server import DashboardServer
|
||||
# dashboard_server = DashboardServer(robot_instance=robot)
|
||||
#
|
||||
# # 在单独的线程中启动Dashboard服务器
|
||||
# dashboard_thread = threading.Thread(target=dashboard_server.run, daemon=True)
|
||||
# dashboard_thread.start()
|
||||
# robot.LOG.info(f"Dashboard服务器已在 http://{dashboard_server.host}:{dashboard_server.port} 启动")
|
||||
# except Exception as e:
|
||||
# robot.LOG.error(f"Dashboard服务器启动失败: {e}")
|
||||
try:
|
||||
# 创建Dashboard服务器实例,共享robot对象
|
||||
from admin.dashboard.server import DashboardServer
|
||||
dashboard_server = DashboardServer(robot_instance=robot)
|
||||
|
||||
# 在单独的线程中启动Dashboard服务器
|
||||
dashboard_thread = threading.Thread(target=dashboard_server.run, daemon=True)
|
||||
dashboard_thread.start()
|
||||
robot.LOG.info(f"Dashboard服务器已在 http://{dashboard_server.host}:{dashboard_server.port} 启动")
|
||||
except Exception as e:
|
||||
robot.LOG.error(f"Dashboard服务器启动失败: {e}")
|
||||
|
||||
# 让机器人一直跑
|
||||
robot.keep_running_and_block_process()
|
||||
|
||||
Reference in New Issue
Block a user