调整美腿功能

This commit is contained in:
liuwei
2025-05-22 09:23:34 +08:00
parent 06f84efbb5
commit 78128d360a
2 changed files with 7 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
[Beautyleg]
enable = true
image_folder = '/mnt/nfs_share/beauty_leg'
command = ["美腿", "腿来"]
command-format = """
🦵美腿图片指令:

View File

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