diff --git a/src/plugins/nonebot_hk_reporter/post.py b/src/plugins/nonebot_hk_reporter/post.py index cf000ba..d101e7b 100644 --- a/src/plugins/nonebot_hk_reporter/post.py +++ b/src/plugins/nonebot_hk_reporter/post.py @@ -1,5 +1,6 @@ import base64 from dataclasses import dataclass, field +from functools import reduce from io import BytesIO from typing import Optional, Union @@ -125,7 +126,7 @@ class Post: # msgs.append(Message("[CQ:image,file={url}]".format(url=pic))) msgs.append(MessageSegment.image(pic)) if self.compress: - msgs = [Message([msgs])] + msgs = [reduce(lambda x, y: x.append(y), msgs, Message())] msgs.extend(self.extra_msg) self._message = msgs return self._message diff --git a/tests/platforms/test_arknights.py b/tests/platforms/test_arknights.py index d3d2c37..3999513 100644 --- a/tests/platforms/test_arknights.py +++ b/tests/platforms/test_arknights.py @@ -51,3 +51,4 @@ async def test_fetch_new(arknights, dummy_user_subinfo, arknights_list_0, arknig assert(post.target_name == '明日方舟游戏内公告') assert(len(post.pics) == 1) assert(post.pics == ['https://ak-fs.hypergryph.com/announce/images/20210623/e6f49aeb9547a2278678368a43b95b07.jpg']) + r = await post.generate_messages()