肌肉男测试
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
from loguru import logger
|
||||
import os
|
||||
import requests
|
||||
from typing import Dict, Any, List, Optional, Tuple
|
||||
|
||||
import requests
|
||||
from loguru import logger
|
||||
|
||||
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 utils.decorator.points_decorator import plugin_points_cost
|
||||
from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager
|
||||
|
||||
|
||||
class VideoManPlugin(MessagePluginInterface):
|
||||
@@ -86,7 +87,7 @@ class VideoManPlugin(MessagePluginInterface):
|
||||
|
||||
@plugin_stats_decorator(plugin_name="猛男视频")
|
||||
@plugin_points_cost(2, "猛男视频消耗积分", Feature.VIDEO_MAN)
|
||||
def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""处理消息"""
|
||||
content = str(message.get("content", "")).strip()
|
||||
self.LOG.debug(f"插件执行: {self.name}:{content}")
|
||||
@@ -101,14 +102,14 @@ class VideoManPlugin(MessagePluginInterface):
|
||||
try:
|
||||
# 下载视频
|
||||
file_abspath = self._download_video("https://api.guiguiya.com/api/video/fuji?type=json")
|
||||
#FIXME 需要换成web容器地址。否则无法获取。
|
||||
# FIXME 需要换成web容器地址。否则无法获取。
|
||||
if not file_abspath:
|
||||
self.message_util.send_text(f"\n❌视频下载失败,请稍后再试",
|
||||
(roomid if roomid else sender), sender)
|
||||
await self.bot.send_text_message((roomid if roomid else sender), f"\n❌视频下载失败,请稍后再试",
|
||||
sender)
|
||||
return False, "视频下载失败"
|
||||
|
||||
# 发送视频
|
||||
result = self.message_util.send_file(file_abspath, (roomid if roomid else sender))
|
||||
result = await self.bot.send_video_message((roomid if roomid else sender), file_abspath)
|
||||
self.LOG.info(f"发送视频结果: {result}")
|
||||
return True, "发送成功"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user