From 70b1663939faa922179bc3b9ad52bd25f2fe411f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8E=E6=98=8E?= Date: Sun, 5 May 2024 17:06:44 +0800 Subject: [PATCH] version 0.0.3 --- setup.py | 2 +- wxhook/__init__.py | 2 +- wxhook/core.py | 3 ++- wxhook/model.py | 25 +++++++++++++------------ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index 83a22ed..8f95d56 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ URL = 'https://github.com/miloira/wxhook' EMAIL = '690126048@qq.com' AUTHOR = 'Msky' REQUIRES_PYTHON = '>=3.8.0' -VERSION = '0.0.2' +VERSION = '0.0.3' # What packages are required for this module to be executed? REQUIRED = [ diff --git a/wxhook/__init__.py b/wxhook/__init__.py index 9c5f821..bb56382 100644 --- a/wxhook/__init__.py +++ b/wxhook/__init__.py @@ -1,3 +1,3 @@ from .core import Bot -version = "0.0.2" +version = "0.0.3" diff --git a/wxhook/core.py b/wxhook/core.py index 7ed1fdf..969644b 100644 --- a/wxhook/core.py +++ b/wxhook/core.py @@ -46,7 +46,7 @@ class Bot: on_after_message: typing.Callable = None, on_start: typing.Callable = None, on_stop: typing.Callable = None, - faked_version: typing.Union[str, None] = None + faked_version: typing.Optional[str] = None ): self.version = "3.9.5.81" self.server_host = "127.0.0.1" @@ -439,6 +439,7 @@ class Bot: self.webhook(data) except Exception: logger.error(traceback.format_exc()) + logger.error(raw_data) def handle(self, events: typing.Union[list[str], str, None] = None, once: bool = False): def wrapper(func): diff --git a/wxhook/model.py b/wxhook/model.py index 6aa1551..27b3bd2 100644 --- a/wxhook/model.py +++ b/wxhook/model.py @@ -78,18 +78,19 @@ class RawData: @dataclass class Event: """消息事件""" - content: typing.Any # 消息内容,可能包含用户ID和冒号之后的文本内容 - createTime: int # 消息创建时间的UNIX时间戳 - displayFullContent: str # 完整的消息内容,如果有的话 - fromUser: str # 发送消息的用户或群组ID - msgId: int # 消息的唯一标识符 - msgSequence: int # 消息序列号 - pid: int # 消息的PID - signature: str # 消息签名,包含一系列的配置信息 - toUser: str # 消息接收者的用户ID - type: int # 消息类型 - rawData: RawData # 原始数据 - base64Img: typing.Union[str, None] = None # 图片base64 + content: typing.Optional[typing.Any] = None # 消息内容,可能包含用户ID和冒号之后的文本内容 + base64Img: typing.Optional[str] = None # 图片base64 + data: typing.Optional[list] = None # 朋友圈数据 + createTime: typing.Optional[int] = None # 消息创建时间的UNIX时间戳 + displayFullContent: typing.Optional[str] = None # 完整的消息内容,如果有的话 + fromUser: typing.Optional[str] = None # 发送消息的用户或群组ID + msgId: typing.Optional[int] = None # 消息的唯一标识符 + msgSequence: typing.Optional[int] = None # 消息序列号 + pid: typing.Optional[int] = None # 消息的PID + signature: typing.Optional[str] = None # 消息签名,包含一系列的配置信息 + toUser: typing.Optional[str] = None # 消息接收者的用户ID + type: typing.Optional[int] = None # 消息类型 + rawData: typing.Optional[RawData] = None # 原始数据 @dataclass