From dbb6bb2583cd2b362617d644655bb948d3f0707b Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 21 May 2025 09:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 4 ++++ robot.py | 4 ++++ wechat_ipad/client/message.py | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 3ca4ee8..575b1a1 100644 --- a/main.py +++ b/main.py @@ -112,6 +112,10 @@ def jobs(robot: Robot): async def login_check_job(): await robot.login_twice_auto_auth() + @async_job.at_times(["09:57"]) + async def login_test(): + await robot.send_ranking_task() + @async_job.at_times(["05:00"]) async def update_image_cache_job(): logger.info("开始执行图片缓存更新任务") diff --git a/robot.py b/robot.py index aec4892..c4285fb 100644 --- a/robot.py +++ b/robot.py @@ -673,3 +673,7 @@ class Robot: await self.ipad_bot.send_text_message(r, output) except Exception as e: self.LOG.error(f"SendRanking error:{e}") + + async def send_ranking_task(self): + result = await self.ipad_bot.get_chatroom_nickname("Jyunere", "43687793133@chatroom") + self.LOG.info(f"send_ranking_task:{result}") diff --git a/wechat_ipad/client/message.py b/wechat_ipad/client/message.py index a961457..3f8984a 100644 --- a/wechat_ipad/client/message.py +++ b/wechat_ipad/client/message.py @@ -249,8 +249,8 @@ class MessageMixin(WechatAPIClientBase): image_base64 = base64.b64encode(f.read()).decode() else: raise ValueError("image should be str, bytes, or path") - self.logging.debug(f"vid_base64:{vid_base64}") - self.logging.debug(f"images_base64:{image_base64}") + # self.logging.debug(f"vid_base64:{vid_base64}") + # self.logging.debug(f"images_base64:{image_base64}") # 打印预估时间,300KB/s predict_time = int(file_len / 1024 / 300) self.logging.info("开始发送视频: 对方wxid:{} 视频base64略 图片base64略 预计耗时:{}秒", wxid, predict_time) @@ -259,10 +259,10 @@ class MessageMixin(WechatAPIClientBase): json_param = {"Wxid": self.wxid, "ToWxid": wxid, "Base64": "data:video/mp4;base64,"+vid_base64, "ImageBase64": "data:image/jpeg;base64," + image_base64, "PlayLength": duration} - self.logging.debug(f"json_param::{json_param}") + # self.logging.debug(f"json_param::{json_param}") async with session.post(f'http://{self.ip}:{self.port}/api/Msg/SendVideo', json=json_param) as resp: json_resp = await resp.json() - self.logging.debug(f"json_resp:{json_resp}") + # self.logging.debug(f"json_resp:{json_resp}") if json_resp.get("Success"): json_param.pop('Base64') json_param.pop('ImageBase64')