From a2f5b30e75e5eaa917b02de6672178b83f35175d Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 7 Oct 2023 00:22:28 +0800 Subject: [PATCH] add types --- bot/types.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/bot/types.py b/bot/types.py index 33cd8014..2a7433c2 100644 --- a/bot/types.py +++ b/bot/types.py @@ -1,17 +1,64 @@ - +from typing import Optional from lib_not_dr.types import Options class SocketData(Options): name = 'SocketData' + def init(self, **kwargs) -> bool: + self.from_json(kwargs) + return False + + def from_json(self, data: dict): + ... + def to_json(self) -> dict: return self.option() +class Message(SocketData): + name = 'icalingua socket message' + + # 消息 id + message_id: str + # 发送者 id + sender_id: int + # 发送者昵称 + sender_name: str + # 消息内容 + content: str + + # 消息时间戳 + # 13:32:46 + time_stamp: str + # 消息日期 + # 2023/10/05 + date: str + # unix 时间戳 + # 1633395166 + unix_time_stamp: int + + # 发送者身份 + role: str + # 发送者群昵称/备注 + title: str + # 匿名 id + anonymous_id: Optional[int] = None + # 是否匿名 + is_anonymous: bool = False + # 啊 ? + bubble_id: int + # 啊 ? + sub_id: int + + file: Optional[dict] = None + files: Optional[list] = None + + class AddMessage(SocketData): name = 'icalingua socket add message event' - roomId: int + room_id: int +