diff --git a/src/plugins/nonebot_hk_reporter/platform/platform.py b/src/plugins/nonebot_hk_reporter/platform/platform.py index b1ecf12..bc2e777 100644 --- a/src/plugins/nonebot_hk_reporter/platform/platform.py +++ b/src/plugins/nonebot_hk_reporter/platform/platform.py @@ -168,6 +168,7 @@ class NewMessageProcessMixin(StorageMixinProto, MessageProcessMixin, abstract=Tr if post_id in store.exists_posts: continue res.append(raw_post) + store.exists_posts.add(post_id) self.set_stored_data(target, store) return res diff --git a/tests/platforms/test_platform.py b/tests/platforms/test_platform.py index c6c42b0..468eb6d 100644 --- a/tests/platforms/test_platform.py +++ b/tests/platforms/test_platform.py @@ -276,6 +276,8 @@ async def test_new_message_no_target(mock_platform_no_target, user_info_factory) assert('p2' in id_set_1 and 'p3' in id_set_1) assert('p2' in id_set_2) assert('p2' in id_set_3) + res3 = await mock_platform_no_target.fetch_new_post('dummy', [user_info_factory(lambda _: [1,2], lambda _: [])]) + assert(len(res3) == 0) @pytest.mark.asyncio async def test_status_change(mock_status_change, user_info_factory):