重大版本调整:gewechat兼容。
This commit is contained in:
@@ -3,7 +3,6 @@ import os
|
||||
import requests
|
||||
from typing import Dict, Any, List, Optional, Tuple
|
||||
|
||||
from wcferry import Wcf
|
||||
|
||||
from plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from plugin_common.plugin_interface import PluginStatus
|
||||
@@ -50,7 +49,6 @@ class VideoPlugin(MessagePluginInterface):
|
||||
self.LOG.info(f"正在初始化 {self.name} 插件...")
|
||||
|
||||
# 保存上下文对象
|
||||
self.wcf = context.get("wcf")
|
||||
self.event_system = context.get("event_system")
|
||||
self.message_util = context.get("message_util")
|
||||
self.gbm = context.get("gbm")
|
||||
@@ -96,7 +94,6 @@ class VideoPlugin(MessagePluginInterface):
|
||||
self.LOG.info(f"插件执行: {self.name}:{content}")
|
||||
sender = message.get("sender")
|
||||
roomid = message.get("roomid", "")
|
||||
wcf: Wcf = message.get("wcf")
|
||||
gbm: GroupBotManager = message.get("gbm")
|
||||
|
||||
# 检查权限
|
||||
@@ -109,18 +106,18 @@ class VideoPlugin(MessagePluginInterface):
|
||||
file_abspath = self._download_stream("https://api.guiguiya.com/api/hook/heisis", save_path)
|
||||
|
||||
if not file_abspath or not file_abspath.endswith("mp4"):
|
||||
wcf.send_text(f"\n❌视频下载失败,请稍后再试",
|
||||
self.message_util.send_text(f"\n❌视频下载失败,请稍后再试",
|
||||
(roomid if roomid else sender), sender)
|
||||
return False, "视频下载失败"
|
||||
|
||||
# 发送视频
|
||||
result = wcf.send_file(file_abspath, (roomid if roomid else sender))
|
||||
result = self.message_util.send_file(file_abspath, (roomid if roomid else sender))
|
||||
self.LOG.info(f"发送视频结果: {result}")
|
||||
return True, "发送成功"
|
||||
|
||||
except Exception as e:
|
||||
self.LOG.error(f"处理视频请求出错: {e}")
|
||||
wcf.send_text(f"\n❌请求出错:{e}",
|
||||
self.message_util.send_text(f"\n❌请求出错:{e}",
|
||||
(roomid if roomid else sender), sender)
|
||||
return False, f"处理出错: {e}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user