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

项目逻辑总览 #1

Open
kj415j45 opened this issue Feb 21, 2024 · 4 comments
Open

项目逻辑总览 #1

kj415j45 opened this issue Feb 21, 2024 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@kj415j45
Copy link
Contributor

kj415j45 commented Feb 21, 2024

前期准备

  • 配置 GitHub App
    • 配置 Webhooks
  • 配置 兔小巢 Webhook
  • 兔小巢 Private Key

数据流

由于兔小巢 API 接口并未公开提供添加评论的功能,因此本项目的数据流动主要为 兔小巢 -> GitHub。

参考资料

@kj415j45 kj415j45 self-assigned this Feb 21, 2024
@kj415j45
Copy link
Contributor Author

kj415j45 commented Feb 21, 2024

兔小巢有新帖子时

  1. 用户在兔小巢发布新帖子,触发 post.created 事件
  2. 调用 GitHub 接口创建议题到默认仓库

@kj415j45
Copy link
Contributor Author

kj415j45 commented Feb 21, 2024

兔小巢有新帖子回复时

  1. 用户在兔小巢发布帖子回复,触发 reply.created 事件
flowchart TD
  新回复 -- 来自管理员 --> 管理员相关处理
  新回复 -- 来自用户 --> 一般处理
  管理员相关处理 -- 以兔子洞命令为前缀 (!rabbit) --> 命令处理 --> 结束
  管理员相关处理 -- 一般评论 --> 一般处理
  一般处理 --> 根据关联添加comment --> 结束
Loading

@kj415j45
Copy link
Contributor Author

kj415j45 commented Feb 21, 2024

兔小巢帖子/回复有更新时

  1. 对应 post.updatedreply.updated 事件。
  2. 通过 GitHub API 搜索原帖。
  3. 在关联 issue 内查找当前更新评论,以新内容直接覆盖。

@kj415j45
Copy link
Contributor Author

kj415j45 commented Feb 21, 2024

在 GitHub 创建议题时的模板

原始链接:${txc_url}

【${user.nickname}】(${user.id})

${comment}

${...images}

---

<details><summary>此部分为自动生成,请勿编辑</summary>
<RH>
${rabbit_hole_reserved_data_section}
</RH>
</details> 

添加议题回复的模板

回复ID:${reply.id}
回复对象:${reply.parent_id}

【${user.nickname}】(${user.id})

${comment}

${...images}

---

<details><summary>此部分为自动生成,请勿编辑</summary>
<RH>
${rabbit_hole_reserved_data_section}
</RH>
</details> 

其中,分割线之后的 <detail> <RH> 区段为保留区域,用于内部检索。

Edit 1. 删除头像

@kj415j45 kj415j45 added the documentation Improvements or additions to documentation label Feb 23, 2024
@kj415j45 kj415j45 pinned this issue Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant