mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-05-11 18:10:15 +08:00
fix actions
This commit is contained in:
@@ -17,15 +17,13 @@ class SendEventAction(BaseAction):
|
||||
发送事件
|
||||
"""
|
||||
|
||||
__success = False
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "发送事件"
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return "发送特定事件"
|
||||
return "发送队列中的所有事件"
|
||||
|
||||
@property
|
||||
def data(self) -> dict:
|
||||
@@ -33,7 +31,7 @@ class SendEventAction(BaseAction):
|
||||
|
||||
@property
|
||||
def success(self) -> bool:
|
||||
return self.__success
|
||||
return self.done
|
||||
|
||||
async def execute(self, params: SendEventParams, context: ActionContext) -> ActionContext:
|
||||
"""
|
||||
@@ -45,7 +43,6 @@ class SendEventAction(BaseAction):
|
||||
for event in copy.deepcopy(context.events):
|
||||
eventmanager.send_event(etype=event.event_type, data=event.event_data)
|
||||
context.events.remove(event)
|
||||
self.__success = True
|
||||
|
||||
self.job_done()
|
||||
return context
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import copy
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from app.actions import BaseAction, ActionChain
|
||||
from app.schemas import ActionParams, ActionContext, MessageChannel
|
||||
from app.schemas import ActionParams, ActionContext
|
||||
|
||||
|
||||
class SendMessageParams(ActionParams):
|
||||
"""
|
||||
发送消息参数
|
||||
"""
|
||||
channel: Optional[List[str]] = Field([], description="消息渠道")
|
||||
client: Optional[List[str]] = Field([], description="消息渠道")
|
||||
userid: Optional[Union[str, int]] = Field(None, description="用户ID")
|
||||
|
||||
|
||||
@@ -29,7 +30,7 @@ class SendMessageAction(BaseAction):
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return "发送特定消息"
|
||||
return "发送队列中的所有消息"
|
||||
|
||||
@property
|
||||
def data(self) -> dict:
|
||||
@@ -43,12 +44,13 @@ class SendMessageAction(BaseAction):
|
||||
"""
|
||||
发送messages中的消息
|
||||
"""
|
||||
for message in context.messages:
|
||||
if params.channel:
|
||||
message.channel = MessageChannel(params.channel)
|
||||
for message in copy.deepcopy(context.messages):
|
||||
if params.client:
|
||||
message.source = params.client
|
||||
if params.userid:
|
||||
message.userid = params.userid
|
||||
self.chain.post_message(message)
|
||||
context.messages.remove(message)
|
||||
|
||||
context.messages = []
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class TransferFileAction(BaseAction):
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return "转移和重命名文件"
|
||||
return "整理下载队列中的文件"
|
||||
|
||||
@property
|
||||
def data(self) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user