From 412e10972fb5e310164abcb0717fa585d1c46028 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 10 May 2026 23:00:47 +0800 Subject: [PATCH] fix: optimize client instantiation in message sending logic --- app/modules/wechatclawbot/wechatclawbot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/modules/wechatclawbot/wechatclawbot.py b/app/modules/wechatclawbot/wechatclawbot.py index 53f49cb5..47d0a8a3 100644 --- a/app/modules/wechatclawbot/wechatclawbot.py +++ b/app/modules/wechatclawbot/wechatclawbot.py @@ -19,7 +19,6 @@ from Crypto.Util.Padding import pad from app.core.cache import FileCache from app.core.config import settings from app.core.context import Context, MediaInfo -from app.core.meta import MetaBase from app.core.metainfo import MetaInfo from app.log import logger from app.utils.http import RequestUtils @@ -1987,9 +1986,10 @@ class WechatClawBot: context_token=context_token, ) else: + client = self._build_client() sent = True for chunk in self._split_content(content): - if not self._build_client().send_markdown( + if not client.send_markdown( to_user=target, text=chunk, context_token=context_token, @@ -2023,9 +2023,10 @@ class WechatClawBot: for target in targets: context_token = self._get_context_token(target) sent = True + client = self._build_client() if caption: for chunk in self._split_content(caption): - if not self._build_client().send_markdown( + if not client.send_markdown( to_user=target, text=chunk, context_token=context_token,