优化代码,删除无效代码
This commit is contained in:
@@ -7,11 +7,11 @@ from typing import Dict, Any, List, Optional, Tuple
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from message_util import MessageUtil
|
||||
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 wechat_ipad import WechatAPIClient
|
||||
|
||||
|
||||
class DouyinParserError(Exception):
|
||||
@@ -62,7 +62,6 @@ class DouyinParserPlugin(MessagePluginInterface):
|
||||
|
||||
# 保存上下文对象
|
||||
self.event_system = context.get("event_system")
|
||||
self.message_util: MessageUtil = context.get("message_util")
|
||||
self.gbm = context.get("gbm")
|
||||
|
||||
# 从配置中获取参数
|
||||
@@ -104,6 +103,7 @@ class DouyinParserPlugin(MessagePluginInterface):
|
||||
roomid = message.get("roomid", "")
|
||||
gbm: GroupBotManager = message.get("gbm")
|
||||
|
||||
bot: WechatAPIClient = message.get("bot")
|
||||
# 检查权限
|
||||
if roomid and gbm.get_group_permission(roomid, Feature.DOUYIN_PARSER) == PermissionStatus.DISABLED:
|
||||
return False, "没有权限"
|
||||
@@ -136,7 +136,7 @@ class DouyinParserPlugin(MessagePluginInterface):
|
||||
# 下载并发送文件
|
||||
mp4_path = self._download_stream(video_url, os.path.join(self.download_dir, "douyin.mp4"))
|
||||
if mp4_path:
|
||||
self.message_util.send_file(mp4_path, (roomid if roomid else sender))
|
||||
bot.send_video_message((roomid if roomid else sender),mp4_path)
|
||||
return True, "发送视频文件成功"
|
||||
else:
|
||||
print(f"❌下载视频失败")
|
||||
|
||||
Reference in New Issue
Block a user