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, "发送成功"