Skip to content

Commit

Permalink
🏷️ version 0.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Nov 1, 2023
1 parent a5fff78 commit 1bcdcf7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api.md
Expand Up @@ -183,7 +183,7 @@

- chat_type: 聊天类型,分为好友与群组
- target: 目标 id
- offset: 从最近一条消息算起,选择从第几条消息开始拉取
- offset_msg_id: 从哪一条消息开始拉取,使用event.msgId
- count: 一次拉取多少消息

## send_fake_forward
Expand Down
15 changes: 15 additions & 0 deletions migrate.md
Expand Up @@ -134,6 +134,11 @@ async def _handle_v12(bot: Bot, event: Union[V12MessageEvent, V11MessageEvent]):
当然,我们为 `MessageEvent` 提供了一些属性来帮助你更方便地获取消息内容:

```python
@property
def time(self):
"""消息发送时间"""
return datetime.fromtimestamp(int(self.msgTime))

@property
def scene(self) -> str:
"""群组或好友的id"""
Expand All @@ -148,6 +153,16 @@ def is_group(self) -> bool:
def is_private(self) -> bool:
"""是否为私聊消息"""
return self.chatType == ChatType.FRIEND

@property
def user_id(self) -> str:
"""好友的id"""
return self.peerUin or self.peerUid

@property
def group_id(self) -> str:
"""群组的id"""
return self.peerUin or self.peerUid
```

### 消息内容
Expand Down
2 changes: 1 addition & 1 deletion nonebot/adapters/red/__init__.py
Expand Up @@ -6,4 +6,4 @@
from .event import GroupMessageEvent as GroupMessageEvent
from .event import PrivateMessageEvent as PrivateMessageEvent

__version__ = "0.7.3"
__version__ = "0.7.4"
4 changes: 2 additions & 2 deletions nonebot/adapters/red/bot.py
Expand Up @@ -442,15 +442,15 @@ async def get_history_messages(
self,
chat_type: ChatType,
target: Union[int, str],
offset_msg_id: str,
offset_msg_id: Optional[str] = None,
count: int = 100,
):
"""拉取历史消息
参数:
chat_type: 聊天类型,分为好友与群组
target: 目标 id
offset_msg_id: 从哪一条消息开始拉去,使用msgId
offset_msg_id: 从哪一条消息开始拉取,使用event.msgId
count: 一次拉取多少消息
"""
peer = str(target)
Expand Down

0 comments on commit 1bcdcf7

Please sign in to comment.