g1331 / xiaomai-bot

以Graia Ariadne框架为基础的战地1QQ机器人
GNU General Public License v3.0
44 stars 7 forks source link

Fix: Change update logic #38

Closed Ra2-IFV closed 1 week ago

Ra2-IFV commented 3 weeks ago

Works but not perfect enough

Summary by Sourcery

重构日期时间处理以简化和保持一致性,添加启动检查以确保所需目录存在,并增强交换数据处理逻辑以支持强制更新和改进数据管理。

增强功能:

Original summary in English ## Summary by Sourcery Refactor datetime handling for simplicity and consistency, add a startup check for required directories, and enhance the exchange data handling logic to support force updates and improve data management. Enhancements: - Simplify datetime usage by replacing 'datetime.datetime.now()' with 'datetime.now()' throughout the codebase. - Improve directory management by adding a startup check to create required directories if they do not exist. - Enhance the 'get_exchange' function to handle force updates and improve data handling logic.
sourcery-ai[bot] commented 3 weeks ago

审核指南由 Sourcery 提供

此拉取请求实现了若干更改,以提高代码的功能性和可维护性。主要更改包括更新 datetime 的使用、修改交换数据处理以及在启动时添加目录检查。

文件级更改

更改 详情 文件
更新 datetime 使用
  • 用 datetime 替换 datetime.datetime
  • 更新 datetime 字符串格式化
modules/self_contained/bf1_info/__init__.py
修改交换数据处理
  • 更改交换数据的文件命名约定
  • 实现强制更新功能
  • 重构交换数据检索和缓存逻辑
modules/self_contained/bf1_info/__init__.py
utils/bf1/draw/__init__.py
在启动时添加目录检查
  • 实现一个函数以在应用程序启动时检查并创建所需目录
modules/self_contained/bf1_info/__init__.py

提示 - 通过在拉取请求中评论 `@sourcery-ai review` 来触发新的 Sourcery 审核。 - 通过直接回复审核评论继续与 Sourcery 的讨论。 - 您可以随时通过访问您的[仪表板](https://app.sourcery.ai)来更改审核设置: - 启用或禁用 Sourcery 生成的拉取请求摘要或审核指南; - 更改审核语言; - 如果您有任何问题或反馈,您可以随时[联系我们](mailto:support@sourcery.ai)。
Original review guide in English ## Reviewer's Guide by Sourcery This pull request implements several changes to improve the functionality and maintainability of the code. The main changes include updating the datetime usage, modifying the exchange data handling, and adding a directory check on startup. ### File-Level Changes | Change | Details | Files | | ------ | ------- | ----- | | Update datetime usage |
  • Replace datetime.datetime with datetime
  • Update datetime string formatting
| `modules/self_contained/bf1_info/__init__.py` | | Modify exchange data handling |
  • Change file naming convention for exchange data
  • Implement force update functionality
  • Refactor exchange data retrieval and caching logic
| `modules/self_contained/bf1_info/__init__.py`
`utils/bf1/draw/__init__.py` | | Add directory check on startup |
  • Implement a function to check and create required directories on application launch
| `modules/self_contained/bf1_info/__init__.py` | ---
Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.