Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

RSS推送存在bug #46

@Ra1n-qwq

Description

@Ra1n-qwq

”方舟最新公告“功能实现方式有误,使用了升序排序,不能输出最新公告。
建议对.src/tool_announce_push/__init__.py文件中25-54行进行如下修改:

@latest_news.handle()
async def _():
    await latest_news.send("获取最新公告中 ...")
    news_list=[]  
    try:
        news_list = await get_news()
    except:
        logger.error("获取最新公告出错")
    if news_list:  #最新公告未收录数据库中,值不为空。如果配置了自动检测,可能在执行该功能时返回为空。
        news = news_list[0]
    else:  #最新公告已收录数据库中,值为空。采用降序排序,输出单个最近日期公告。
        news = await RSSNewsModel.all().order_by("-time").first() 

    image = await html_to_pic(
        html=news.content
    )
    try:
        await latest_news.finish(
            Message(
                MessageSegment.image(image)
                + "舟舟发布了一条新公告"
                  f"\n发布时间: {news.time.__str__()[:10]}"
                  f"\n{news.link}"
            )
        )
    except ActionFailed as e:
        await latest_news.finish(
            "公告截图失败..."
            f"\n发布时间: {news.time.__str__()[:10]}"
            f"\n{news.link}"
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions