接入 GitHub (GitHub)
koishi-plugin-github 封装了一系列 GitHub 相关的功能。比如监听 GitHub Webhooksopen in new window,将收到的事件进行处理后发送到特定频道中。你还可以直接回复某条推送,通过快捷指令来实现进一步的功能,例如查看链接、进行评论、合并 PR 等等。
 功能展示
 收取 Github Webhooks
下面是一个 push 的例子,并使用 link 快捷指令来查看 diff。

Koishi
[GitHub] Shigma pushed to koishijs/koishi:develop
[d7ff34] chore: adjust
[3ae7e7] fix(core): create major context at demand
A
Alice
[GitHub] Shigma pushed to koishijs/koishi:develop
[d7ff34] chore: adjust
[3ae7e7] fix(core): create major context at demand
.link

Koishi
https://github.com/koishijs/koishi/compare/976c6e8f09a4...3ae7e7044d06
下面是一个 issue 的例子,并通过回复的方式来实现在 GitHub 中的回复。

Koishi
[GitHub] simon300000 opened an issue koishijs/koishi#19
Title: Wie kann man um das Koishi zu installieren?
Ich verstecke Englisch und Chinesisch nicht! Gab es Personen, die mir helfen kann?
A
Alice
[GitHub] simon300000 opened an issue koishijs/koishi#19
Title: Wie kann man um das Koishi zu installieren?
Ich verstecke Englisch und Chinesisch nicht! Gab es Personen, die mir helfen kann?
Mich würde auch interessieren, was ist „CoolQ“?

Koishi
[GitHub] simon300000 commented on issue koishijs/koishi#19
Mich würde auch interessieren, was ist „CoolQ“?
 基本用法
 创建你的 OAuth App
- 访问你个人的 Settings → Developer Settings → OAuth Apps 页面,点击右上角的「New OAuth App」。
 

- 上面的两个随便填就可以,下面的 Callback URL 填写你机器人收取验证的地址(通常是你机器人的域名加上 
/github/authorize)。配置完毕后点击「Register Application」就可以使用了。 

 填写插件的配置项
module.exports = {
  plugins: {
    github: {
      appId: 'your-github-app-id',
      appSecret: 'your-github-app-secret',
    },
  },
}
 指令:github
 指令:github.repos
 指令:github.authorize
 支持的事件
- commit_comment 
 - create
 - delete
 - fork
 - issues 
 - issue_comment 
 - milestone 
 - pull_request 
- opened
 - closed
 - reopened
 - ready_for_review
 - converted_to_draft
 - review_requested
 
 - pull_request_review 
 - pull_request_review_comment 
 - push
 - star 
 
 配置项
 path
GitHub 服务的路径。
 appId
 appSecret
 redirect
 messagePrefix
- 类型: 
string - 默认值: 
'[GitHub] ' 
显示在每条消息前的文本。
 promptTimeout
 replyTimeout
 requestTimeout
 events