fix message

This commit is contained in:
jxxghp
2024-03-14 20:36:15 +08:00
parent 6e607ca89f
commit a5d044d535
5 changed files with 69 additions and 13 deletions

View File

@ -18,6 +18,18 @@ class CommingMessage(BaseModel):
# 消息体
text: Optional[str] = None
def dict(self):
"""
转换为字典
"""
return {
"userid": self.userid,
"username": self.username,
"channel": self.channel.value if self.channel else None,
"text": self.text,
"action": 0
}
class Notification(BaseModel):
"""
@ -46,7 +58,8 @@ class Notification(BaseModel):
"text": self.text,
"image": self.image,
"link": self.link,
"userid": self.userid
"userid": self.userid,
"action": 1
}

View File

@ -117,3 +117,4 @@ class MessageChannel(Enum):
Slack = "Slack"
SynologyChat = "SynologyChat"
VoceChat = "VoceChat"
Web = "Web"