Skip to content

[Bug]future_task list工具时区问题 #9447

Description

@lq-259

What happened / 发生了什么

未来任务显示是cst,但是bot用future_task list工具看到的时区是utc经常造成神经错乱,我让bot自己修复了但看起来修的太死板了只能辛苦各位维护者了

下面是bot的修复

cron_tools.py 改动:

  1. 导入加上了 timedelta, timezone
  2. list 输出:next=2026-07-21 21:00:00 → next=2026-07-22 05:00:00 CST
  3. create 输出:创建任务时也显示 CST
    原理很简单——数据库里存的 next_run_time 是 UTC 无时区 datetime,doro 给它手动加上 UTC 时区,再转成 CST(+8),最后格式化显示。

Reproduce / 如何复现?

BOT自己使用future_task list工具

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

debian用uv

OS

Linux

Logs / 报错日志

没有报错

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions