From bb901e3c1b37dcb4bdfdadd27bb8b10598e4a63f Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 17 Dec 2024 15:23:56 +0800 Subject: [PATCH] fix 1.0.1 --- package.v2.json | 8 ++++---- plugins.v2/BBDown/__init__.py | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/package.v2.json b/package.v2.json index db167e5..eb522b1 100644 --- a/package.v2.json +++ b/package.v2.json @@ -511,16 +511,16 @@ "v3.0": "默认从tmdb刮削,刮削失败则从pt站刮削" } }, - "BBDown": { - "name": "BBDown", + "BbDown": { + "name": "BbDown", "description": "交互下载B站视频,调用BBDown。", "labels": "工具", - "version": "1.0", + "version": "1.0.1", "icon": "Bilibili_E.png", "author": "thsrite", "level": 1, "history": { - "v1.0": "交互下载B站视频,调用BBDown" + "v1.0.1": "交互下载B站视频,调用BBDown" } } } diff --git a/plugins.v2/BBDown/__init__.py b/plugins.v2/BBDown/__init__.py index 0ac43b7..06d0340 100644 --- a/plugins.v2/BBDown/__init__.py +++ b/plugins.v2/BBDown/__init__.py @@ -8,7 +8,7 @@ from app.plugins import _PluginBase from app.schemas.types import EventType -class BBDown(_PluginBase): +class BbDown(_PluginBase): # 插件名称 plugin_name = "BBDown" # 插件描述 @@ -16,7 +16,7 @@ class BBDown(_PluginBase): # 插件图标 plugin_icon = "Bilibili_E.png" # 插件版本 - plugin_version = "1.0" + plugin_version = "1.0.1" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -77,18 +77,18 @@ class BBDown(_PluginBase): self.post_message(channel=event.event_data.get("channel"), title=f"BBDown命令提交成功,请耐心等候!", + text=f"保存路径:{self._save_path}" if self._save_path else None, userid=event.event_data.get("user")) - output = self.__execute_command(command) + output = self.__execute_command(command, event) logger.info(f"命令输出:{output}") self.post_message(channel=event.event_data.get("channel"), title=f"执行命令成功!", - text=f"命令输出:{output[-1]}", + text=f"{output[-1]}", userid=event.event_data.get("user")) - @staticmethod - def __execute_command(command: str): + def __execute_command(self, command: str, event: Event = None): """ 执行命令 :param command: 命令 @@ -102,6 +102,10 @@ class BBDown(_PluginBase): if error: logger.info(error.strip()) ouptut.append(error.strip()) + if event: + self.post_message(channel=event.event_data.get("channel"), + title=error.strip(), + userid=event.event_data.get("user")) while True: output = result.stdout.readline().decode("utf-8") if output == '' and result.poll() is not None: @@ -109,6 +113,10 @@ class BBDown(_PluginBase): if output: logger.info(output.strip()) ouptut.append(output.strip()) + if event: + self.post_message(channel=event.event_data.get("channel"), + title=error.strip(), + userid=event.event_data.get("user")) return ouptut