Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加秘境等级限制,防止出现秘境结算时temp_dict为空的情况 #89

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

PackageInstaller
Copy link
Member

@PackageInstaller PackageInstaller commented Jan 13, 2025

Summary by Sourcery

新功能:

  • 添加了一个限制,防止修为等级过低的用户进入裂隙。
Original summary in English

Summary by Sourcery

New Features:

  • Added a restriction that prevents users from entering rifts if their cultivation rank is too low.

Copy link

sourcery-ai bot commented Jan 13, 2025

审阅者指南 by Sourcery

此拉取请求添加了一个领域级别限制,以防止在领域结算期间 temp_dict 为空。它检查用户的等级是否足够进入领域,如果不够则发送消息。

领域入口验证流程序列图

sequenceDiagram
    actor User
    participant Bot
    participant RiftSystem

User->>Bot: 请求进入领域
Bot->>RiftSystem: 检查用户等级
alt 等级过低
    RiftSystem-->>Bot: 等级不足
    Bot-->>User: 发送警告消息
else 等级足够
    RiftSystem-->>Bot: 等级正常
    RiftSystem->>RiftSystem: 添加用户到领域
    RiftSystem->>RiftSystem: 减少计数
    Bot-->>User: 允许进入
end
Loading

领域入口条件状态图

stateDiagram-v2
    [*] --> CheckLevel
    CheckLevel --> LevelTooLow: 用户等级 < 要求
    CheckLevel --> AllowEntry: 用户等级 >= 要求
    LevelTooLow --> [*]: 发送警告
    AllowEntry --> AddToRealm: 添加用户ID
    AddToRealm --> DecreaseCount: 减少领域计数
    DecreaseCount --> [*]
Loading

文件级别变更

变更 详情 文件
在进入领域前添加等级限制检查。
  • 添加比较用户等级与领域所需等级的检查。
  • 如果用户等级过低,发送消息告知限制。
  • 如果用户等级不足,阻止其进入领域。
  • 添加图像消息处理(如已配置)。
nonebot_plugin_xiuxian_2/xiuxian/xiuxian_rift/__init__.py

提示和命令

与 Sourcery 交互

  • 触发新审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复评论要求 Sourcery 创建问题。
  • 生成拉取请求标题: 在拉取请求标题中的任何位置写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中的任何位置写 @sourcery-ai summary 以随时生成 PR 摘要。您还可以使用此命令指定摘要插入位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审阅功能,如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request adds a realm level restriction to prevent temp_dict from being empty during realm settlement. It checks if the user's level is high enough to enter the realm and sends a message if they are not.

Sequence diagram for realm entry validation flow

sequenceDiagram
    actor User
    participant Bot
    participant RiftSystem

User->>Bot: Request to enter realm
Bot->>RiftSystem: Check user level
alt Level too low
    RiftSystem-->>Bot: Level insufficient
    Bot-->>User: Send warning message
else Level sufficient
    RiftSystem-->>Bot: Level OK
    RiftSystem->>RiftSystem: Add user to realm
    RiftSystem->>RiftSystem: Decrease count
    Bot-->>User: Allow entry
end
Loading

State diagram for realm entry conditions

stateDiagram-v2
    [*] --> CheckLevel
    CheckLevel --> LevelTooLow: User level < required
    CheckLevel --> AllowEntry: User level >= required
    LevelTooLow --> [*]: Send warning
    AllowEntry --> AddToRealm: Add user_id
    AddToRealm --> DecreaseCount: Decrease realm count
    DecreaseCount --> [*]
Loading

File-Level Changes

Change Details Files
Added a level restriction check before entering a realm.
  • Added a check to compare the user's level with the realm's required level.
  • If the user's level is too low, a message is sent informing them of the restriction.
  • The user is prevented from entering the realm if their level is insufficient.
  • Added handling for image-based messages if configured.
nonebot_plugin_xiuxian_2/xiuxian/xiuxian_rift/__init__.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PackageInstaller - 我已经审查了你的更改,看起来非常棒!

以下是我在审查期间查看的内容
  • 🟢 一般性问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目是免费的 - 如果你喜欢我们的评论,请考虑分享 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用这些反馈来改进你的评论。
Original comment in English

Hey @PackageInstaller - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@PackageInstaller PackageInstaller merged commit e82c6e1 into master Jan 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant