Skip to content

Commit

Permalink
fix support for Message ctor with None msg
Browse files Browse the repository at this point in the history
  • Loading branch information
cleoold committed Aug 24, 2021
1 parent 1489b47 commit 317cd52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aiocqhttp/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class Message(list):

def __init__(self, msg: Any = None, *args, **kwargs):
"""
- ``msg``: 要转换为 `Message` 对象的字符串、列表或字典。
- ``msg``: 要转换为 `Message` 对象的字符串、列表或字典。不传入则构造空消息。
当 ``msg`` 不能识别时,抛出 ``ValueError``。
"""
Expand All @@ -411,7 +411,7 @@ def __init__(self, msg: Any = None, *args, **kwargs):
self.extend(msg)
elif isinstance(msg, dict):
self.append(msg)
else:
elif msg is not None:
raise ValueError('the msg argument is not recognized')

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## master

- 修复从 `str` 构造 `Message` 时无法正确去转义参数 [#57](https://github.com/nonebot/aiocqhttp/issues/57)
- 修复无法构造空 `Message` 的问题

## v1.4.1

Expand Down

1 comment on commit 317cd52

@cleoold
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.