mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
fix: optimize client instantiation in message sending logic
This commit is contained in:
@@ -19,7 +19,6 @@ from Crypto.Util.Padding import pad
|
|||||||
from app.core.cache import FileCache
|
from app.core.cache import FileCache
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.context import Context, MediaInfo
|
from app.core.context import Context, MediaInfo
|
||||||
from app.core.meta import MetaBase
|
|
||||||
from app.core.metainfo import MetaInfo
|
from app.core.metainfo import MetaInfo
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
@@ -1987,9 +1986,10 @@ class WechatClawBot:
|
|||||||
context_token=context_token,
|
context_token=context_token,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
client = self._build_client()
|
||||||
sent = True
|
sent = True
|
||||||
for chunk in self._split_content(content):
|
for chunk in self._split_content(content):
|
||||||
if not self._build_client().send_markdown(
|
if not client.send_markdown(
|
||||||
to_user=target,
|
to_user=target,
|
||||||
text=chunk,
|
text=chunk,
|
||||||
context_token=context_token,
|
context_token=context_token,
|
||||||
@@ -2023,9 +2023,10 @@ class WechatClawBot:
|
|||||||
for target in targets:
|
for target in targets:
|
||||||
context_token = self._get_context_token(target)
|
context_token = self._get_context_token(target)
|
||||||
sent = True
|
sent = True
|
||||||
|
client = self._build_client()
|
||||||
if caption:
|
if caption:
|
||||||
for chunk in self._split_content(caption):
|
for chunk in self._split_content(caption):
|
||||||
if not self._build_client().send_markdown(
|
if not client.send_markdown(
|
||||||
to_user=target,
|
to_user=target,
|
||||||
text=chunk,
|
text=chunk,
|
||||||
context_token=context_token,
|
context_token=context_token,
|
||||||
|
|||||||
Reference in New Issue
Block a user