From 8d8930292d44dd90f97ab21456ba138ad648dcca Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 20 May 2025 18:14:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=82=8C=E8=82=89=E7=94=B7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/video_man/main.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/video_man/main.py b/plugins/video_man/main.py index e007f2c..1b1af9c 100644 --- a/plugins/video_man/main.py +++ b/plugins/video_man/main.py @@ -1,13 +1,14 @@ -from loguru import logger import os -import requests from typing import Dict, Any, List, Optional, Tuple +import requests +from loguru import logger + from plugin_common.message_plugin_interface import MessagePluginInterface from plugin_common.plugin_interface import PluginStatus from utils.decorator.plugin_decorators import plugin_stats_decorator -from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager from utils.decorator.points_decorator import plugin_points_cost +from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager class VideoManPlugin(MessagePluginInterface): @@ -86,7 +87,7 @@ class VideoManPlugin(MessagePluginInterface): @plugin_stats_decorator(plugin_name="猛男视频") @plugin_points_cost(2, "猛男视频消耗积分", Feature.VIDEO_MAN) - def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]: + async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]: """处理消息""" content = str(message.get("content", "")).strip() self.LOG.debug(f"插件执行: {self.name}:{content}") @@ -101,14 +102,14 @@ class VideoManPlugin(MessagePluginInterface): try: # 下载视频 file_abspath = self._download_video("https://api.guiguiya.com/api/video/fuji?type=json") - #FIXME 需要换成web容器地址。否则无法获取。 + # FIXME 需要换成web容器地址。否则无法获取。 if not file_abspath: - self.message_util.send_text(f"\n❌视频下载失败,请稍后再试", - (roomid if roomid else sender), sender) + await self.bot.send_text_message((roomid if roomid else sender), f"\n❌视频下载失败,请稍后再试", + sender) return False, "视频下载失败" # 发送视频 - result = self.message_util.send_file(file_abspath, (roomid if roomid else sender)) + result = await self.bot.send_video_message((roomid if roomid else sender), file_abspath) self.LOG.info(f"发送视频结果: {result}") return True, "发送成功"