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

新增send_poke #662

Merged
merged 3 commits into from
Dec 27, 2024
Merged

新增send_poke #662

merged 3 commits into from
Dec 27, 2024

Conversation

Shua-github
Copy link
Contributor

@Shua-github Shua-github commented Dec 27, 2024

传入group_id字段按group_poke发送 ,否则按friend_poke发送

Summary by Sourcery

新功能:

  • 添加了 send_poke 操作以向用户发送戳。如果提供了 group_id,戳将作为群戳发送。否则,它将作为好友戳发送。
Original summary in English

Summary by Sourcery

New Features:

  • Added send_poke action to send a poke to a user. If group_id is provided, the poke will be sent as a group poke. Otherwise, it will be sent as a friend poke.

Copy link

sourcery-ai bot commented Dec 27, 2024

审核者指南 by Sourcery

此拉取请求实现了一个新的动作 send_poke 用于发送戳信息。它使用 group_id 字段来确定是发送群戳还是好友戳。

send_poke 动作流程的时序图

sequenceDiagram
    participant Client
    participant SendPoke
    participant PacketOperationContext

    Client->>SendPoke: send_poke(user_id, [group_id])
    SendPoke->>PacketOperationContext: SendPoke(uin, groupUin?)
    alt 提供了 group_id
        PacketOperationContext->>PacketOperationContext: GroupPoke(uin, groupUin)
    else 未提供 group_id
        PacketOperationContext->>PacketOperationContext: FriendPoke(uin)
    end
Loading

文件级更改

更改 详情 文件
PacketOperationContext 添加了 SendPoke 方法。
  • 添加了一个新方法 SendPoke,它接受 uin 和一个可选的 groupUin 参数。
  • 该方法根据 groupUin 的存在调用 GroupPokeFriendPoke
src/core/packet/context/operationContext.ts
添加了 send_poke 动作。
  • createActionMap 中注册了 SendPoke 动作处理程序。
  • SendPoke 添加到 ActionName 枚举中。
  • 创建了一个新的 SendPoke 类来实现动作逻辑。
  • SendPoke 动作接受一个可选的 group_id 和一个必需的 user_id
  • 该动作调用 PacketOperationContext 中的 SendPoke 方法。
src/onebot/action/index.ts
src/onebot/action/router.ts
src/onebot/action/packet/SendPoke.ts
导入必要的模块并定义类型。
  • 导入了 ActionNameGetPacketStatusDependsStaticType
  • 为负载定义了 SchemaData typebox 架构。
  • 基于架构定义了 Payload 类型。
src/onebot/action/packet/SendPoke.ts

提示和命令

与 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 implements a new action send_poke to send poke messages. It uses the group_id field to determine whether to send a group poke or a friend poke.

Sequence diagram for send_poke action flow

sequenceDiagram
    participant Client
    participant SendPoke
    participant PacketOperationContext

    Client->>SendPoke: send_poke(user_id, [group_id])
    SendPoke->>PacketOperationContext: SendPoke(uin, groupUin?)
    alt group_id is provided
        PacketOperationContext->>PacketOperationContext: GroupPoke(uin, groupUin)
    else group_id is not provided
        PacketOperationContext->>PacketOperationContext: FriendPoke(uin)
    end
Loading

File-Level Changes

Change Details Files
Added SendPoke method to PacketOperationContext.
  • Added a new method SendPoke that takes uin and an optional groupUin parameter.
  • The method calls either GroupPoke or FriendPoke based on the presence of groupUin.
src/core/packet/context/operationContext.ts
Added send_poke action.
  • Registered the SendPoke action handler in createActionMap.
  • Added SendPoke to the ActionName enum.
  • Created a new SendPoke class that implements the action logic.
  • The SendPoke action takes an optional group_id and a required user_id.
  • The action calls the SendPoke method in PacketOperationContext.
src/onebot/action/index.ts
src/onebot/action/router.ts
src/onebot/action/packet/SendPoke.ts
Import necessary modules and define types.
  • Imported ActionName, GetPacketStatusDepends, Static, and Type.
  • Defined the SchemaData typebox schema for the payload.
  • Defined the Payload type based on the schema.
src/onebot/action/packet/SendPoke.ts

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.

@Shua-github - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • 请使用英语作为PR标题和描述,以确保与国际社区更好的合作。
这是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

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

Hey @Shua-github - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please use English for PR titles and descriptions to ensure better collaboration with the international community.
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.

@MliKiowa MliKiowa merged commit d78409f into NapNeko:main Dec 27, 2024
4 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.

2 participants