From 78128d360ad51063083c46bd8816de291341c21e Mon Sep 17 00:00:00 2001 From: liuwei Date: Thu, 22 May 2025 09:23:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BE=8E=E8=85=BF=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/beautyleg/config.toml | 1 + plugins/beautyleg/main.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/beautyleg/config.toml b/plugins/beautyleg/config.toml index 7044794..671be74 100644 --- a/plugins/beautyleg/config.toml +++ b/plugins/beautyleg/config.toml @@ -1,5 +1,6 @@ [Beautyleg] enable = true +image_folder = '/mnt/nfs_share/beauty_leg' command = ["美腿", "腿来"] command-format = """ 🦵美腿图片指令: diff --git a/plugins/beautyleg/main.py b/plugins/beautyleg/main.py index a5eb946..be8123d 100644 --- a/plugins/beautyleg/main.py +++ b/plugins/beautyleg/main.py @@ -2,6 +2,8 @@ import os import random from typing import Dict, Any, List, Optional, Tuple +from pathlib import Path + from plugin_common.message_plugin_interface import MessagePluginInterface from plugin_common.plugin_interface import PluginStatus from utils.decorator.plugin_decorators import plugin_stats_decorator @@ -54,7 +56,9 @@ class BeautyLegPlugin(MessagePluginInterface): self._commands = self._config.get("Beautyleg", {}).get("command", ["美腿", "腿来"]) self.command_format = self._config.get("Beautyleg", {}).get("command-format", "美腿") self.enable = self._config.get("Beautyleg", {}).get("enable", True) - + config_image_folder = self._config.get("Beautyleg", {}).get("image_folder") + if config_image_folder: + self.image_folder = config_image_folder # 检查图片文件夹是否存在 if not os.path.exists(self.image_folder): self.LOG.warning(f"图片文件夹不存在: {self.image_folder}") @@ -110,7 +114,7 @@ class BeautyLegPlugin(MessagePluginInterface): # 发送图片 random_file_path = os.path.abspath(random_file_path) self.LOG.info(f"BeautyLeg.random_file_path: {random_file_path}") - result = await bot.send_image_message((roomid if roomid else sender), random_file_path) + result = await bot.send_image_message((roomid if roomid else sender), Path(random_file_path)) self.LOG.info(f"发送图片结果: {result}") return True, "发送成功"