diff --git a/nonebot_bison/platform/arknights.py b/nonebot_bison/platform/arknights.py index a3f788c..5fb28a9 100644 --- a/nonebot_bison/platform/arknights.py +++ b/nonebot_bison/platform/arknights.py @@ -82,7 +82,11 @@ class Arknights(NewMessage): return post.cid def get_date(self, post: BulletinListItem) -> Any: - return post.updated_at + # 为什么不使用post.updated_at? + # update_at的时间是上传鹰角服务器的时间,而不是公告发布的时间 + # 也就是说鹰角可能会在中午就把晚上的公告上传到服务器,但晚上公告才会显示,但是update_at就是中午的时间不会改变 + # 如果指定了get_date,那么get_date会被优先使用, 并在获取到的值超过2小时时忽略这条post,导致其不会被发送 + return None def get_category(self, _) -> Category: return Category(1) diff --git a/tests/platforms/test_arknights.py b/tests/platforms/test_arknights.py index 153aa69..c33c120 100644 --- a/tests/platforms/test_arknights.py +++ b/tests/platforms/test_arknights.py @@ -41,6 +41,27 @@ def monster_siren_list_1(): return get_json("monster-siren_list_1.json") +@pytest.mark.asyncio() +async def test_get_date_in_bulletin(app: App): + from nonebot_bison.utils import ProcessContext + from nonebot_bison.platform.arknights import Arknights, BulletinListItem + + arknights = Arknights(ProcessContext(), AsyncClient()) + assert ( + arknights.get_date( + BulletinListItem( + cid="1", + title="", + category=1, + displayTime="", + updatedAt=1627036800, + sticky=False, + ) + ) + is None + ) + + @pytest.mark.asyncio() @respx.mock async def test_fetch_new(