koishi-plugin-aakook 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -24
- package/LICENSE +21 -21
- package/README.md +217 -198
- package/lib/card.d.ts +3 -0
- package/lib/card.js +28 -0
- package/lib/commands.js +3 -1
- package/lib/config.d.ts +2 -0
- package/lib/config.js +3 -0
- package/lib/guard.d.ts +1 -0
- package/lib/guard.js +20 -0
- package/lib/index.js +4 -4
- package/lib/kook.d.ts +1 -0
- package/lib/kook.js +4 -0
- package/lib/link.d.ts +12 -1
- package/lib/link.js +56 -12
- package/lib/types.d.ts +4 -0
- package/package.json +62 -62
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
# 更新记录
|
|
2
|
-
|
|
3
|
-
## 0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
1
|
+
# 更新记录
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- 绑定卡片:运维发 `kookaa.card`,机器人在「验证」频道发一张带按钮的卡片(「获取验证码」「查看我的状态」「去 AA 绑定 QQ」),发完请手动置顶。成员点按钮就能在私聊里收到验证码或状态,和发文字命令走同一套限流、私聊失败改用只给本人看的临时消息的流程。
|
|
6
|
+
- 新配置项 `cardTemplate`:卡片正文(KMarkdown,可用 `{bindUrl}`)。`bindUrl` 为空时卡片不放「去 AA 绑定 QQ」按钮。
|
|
7
|
+
- 文字命令「绑定」「解绑」「状态」不变;`mode` 为 `off` 时按钮和文字命令表现一致,`kookaa.card` 在 `off` 下也能用。
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
首个版本。
|
|
12
|
+
|
|
13
|
+
- 关联:KOOK「绑定」拿验证码,用 QQ 在群里或私聊发码;换绑需在私聊确认;「解绑」「状态」命令。
|
|
14
|
+
- 判定与同步:按 AA 的判定给 / 收「成员」和各身份组、同步昵称;调 AA 一律按群批量,带每分钟限频。
|
|
15
|
+
- 倒计时:新人和失效的人 48 小时倒计时,提醒、最后提醒、到期移出;顺延规则保证提醒后至少留 `remindBeforeHours` 小时。
|
|
16
|
+
- 熔断:移出和首次收回「成员」共用计数,冷静期满自动放行;AA 无法判断的人太多时整轮不写。
|
|
17
|
+
- 运行:启动后巡检、每 6 小时巡检、每 60 秒拉取 AA 事件、每 10 分钟检查到期;离开和回来按规则处理。
|
|
18
|
+
- 运维:运维报告和报警(带恢复通知)、管理命令 `kookaa.status` / `patrol` / `check` / `unlink` / `pause` / `resume` / `kicknow`。
|
|
19
|
+
- 四种模式:`off`、`report`、`sync`、`enforce`,默认 `report`。
|
|
20
|
+
|
|
21
|
+
审查后的修复(同属 0.1.0,尚未发布):
|
|
22
|
+
|
|
23
|
+
- 熔断:冷静期内只有完整巡检能判「已恢复」,其他批次原样保留 hold;冷静期满只有覆盖被拦人群的批次才放行。放行的人踢 / 收用单独审计(`kick-released` / `revoke-member-released`),不进熔断窗口;踢人和收回「成员」的放行标记分开(`releasedKick` / `releasedRevoke`)。
|
|
24
|
+
- 最后提醒:只有发在倒计时开始、切到 enforce、恢复、回来之后的才算数;同一次倒计时只顺延一次,发不出去时不再每 10 分钟顺延,也不会被踢,报告里说一次。
|
|
25
|
+
- 误踢:关联在锁内重读,判定期间变了的人这一轮不处理;踢人前再读一次关联。
|
|
26
|
+
- 换绑:提示确认时验证码作废,待确认存库,只有发码的 QQ 私聊确认有效。
|
|
27
|
+
- 写失败记录:只记 KOOK 明确拒绝的,24 小时过期;grant / revoke 互相清记录;5xx、网络、超时、掉线、429 用完不记;掉线立即中止这一轮。
|
|
28
|
+
- 暂停 / 重载立即停止写操作,每 10 人保存一次已处理的记录。
|
|
29
|
+
- 适配器字段:服务器主按 ID 判断,机器人按 `extra.author.bot` 识别,`guild-deleted` 按 `extra.body.guild_id` 和事件类型判断;`getUserView` 对非成员的返回待实测。
|
|
30
|
+
- 报告:非巡检路径只推新的写入失败;「AA 无法判断」一人一原因一天一次;`kookaa.check` 在群里 QQ 打码;`kookaa.kicknow` 的说法改为「不再顺延,按 kickPerHour 立即开始移出」。
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 yilifaer
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 yilifaer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,198 +1,217 @@
|
|
|
1
|
-
# koishi-plugin-aakook
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/koishi-plugin-aakook)
|
|
4
|
-
|
|
5
|
-
配合 AllianceAuth 插件 [aa-qqbot](https://github.com/yilifaer/aa-qqbot-plugin),给 **KOOK 服务器**把门的 Koishi 插件。
|
|
6
|
-
|
|
7
|
-
## 做什么
|
|
8
|
-
|
|
9
|
-
AA 只认识 QQ,所以插件先把 KOOK 账号和 QQ 关联起来,再拿这个 QQ 去问 AA:
|
|
10
|
-
|
|
11
|
-
1. 用户在 KOOK 里发「绑定」,机器人私聊给他一个验证码。
|
|
12
|
-
2. 用户用**自己的 QQ**,在机器人所在的 QQ 群里(或私聊 QQ 机器人)单独发出这个验证码。QQ 号取自 QQ 的消息事件,不取自用户输入。
|
|
13
|
-
3. 插件按 AA 的判定:
|
|
14
|
-
- 合格就给「成员」身份组,以及对应的身份组(每个 AA 身份组小群对应 KOOK 里一个同名身份组);
|
|
15
|
-
- 不合格就收回身份组;
|
|
16
|
-
- 合格时可以把服务器昵称改成 AA 规定的名片。
|
|
17
|
-
4. 新人进服 48 小时内没拿到「成员」、或已有身份的人变得不合格 48 小时后还没恢复,到期移出服务器(`enforce` 模式)。
|
|
18
|
-
|
|
19
|
-
插件只用 aa-qqbot 现有的 `groups`、`check`、`events` 三个接口,**不需要更新 AA 端**,也不在 AA 里登记任何新群。它和 [koishi-plugin-aaqqbot](https://github.com/yilifaer/Koishi-AAqqbot-plugin)(QQ 群把门)并排运行、互不依赖。
|
|
20
|
-
|
|
21
|
-
频道可见性由你在 KOOK 里设置,插件不管:没有「成员」身份组的人只能看到「验证」频道。
|
|
22
|
-
|
|
23
|
-
## 安装
|
|
24
|
-
|
|
25
|
-
在 Koishi 控制台的插件市场搜索 `aakook` 安装,或:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm i koishi-plugin-aakook
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
需要:
|
|
32
|
-
|
|
33
|
-
- Koishi 4.18 及以上,`database` 和 `http` 服务;
|
|
34
|
-
- KOOK 适配器(`@koishijs/plugin-adapter-kook`,WebSocket 连接);
|
|
35
|
-
- QQ 适配器(onebot),只用来收验证码;
|
|
36
|
-
- 一把 AA 的接口密钥(`QQBOT_API_KEYS`)。可以和 aaqqbot 共用,但两边共用每分钟 120 次的额度;本插件默认每分钟最多调 30 次(`aaPerMinute`)。
|
|
37
|
-
|
|
38
|
-
## 所有者在 KOOK 后台要做的事
|
|
39
|
-
|
|
40
|
-
1. 在 [KOOK 开发者平台](https://developer.kookapp.cn/app/index) 新建机器人,连接方式选 **WebSocket**,复制 Token,填进 Koishi 的 KOOK 适配器(`protocol: ws`)。
|
|
41
|
-
2. 把机器人邀请进服务器,给它一个身份组,权限至少:**管理角色**、**修改他人昵称**、**踢出用户**、查看频道、发送消息。
|
|
42
|
-
3. 在服务器「角色」列表里,把**机器人的身份组拖到最上面**,至少高于「成员」和所有要管理的身份组。
|
|
43
|
-
4. 建好「成员」身份组,以及每个 AA 身份组小群对应的身份组,把 ID 填进配置。
|
|
44
|
-
5. 频道权限:`@全体成员` 只能看见「验证」频道;其他频道只对「成员」可见;`reportTo` 如果是 KOOK 频道,只对运维可见。
|
|
45
|
-
6. 在 KOOK 里打开「开发者模式」才能复制 ID(用户设置 → 高级设置)。
|
|
46
|
-
7. 上线顺序见下文「上线顺序」。
|
|
47
|
-
8. Koishi 命令前缀(`prefix`)不是空的话,用户发命令要带前缀。上线前用 `help` 确认「绑定」「解绑」「状态」没有和别的插件重名。
|
|
48
|
-
9. 「已知限制」里列出的几项要在测试服务器上实测,把结果记下来。
|
|
49
|
-
|
|
50
|
-
## 配置
|
|
51
|
-
|
|
52
|
-
模式默认是 `report`,只报告「将会做什么」,不改 KOOK 里的任何东西。
|
|
53
|
-
|
|
54
|
-
### 连接 AA
|
|
55
|
-
|
|
56
|
-
| 配置项 | 默认 | 打开后会发生什么 |
|
|
57
|
-
|---|---|---|
|
|
58
|
-
| `aaBaseUrl` | 必填 | AA 的网址。装在子路径下时连子路径一起写。正式环境必须用 https |
|
|
59
|
-
| `keyId` / `secret` | 必填 | AA 的 `local.py` 里 `QQBOT_API_KEYS` 的键和值 |
|
|
60
|
-
| `timeoutSeconds` | 30 | 每次请求 AA 最多等多少秒 |
|
|
61
|
-
| `aaPerMinute` | 30 | 本插件每分钟最多调 AA 几次,超出的排队等待,日志记一行 |
|
|
62
|
-
| `bindUrl` | 空 | AA 上绑定 QQ 的页面地址,写进提醒文案 |
|
|
63
|
-
|
|
64
|
-
### KOOK 服务器
|
|
65
|
-
|
|
66
|
-
| 配置项 | 默认 | 打开后会发生什么 |
|
|
67
|
-
|---|---|---|
|
|
68
|
-
| `kookBotId` | 空 | 机器人自己的 KOOK 用户 ID |
|
|
69
|
-
| `guildId` | 空 | 要管理的服务器 ID。只管这一个;换成别的服务器时,旧服务器的成员记录和倒计时不会带过去,关联保留 |
|
|
70
|
-
| `memberRoleId` | 空 | 「成员」身份组 ID |
|
|
71
|
-
| `memberAaGroup` | 空 | 「成员」对应的 AA 群号,必须是 AA 里已启用的**固定群**(`fixed`) |
|
|
72
|
-
| `roleMap` | 空 | 表格:KOOK 身份组 ID ↔ AA 身份组小群群号(必须是已启用的 `role` 群)。AA 判定合格就给,明确不合格就收,其他情况不动 |
|
|
73
|
-
| `verifyChannelId` | 空 | 「验证」频道。私聊不通的人在这里被合并 @ 提醒(每条最多 20 人) |
|
|
74
|
-
| `whitelist` | 空 | KOOK 用户 ID:永不踢、永不提醒,身份组照常按 AA 给 |
|
|
75
|
-
| `nicknameSync` | 开 | 合格的人的服务器昵称改成 AA 名片。KOOK 明确拒绝的(例如服务器主)只记一次,24 小时内不重试 |
|
|
76
|
-
| `keepUnlinkedRoles` | 开 | 从没关联过的人,在倒计时期间保留现有身份组。第一次上线时用,否则全服会立刻看不到频道 |
|
|
77
|
-
|
|
78
|
-
### QQ(只用来收验证码)
|
|
79
|
-
|
|
80
|
-
| 配置项 | 默认 | 打开后会发生什么 |
|
|
81
|
-
|---|---|---|
|
|
82
|
-
| `qqBotId` | 空 | QQ 机器人的 QQ 号。只监听这个机器人收到的消息 |
|
|
83
|
-
| `qqAcceptGroups` | 空 | 在哪些 QQ 群接受验证码;空 = 机器人所在的所有群。私聊一律接受 |
|
|
84
|
-
| `qqIgnoreUsers` | 空 | 这些 QQ 发的验证码一律不认(例如群里别的机器人) |
|
|
85
|
-
|
|
86
|
-
不是验证码格式的 QQ 消息一律不理:不拦截、不回复,不影响 aaqqbot 和别的插件。
|
|
87
|
-
|
|
88
|
-
### 模式与时间
|
|
89
|
-
|
|
90
|
-
| 配置项 | 默认 | 说明 |
|
|
91
|
-
|---|---|---|
|
|
92
|
-
| `mode` | `report` | `off` 什么都不做;`report` 只报告;`sync` 给 / 收身份组、改昵称、发提醒,不踢人;`enforce` 以上全部,并移出到期的人 |
|
|
93
|
-
| `graceHours` | 48 | 倒计时长度 |
|
|
94
|
-
| `remindBeforeHours` | 12 | 到期前多久发最后提醒 |
|
|
95
|
-
| `codeMinutes` | 10 | 验证码有效期 |
|
|
96
|
-
| `patrolIntervalHours` | 6 | 巡检间隔 |
|
|
97
|
-
| `eventPollSeconds` | 60 | 向 AA 拉取变化(解绑、退组等)的间隔 |
|
|
98
|
-
|
|
99
|
-
倒计时规则:
|
|
100
|
-
|
|
101
|
-
- 只有 `sync` 和 `enforce` 才写倒计时。第一次进入 `sync` / `enforce` 的那一刻记为起点,所有人从那一刻起算(新人从进服时间和起点中较晚的算)。
|
|
102
|
-
- 已关联的人变得不合格、或解绑:马上收回身份组,从现在起算 48 小时。
|
|
103
|
-
- 踢人需要同时满足:已到期;这次倒计时里发过最后提醒且已过 1 小时;这一刻重新问 AA 仍是不合格或没有关联;踢前确认他仍在服务器、不是服务器主、没有管理员权限、不在白名单、不是机器人;没触发熔断。
|
|
104
|
-
- 任何时候要发最后提醒而剩余时间不足 `remindBeforeHours`(包括已过期),先把期限顺延到「现在 + `remindBeforeHours`」。所以切到 `enforce`、恢复暂停、停机重启之后,没有人会在提醒后一小时内被踢。
|
|
105
|
-
- 「最后提醒」只有发在这次倒计时开始之后、并且发在最近一次「切到 `enforce`」「恢复(暂停 / 配置错误 / 模式 off 之后)」之后才算数;离开又回来的人,回来这一轮也要重新补一次。所以在 `sync` 里发过提醒的人切到 `enforce` 后,先收到新的「还剩 12 小时」,12 小时内不会被踢。
|
|
106
|
-
- 同一次倒计时最多顺延一次(切换 / 恢复之后可以再顺延一次)。最后提醒发不出去(私聊和验证频道都失败)时不会反复顺延,也不会被踢,报告里说一次「X 的最后提醒发不出去」,请联系他本人。
|
|
107
|
-
- 离开服务器再回来,倒计时不重置;被机器人踢出的人回来才按新人重新算。
|
|
108
|
-
|
|
109
|
-
### 熔断
|
|
110
|
-
|
|
111
|
-
| 配置项 | 默认 | 说明 |
|
|
112
|
-
|---|---|---|
|
|
113
|
-
| `breakerCount` | 5 | 阈值人数 |
|
|
114
|
-
| `breakerPercent` | 10 | 阈值比例(占服务器人数的百分比),和人数取较小者,至少为 1 |
|
|
115
|
-
| `breakerCooldownHours` | 6 | 冷静期,也是统计的时间窗口 |
|
|
116
|
-
| `kickPerHour` | 10 | 每小时最多踢几个,多的留到下一小时 |
|
|
117
|
-
|
|
118
|
-
踢人和「首次收回成员」共用一个计数。窗口内累计超过阈值,这一次一个都不做,报警并冷静。冷静期内只有「完整的巡检」才能判断情况是否已恢复;其他批次(进服、关联、AA 事件、10 分钟检查)里没有被拦的人,熔断状态原样保留。冷静期满后,只有完整巡检、或名单里包含全部被拦的人的那一批,才会放行同一批人;放行的人只受 `kickPerHour` 限制,不再顺延,也不计入熔断窗口(审计记 `kick-released` / `revoke-member-released`,`kickPerHour` 照样把它们算进去);变化很大则重新冷静。踢人的放行和收回「成员」的放行各管各的。AA 无法判断的人太多(超过阈值)时,这一轮整轮不写,只报告。
|
|
119
|
-
|
|
120
|
-
### 运维
|
|
121
|
-
|
|
122
|
-
| 配置项 | 默认 | 说明 |
|
|
123
|
-
|---|---|---|
|
|
124
|
-
| `reportTo` | 空 | 运维报告发到哪里:`onebot:<QQ 群号>` 或 `kook:<频道 ID>`;空 = 只写日志 |
|
|
125
|
-
| `operators` | 空 | 能用管理命令的人,写成 `平台:用户ID`,如 `onebot:10001`、`kook:1000000001` |
|
|
126
|
-
|
|
127
|
-
### 文案
|
|
128
|
-
|
|
129
|
-
`remindNewTemplate`、`remindDeniedTemplate`、`remindLastTemplate`、`codeTemplate` 都能在控制台改,可用的 `{占位符}` 见各自的说明。时间一律按北京时间显示。
|
|
130
|
-
|
|
131
|
-
## 命令
|
|
132
|
-
|
|
133
|
-
### 用户命令(KOOK)
|
|
134
|
-
|
|
135
|
-
只在配置的服务器里、或私聊机器人时有效。
|
|
136
|
-
|
|
137
|
-
| 命令 | 作用 |
|
|
138
|
-
|---|---|
|
|
139
|
-
| `绑定` | 私聊发验证码,`codeMinutes` 分钟内有效。同一人再发会作废旧码;10 分钟内最多拿 5 次。私聊失败时在频道里用只有本人看得见的临时消息发,验证码绝不出现在普通频道消息里 |
|
|
140
|
-
| `解绑` | 删除自己的关联,按「失去关联」处理 |
|
|
141
|
-
| `状态` | 私聊回复:关联的 QQ(打码)、成员判定、各身份组、倒计时到期时间。10 分钟内用缓存,每分钟最多 1 次 |
|
|
142
|
-
|
|
143
|
-
QQ 侧:整条消息只有验证码(`KOOK-XXXXXX`,不分大小写)才会被接受,一个 QQ 10 分钟内最多试 10 次。这个 QQ 已关联了别的 KOOK 账号时不会直接替换,机器人会让他在 10 分钟内**私聊** QQ 机器人发「确认 KOOK-XXXXXX」,确认后旧账号按「失去关联」处理并收到私聊通知,同时写审计、发运维报告。发出确认提示的同时这个验证码就作废了,待确认记录存在数据库里(重载后仍有效),只有发码的那个 QQ 私聊发「确认 …」才有效,别人抄去也没用。
|
|
144
|
-
|
|
145
|
-
###
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
##
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
1
|
+
# koishi-plugin-aakook
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/koishi-plugin-aakook)
|
|
4
|
+
|
|
5
|
+
配合 AllianceAuth 插件 [aa-qqbot](https://github.com/yilifaer/aa-qqbot-plugin),给 **KOOK 服务器**把门的 Koishi 插件。
|
|
6
|
+
|
|
7
|
+
## 做什么
|
|
8
|
+
|
|
9
|
+
AA 只认识 QQ,所以插件先把 KOOK 账号和 QQ 关联起来,再拿这个 QQ 去问 AA:
|
|
10
|
+
|
|
11
|
+
1. 用户在 KOOK 里发「绑定」,机器人私聊给他一个验证码。
|
|
12
|
+
2. 用户用**自己的 QQ**,在机器人所在的 QQ 群里(或私聊 QQ 机器人)单独发出这个验证码。QQ 号取自 QQ 的消息事件,不取自用户输入。
|
|
13
|
+
3. 插件按 AA 的判定:
|
|
14
|
+
- 合格就给「成员」身份组,以及对应的身份组(每个 AA 身份组小群对应 KOOK 里一个同名身份组);
|
|
15
|
+
- 不合格就收回身份组;
|
|
16
|
+
- 合格时可以把服务器昵称改成 AA 规定的名片。
|
|
17
|
+
4. 新人进服 48 小时内没拿到「成员」、或已有身份的人变得不合格 48 小时后还没恢复,到期移出服务器(`enforce` 模式)。
|
|
18
|
+
|
|
19
|
+
插件只用 aa-qqbot 现有的 `groups`、`check`、`events` 三个接口,**不需要更新 AA 端**,也不在 AA 里登记任何新群。它和 [koishi-plugin-aaqqbot](https://github.com/yilifaer/Koishi-AAqqbot-plugin)(QQ 群把门)并排运行、互不依赖。
|
|
20
|
+
|
|
21
|
+
频道可见性由你在 KOOK 里设置,插件不管:没有「成员」身份组的人只能看到「验证」频道。
|
|
22
|
+
|
|
23
|
+
## 安装
|
|
24
|
+
|
|
25
|
+
在 Koishi 控制台的插件市场搜索 `aakook` 安装,或:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm i koishi-plugin-aakook
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
需要:
|
|
32
|
+
|
|
33
|
+
- Koishi 4.18 及以上,`database` 和 `http` 服务;
|
|
34
|
+
- KOOK 适配器(`@koishijs/plugin-adapter-kook`,WebSocket 连接);
|
|
35
|
+
- QQ 适配器(onebot),只用来收验证码;
|
|
36
|
+
- 一把 AA 的接口密钥(`QQBOT_API_KEYS`)。可以和 aaqqbot 共用,但两边共用每分钟 120 次的额度;本插件默认每分钟最多调 30 次(`aaPerMinute`)。
|
|
37
|
+
|
|
38
|
+
## 所有者在 KOOK 后台要做的事
|
|
39
|
+
|
|
40
|
+
1. 在 [KOOK 开发者平台](https://developer.kookapp.cn/app/index) 新建机器人,连接方式选 **WebSocket**,复制 Token,填进 Koishi 的 KOOK 适配器(`protocol: ws`)。
|
|
41
|
+
2. 把机器人邀请进服务器,给它一个身份组,权限至少:**管理角色**、**修改他人昵称**、**踢出用户**、查看频道、发送消息。
|
|
42
|
+
3. 在服务器「角色」列表里,把**机器人的身份组拖到最上面**,至少高于「成员」和所有要管理的身份组。
|
|
43
|
+
4. 建好「成员」身份组,以及每个 AA 身份组小群对应的身份组,把 ID 填进配置。
|
|
44
|
+
5. 频道权限:`@全体成员` 只能看见「验证」频道;其他频道只对「成员」可见;`reportTo` 如果是 KOOK 频道,只对运维可见。
|
|
45
|
+
6. 在 KOOK 里打开「开发者模式」才能复制 ID(用户设置 → 高级设置)。
|
|
46
|
+
7. 上线顺序见下文「上线顺序」。
|
|
47
|
+
8. Koishi 命令前缀(`prefix`)不是空的话,用户发命令要带前缀。上线前用 `help` 确认「绑定」「解绑」「状态」没有和别的插件重名。
|
|
48
|
+
9. 「已知限制」里列出的几项要在测试服务器上实测,把结果记下来。
|
|
49
|
+
|
|
50
|
+
## 配置
|
|
51
|
+
|
|
52
|
+
模式默认是 `report`,只报告「将会做什么」,不改 KOOK 里的任何东西。
|
|
53
|
+
|
|
54
|
+
### 连接 AA
|
|
55
|
+
|
|
56
|
+
| 配置项 | 默认 | 打开后会发生什么 |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `aaBaseUrl` | 必填 | AA 的网址。装在子路径下时连子路径一起写。正式环境必须用 https |
|
|
59
|
+
| `keyId` / `secret` | 必填 | AA 的 `local.py` 里 `QQBOT_API_KEYS` 的键和值 |
|
|
60
|
+
| `timeoutSeconds` | 30 | 每次请求 AA 最多等多少秒 |
|
|
61
|
+
| `aaPerMinute` | 30 | 本插件每分钟最多调 AA 几次,超出的排队等待,日志记一行 |
|
|
62
|
+
| `bindUrl` | 空 | AA 上绑定 QQ 的页面地址,写进提醒文案 |
|
|
63
|
+
|
|
64
|
+
### KOOK 服务器
|
|
65
|
+
|
|
66
|
+
| 配置项 | 默认 | 打开后会发生什么 |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `kookBotId` | 空 | 机器人自己的 KOOK 用户 ID |
|
|
69
|
+
| `guildId` | 空 | 要管理的服务器 ID。只管这一个;换成别的服务器时,旧服务器的成员记录和倒计时不会带过去,关联保留 |
|
|
70
|
+
| `memberRoleId` | 空 | 「成员」身份组 ID |
|
|
71
|
+
| `memberAaGroup` | 空 | 「成员」对应的 AA 群号,必须是 AA 里已启用的**固定群**(`fixed`) |
|
|
72
|
+
| `roleMap` | 空 | 表格:KOOK 身份组 ID ↔ AA 身份组小群群号(必须是已启用的 `role` 群)。AA 判定合格就给,明确不合格就收,其他情况不动 |
|
|
73
|
+
| `verifyChannelId` | 空 | 「验证」频道。私聊不通的人在这里被合并 @ 提醒(每条最多 20 人) |
|
|
74
|
+
| `whitelist` | 空 | KOOK 用户 ID:永不踢、永不提醒,身份组照常按 AA 给 |
|
|
75
|
+
| `nicknameSync` | 开 | 合格的人的服务器昵称改成 AA 名片。KOOK 明确拒绝的(例如服务器主)只记一次,24 小时内不重试 |
|
|
76
|
+
| `keepUnlinkedRoles` | 开 | 从没关联过的人,在倒计时期间保留现有身份组。第一次上线时用,否则全服会立刻看不到频道 |
|
|
77
|
+
|
|
78
|
+
### QQ(只用来收验证码)
|
|
79
|
+
|
|
80
|
+
| 配置项 | 默认 | 打开后会发生什么 |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| `qqBotId` | 空 | QQ 机器人的 QQ 号。只监听这个机器人收到的消息 |
|
|
83
|
+
| `qqAcceptGroups` | 空 | 在哪些 QQ 群接受验证码;空 = 机器人所在的所有群。私聊一律接受 |
|
|
84
|
+
| `qqIgnoreUsers` | 空 | 这些 QQ 发的验证码一律不认(例如群里别的机器人) |
|
|
85
|
+
|
|
86
|
+
不是验证码格式的 QQ 消息一律不理:不拦截、不回复,不影响 aaqqbot 和别的插件。
|
|
87
|
+
|
|
88
|
+
### 模式与时间
|
|
89
|
+
|
|
90
|
+
| 配置项 | 默认 | 说明 |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `mode` | `report` | `off` 什么都不做;`report` 只报告;`sync` 给 / 收身份组、改昵称、发提醒,不踢人;`enforce` 以上全部,并移出到期的人 |
|
|
93
|
+
| `graceHours` | 48 | 倒计时长度 |
|
|
94
|
+
| `remindBeforeHours` | 12 | 到期前多久发最后提醒 |
|
|
95
|
+
| `codeMinutes` | 10 | 验证码有效期 |
|
|
96
|
+
| `patrolIntervalHours` | 6 | 巡检间隔 |
|
|
97
|
+
| `eventPollSeconds` | 60 | 向 AA 拉取变化(解绑、退组等)的间隔 |
|
|
98
|
+
|
|
99
|
+
倒计时规则:
|
|
100
|
+
|
|
101
|
+
- 只有 `sync` 和 `enforce` 才写倒计时。第一次进入 `sync` / `enforce` 的那一刻记为起点,所有人从那一刻起算(新人从进服时间和起点中较晚的算)。
|
|
102
|
+
- 已关联的人变得不合格、或解绑:马上收回身份组,从现在起算 48 小时。
|
|
103
|
+
- 踢人需要同时满足:已到期;这次倒计时里发过最后提醒且已过 1 小时;这一刻重新问 AA 仍是不合格或没有关联;踢前确认他仍在服务器、不是服务器主、没有管理员权限、不在白名单、不是机器人;没触发熔断。
|
|
104
|
+
- 任何时候要发最后提醒而剩余时间不足 `remindBeforeHours`(包括已过期),先把期限顺延到「现在 + `remindBeforeHours`」。所以切到 `enforce`、恢复暂停、停机重启之后,没有人会在提醒后一小时内被踢。
|
|
105
|
+
- 「最后提醒」只有发在这次倒计时开始之后、并且发在最近一次「切到 `enforce`」「恢复(暂停 / 配置错误 / 模式 off 之后)」之后才算数;离开又回来的人,回来这一轮也要重新补一次。所以在 `sync` 里发过提醒的人切到 `enforce` 后,先收到新的「还剩 12 小时」,12 小时内不会被踢。
|
|
106
|
+
- 同一次倒计时最多顺延一次(切换 / 恢复之后可以再顺延一次)。最后提醒发不出去(私聊和验证频道都失败)时不会反复顺延,也不会被踢,报告里说一次「X 的最后提醒发不出去」,请联系他本人。
|
|
107
|
+
- 离开服务器再回来,倒计时不重置;被机器人踢出的人回来才按新人重新算。
|
|
108
|
+
|
|
109
|
+
### 熔断
|
|
110
|
+
|
|
111
|
+
| 配置项 | 默认 | 说明 |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `breakerCount` | 5 | 阈值人数 |
|
|
114
|
+
| `breakerPercent` | 10 | 阈值比例(占服务器人数的百分比),和人数取较小者,至少为 1 |
|
|
115
|
+
| `breakerCooldownHours` | 6 | 冷静期,也是统计的时间窗口 |
|
|
116
|
+
| `kickPerHour` | 10 | 每小时最多踢几个,多的留到下一小时 |
|
|
117
|
+
|
|
118
|
+
踢人和「首次收回成员」共用一个计数。窗口内累计超过阈值,这一次一个都不做,报警并冷静。冷静期内只有「完整的巡检」才能判断情况是否已恢复;其他批次(进服、关联、AA 事件、10 分钟检查)里没有被拦的人,熔断状态原样保留。冷静期满后,只有完整巡检、或名单里包含全部被拦的人的那一批,才会放行同一批人;放行的人只受 `kickPerHour` 限制,不再顺延,也不计入熔断窗口(审计记 `kick-released` / `revoke-member-released`,`kickPerHour` 照样把它们算进去);变化很大则重新冷静。踢人的放行和收回「成员」的放行各管各的。AA 无法判断的人太多(超过阈值)时,这一轮整轮不写,只报告。
|
|
119
|
+
|
|
120
|
+
### 运维
|
|
121
|
+
|
|
122
|
+
| 配置项 | 默认 | 说明 |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `reportTo` | 空 | 运维报告发到哪里:`onebot:<QQ 群号>` 或 `kook:<频道 ID>`;空 = 只写日志 |
|
|
125
|
+
| `operators` | 空 | 能用管理命令的人,写成 `平台:用户ID`,如 `onebot:10001`、`kook:1000000001` |
|
|
126
|
+
|
|
127
|
+
### 文案
|
|
128
|
+
|
|
129
|
+
`remindNewTemplate`、`remindDeniedTemplate`、`remindLastTemplate`、`codeTemplate`、`cardTemplate` 都能在控制台改,可用的 `{占位符}` 见各自的说明。时间一律按北京时间显示。
|
|
130
|
+
|
|
131
|
+
## 命令
|
|
132
|
+
|
|
133
|
+
### 用户命令(KOOK)
|
|
134
|
+
|
|
135
|
+
只在配置的服务器里、或私聊机器人时有效。
|
|
136
|
+
|
|
137
|
+
| 命令 | 作用 |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `绑定` | 私聊发验证码,`codeMinutes` 分钟内有效。同一人再发会作废旧码;10 分钟内最多拿 5 次。私聊失败时在频道里用只有本人看得见的临时消息发,验证码绝不出现在普通频道消息里 |
|
|
140
|
+
| `解绑` | 删除自己的关联,按「失去关联」处理 |
|
|
141
|
+
| `状态` | 私聊回复:关联的 QQ(打码)、成员判定、各身份组、倒计时到期时间。10 分钟内用缓存,每分钟最多 1 次 |
|
|
142
|
+
|
|
143
|
+
QQ 侧:整条消息只有验证码(`KOOK-XXXXXX`,不分大小写)才会被接受,一个 QQ 10 分钟内最多试 10 次。这个 QQ 已关联了别的 KOOK 账号时不会直接替换,机器人会让他在 10 分钟内**私聊** QQ 机器人发「确认 KOOK-XXXXXX」,确认后旧账号按「失去关联」处理并收到私聊通知,同时写审计、发运维报告。发出确认提示的同时这个验证码就作废了,待确认记录存在数据库里(重载后仍有效),只有发码的那个 QQ 私聊发「确认 …」才有效,别人抄去也没用。
|
|
144
|
+
|
|
145
|
+
### 绑定卡片(按钮)
|
|
146
|
+
|
|
147
|
+
在「验证」频道固定一张带按钮的卡片,成员点按钮就能拿验证码,不用记命令。
|
|
148
|
+
|
|
149
|
+
1. 配好 `verifyChannelId`(「验证」频道 ID),确认机器人在这个频道有「发送消息」权限。
|
|
150
|
+
2. 运维发 `kookaa.card`,机器人在验证频道发出卡片,回复里带消息 ID。
|
|
151
|
+
3. 在 KOOK 里手动置顶这张卡片;旧卡片可以删掉。
|
|
152
|
+
|
|
153
|
+
卡片上的按钮:
|
|
154
|
+
|
|
155
|
+
| 按钮 | 作用 |
|
|
156
|
+
|---|---|
|
|
157
|
+
| 获取验证码 | 和发「绑定」完全一样:私聊发验证码,私聊失败用只有本人看得见的临时消息;限流和文字命令共用 |
|
|
158
|
+
| 查看我的状态 | 和发「状态」一样:结果私聊给本人,私聊失败用临时消息,不在频道里公开发 |
|
|
159
|
+
| 去 AA 绑定 QQ | 打开 `bindUrl`;`bindUrl` 为空时不放这个按钮 |
|
|
160
|
+
|
|
161
|
+
卡片正文是 `cardTemplate`(KMarkdown,原样使用,只替换 `{bindUrl}`),改完要再发一次 `kookaa.card` 才会出新卡片。只处理本服务器里、非机器人的点击;其他服务器、机器人的点击和不认识的按钮一律忽略。`mode` 是 `off` 时按钮和文字命令一样照常工作,`kookaa.card` 也能发(日志里会记一行)。
|
|
162
|
+
|
|
163
|
+
### 管理命令
|
|
164
|
+
|
|
165
|
+
只有 `operators` 里的人,在私聊或 `reportTo` 对应的频道里才有回应,其他人一律不回。参数必须带前缀 `kook:<ID>` 或 `qq:<号>`,不带前缀会提示写法。
|
|
166
|
+
|
|
167
|
+
| 命令 | 作用 |
|
|
168
|
+
|---|---|
|
|
169
|
+
| `kookaa.status` | 模式、暂停 / 冷静状态、配置核对(每个身份组 ✅ / ❌)、上次巡检、事件游标、本分钟 AA 调用数 |
|
|
170
|
+
| `kookaa.patrol` | 马上巡检。同时清空「失败记录」,让之前被 KOOK 拒绝的身份组 / 昵称操作再试一次 |
|
|
171
|
+
| `kookaa.check kook:<ID>` 或 `qq:<号>` | 实时问一次 AA,显示关联、各身份组判定、倒计时。只看不改。在私聊里显示完整 QQ;在 `reportTo` 群里 QQ 打码 |
|
|
172
|
+
| `kookaa.unlink kook:<ID>` 或 `qq:<号>` | 先回显「谁 ↔ QQ」,60 秒内再发一次同样的命令并加 `-y` 才执行,写审计 |
|
|
173
|
+
| `kookaa.pause` / `kookaa.resume` | 暂停:立即停止所有写操作,状态存库,重启后仍然暂停;恢复后马上巡检,过期的人先补最后提醒 |
|
|
174
|
+
| `kookaa.card` | 在 `verifyChannelId` 频道发绑定卡片(见上一节)。频道 ID 为空或 KOOK 不在线时说明原因,不发 |
|
|
175
|
+
| `kookaa.kicknow` | 放行熔断冷静期。被拦住的人标记为已放行:不再顺延,按 `kickPerHour` 立即开始移出(还没收到最后提醒的先补提醒,满 1 小时后才移出) |
|
|
176
|
+
|
|
177
|
+
### 运维报告
|
|
178
|
+
|
|
179
|
+
发到 `reportTo`,QQ 一律打码,同类合并,每小时最多 30 条。巡检汇总一条(人数、已关联、合格、给 / 收身份组、改昵称、倒计时中、本轮踢出,后面列出需要人处理的事)。报警单独一条,格式 `⚠️ 结论(关键数字)`,恢复时发 `✅ 已恢复(中断 N 分钟):对象`。报警包括:配置错误、AA 连续失败超过 1 小时、熔断、成员列表拿不全、机器人被移出服务器、有人换绑。
|
|
180
|
+
|
|
181
|
+
## 上线顺序
|
|
182
|
+
|
|
183
|
+
1. **测试服务器**:另开一个测试用 KOOK 服务器,AA 指向测试 AA,`reportTo` 指向运维群,`report` → `sync` → `enforce` 逐步试。
|
|
184
|
+
2. **正式上线**:AA 换成生产地址,`guildId` 换成正式服务器,先 `report` 跑一轮看汇总,期间发公告让大家先完成关联。
|
|
185
|
+
3. 切到 `sync`(从这一刻起 48 小时倒计时)。
|
|
186
|
+
4. 确认没问题再切到 `enforce`。
|
|
187
|
+
|
|
188
|
+
## 出错时的保守做法
|
|
189
|
+
|
|
190
|
+
- AA 的 `check` 失败(网络、超时、5xx、签名错误、群不存在):受影响的人不给、不收、不踢、不开始倒计时,只在报告里说明。只有明确拿到「不合格」才收,只有「明确不合格」或「确实没有关联」才倒计时和踢。
|
|
191
|
+
- 成员列表没读全:这一轮不踢,也不把任何人标成「离开」,并发一条报警。
|
|
192
|
+
- 机器人被移出本服务器:自动暂停并报警。服务器 ID 取自事件里的 `extra.body.guild_id`,只认 `self_exited_guild` / `deleted_guild`。
|
|
193
|
+
- 暂停或插件重载(改配置):马上停止所有写操作,已处理的人的记录会保存;一轮执行中 KOOK 机器人掉线也会立即中止这一轮。
|
|
194
|
+
- 写操作失败:只有 KOOK 明确拒绝(接口返回错误)才记下来、24 小时内不重试;HTTP 5xx、网络错误、超时、机器人掉线、429 用完重试都不记,下一轮照常重试。给身份组成功会清掉同一个身份组的「收」的记录,反之亦然。
|
|
195
|
+
- 关联在判定之后变了(比如刚发出验证码):这一轮不处理这个人,踢人前还会再读一次关联。
|
|
196
|
+
- 服务器主按 ID 判断(`getUserView` 不返回 `is_master`);读不到服务器主是谁时不踢任何人。
|
|
197
|
+
- KOOK 连接断开:不做任何事,恢复后先巡检一次。适配器长时间连接后可能收不到事件(satori issue #283、#329),所以巡检会补上漏掉的进服 / 离服,不能只靠事件。
|
|
198
|
+
- 配置错误:插件不装监听和定时器,只写日志并报警;命令仍可用,`kookaa.status` 能看到错误。成员群在 AA 里核对不过时整个插件不动。
|
|
199
|
+
|
|
200
|
+
## 已知限制与实现时要实测的
|
|
201
|
+
|
|
202
|
+
下面这些在假环境里无法验证,要在真实的 KOOK 适配器上实测,结果记在这里:
|
|
203
|
+
|
|
204
|
+
- `session.kook.extra.body.joined_at` 的单位。单位不对或时间不合理时,插件改用收到事件的时间(日志一行)。
|
|
205
|
+
- 各 KOOK 接口要哪个权限位;能不能改服务器主或高位成员的昵称(被 KOOK 拒绝只记一次,24 小时内不重试)。
|
|
206
|
+
- `getUserView` 对非成员的返回:**还没有实测**,插件暂按「返回里没有 `roles`,或 `joined_at` 为 0 / 缺失,就是不在服务器」判断;如果真实接口对成员也不返回 `joined_at`,所有人会被当成不在服务器(不会踢人,但私聊命令会拒绝)。`getGuildView` 的 `master_id` 同样要实测。`/guild/user-list` 每页最多多少人(插件按 `page_total` 翻页)。
|
|
207
|
+
- 机器人消息的识别用 `session.kook.extra.author.bot`;关联、判定按适配器 4.8.1 的结构写,没有在真实环境里跑过。
|
|
208
|
+
- 机器人能不能私聊从没说过话的成员;做不到时走临时消息 / 频道 @。
|
|
209
|
+
- Koishi 命令前缀非空时,「绑定」「解绑」「状态」的行为。
|
|
210
|
+
- 启动后 20 秒的首次巡检、每 10 分钟的检查等定时器,要在测试服务器上亲眼确认。
|
|
211
|
+
- 适配器 ws 长时间运行后收不到事件:本版靠巡检兜底,不另外处理。
|
|
212
|
+
- 给 / 收身份组、改昵称被 KOOK 拒绝后 24 小时内不会自动重试(目标没变);运维发 `kookaa.patrol` 可以让它们马上再试一次。
|
|
213
|
+
- 非巡检路径(事件、10 分钟检查)只会为「新出现的写入失败」单独发报告;「AA 无法判断」之类的提示只写日志和巡检汇总,同一个人同一个原因一天最多提一次。
|
|
214
|
+
|
|
215
|
+
## 许可
|
|
216
|
+
|
|
217
|
+
MIT
|
package/lib/card.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Config } from './config';
|
|
2
|
+
/** The card as the JSON string KOOK wants in `content`. `cardTemplate` is KMarkdown written by the owner: used as is, only `{bindUrl}` is filled. */
|
|
3
|
+
export declare function buildCard(config: Pick<Config, 'cardTemplate' | 'bindUrl'>): string;
|
package/lib/card.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The bind card pinned in the verify channel: text plus buttons (KOOK card message, type 10).
|
|
3
|
+
// Button clicks are handled in link.ts by their `value`.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.buildCard = buildCard;
|
|
6
|
+
const link_1 = require("./link");
|
|
7
|
+
const util_1 = require("./util");
|
|
8
|
+
/** The card as the JSON string KOOK wants in `content`. `cardTemplate` is KMarkdown written by the owner: used as is, only `{bindUrl}` is filled. */
|
|
9
|
+
function buildCard(config) {
|
|
10
|
+
const button = (theme, text, click, value) => ({
|
|
11
|
+
type: 'button', theme, click, value, text: { type: 'plain-text', content: text },
|
|
12
|
+
});
|
|
13
|
+
const elements = [
|
|
14
|
+
button('primary', '获取验证码', 'return-val', link_1.BUTTON_BIND),
|
|
15
|
+
button('info', '查看我的状态', 'return-val', link_1.BUTTON_STATUS),
|
|
16
|
+
];
|
|
17
|
+
if (config.bindUrl)
|
|
18
|
+
elements.push(button('secondary', '去 AA 绑定 QQ', 'link', config.bindUrl));
|
|
19
|
+
return JSON.stringify([{
|
|
20
|
+
type: 'card',
|
|
21
|
+
theme: 'secondary',
|
|
22
|
+
size: 'lg',
|
|
23
|
+
modules: [
|
|
24
|
+
{ type: 'section', text: { type: 'kmarkdown', content: (0, util_1.fillTemplate)(config.cardTemplate, { bindUrl: config.bindUrl || 'AA 的「服务」页' }) } },
|
|
25
|
+
{ type: 'action-group', elements },
|
|
26
|
+
],
|
|
27
|
+
}]);
|
|
28
|
+
}
|
package/lib/commands.js
CHANGED
|
@@ -33,7 +33,7 @@ function registerCommands(ctx, config, guard, now = Date.now) {
|
|
|
33
33
|
.action(({ session }) => {
|
|
34
34
|
if (!allowed(session))
|
|
35
35
|
return '';
|
|
36
|
-
return reply('kookaa.status 状态|kookaa.patrol 马上巡检|kookaa.check <kook:ID|qq:号> 只看不改|kookaa.unlink <kook:ID|qq:号> 解除关联|kookaa.pause / kookaa.resume 暂停 / 恢复|kookaa.kicknow
|
|
36
|
+
return reply('kookaa.status 状态|kookaa.patrol 马上巡检|kookaa.check <kook:ID|qq:号> 只看不改|kookaa.unlink <kook:ID|qq:号> 解除关联|kookaa.pause / kookaa.resume 暂停 / 恢复|kookaa.kicknow 放行熔断冷静期|kookaa.card 在验证频道发绑定卡片');
|
|
37
37
|
});
|
|
38
38
|
root.subcommand('.status', '看模式、配置核对、上次巡检')
|
|
39
39
|
.action(async ({ session }) => (allowed(session) ? reply(await guard.statusReport()) : ''));
|
|
@@ -76,6 +76,8 @@ function registerCommands(ctx, config, guard, now = Date.now) {
|
|
|
76
76
|
.action(async ({ session }) => (allowed(session) ? reply(await guard.pause(`operator:${session.platform}:${session.userId}`)) : ''));
|
|
77
77
|
root.subcommand('.resume', '恢复')
|
|
78
78
|
.action(async ({ session }) => (allowed(session) ? reply(await guard.resume(`operator:${session.platform}:${session.userId}`)) : ''));
|
|
79
|
+
root.subcommand('.card', '在验证频道发一张带按钮的卡片(发完请手动置顶)')
|
|
80
|
+
.action(async ({ session }) => (allowed(session) ? reply(await guard.postCard(`operator:${session.platform}:${session.userId}`)) : ''));
|
|
79
81
|
root.subcommand('.kicknow', '放行熔断冷静期:被拦的人不再顺延,按每小时上限(kickPerHour)立即开始移出')
|
|
80
82
|
.action(async ({ session }) => (allowed(session) ? reply(await guard.kickNow(`operator:${session.platform}:${session.userId}`)) : ''));
|
|
81
83
|
}
|
package/lib/config.d.ts
CHANGED
|
@@ -45,12 +45,14 @@ export interface Config {
|
|
|
45
45
|
remindDeniedTemplate: string;
|
|
46
46
|
remindLastTemplate: string;
|
|
47
47
|
codeTemplate: string;
|
|
48
|
+
cardTemplate: string;
|
|
48
49
|
}
|
|
49
50
|
export declare const DEFAULT_TEXTS: {
|
|
50
51
|
remindNewTemplate: string;
|
|
51
52
|
remindDeniedTemplate: string;
|
|
52
53
|
remindLastTemplate: string;
|
|
53
54
|
codeTemplate: string;
|
|
55
|
+
cardTemplate: string;
|
|
54
56
|
};
|
|
55
57
|
export declare const Config: Schema<Config>;
|
|
56
58
|
export interface ConfigProblem {
|
package/lib/config.js
CHANGED
|
@@ -15,6 +15,7 @@ exports.DEFAULT_TEXTS = {
|
|
|
15
15
|
remindDeniedTemplate: '你的联盟身份已失效({reason}),身份组已收回。请在 {deadline}(北京时间)前处理,否则会被移出服务器。发送「状态」查看详情。',
|
|
16
16
|
remindLastTemplate: '还剩 {hours} 小时:请在 {deadline}(北京时间)前完成验证,否则会被移出服务器。验证方法:发送「绑定」拿验证码,再用你自己的 QQ 在联盟 QQ 群里发出。发送「状态」查看原因。',
|
|
17
17
|
codeTemplate: '你的验证码:{code}({minutes} 分钟内有效)。请用你在 AA 上绑定的 QQ,在联盟 QQ 群里或私聊 QQ 机器人,单独发送这一行。不要把验证码发给别人。',
|
|
18
|
+
cardTemplate: '**加入联盟 KOOK 服务器**\n本服务器只对联盟成员开放。\n1. 点「获取验证码」,机器人会私聊你一个验证码。\n2. 用你在 AA 绑定的 QQ,把验证码发到联盟 QQ 群,或私聊 QQ 机器人。\n也可以在任意频道发送「绑定」。还没在 AA 绑定 QQ 的,先点「去 AA 绑定 QQ」。',
|
|
18
19
|
};
|
|
19
20
|
const modeSchema = koishi_1.Schema.union([
|
|
20
21
|
koishi_1.Schema.const('off').description('off:什么都不做'),
|
|
@@ -108,6 +109,8 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
108
109
|
.description('到期前的最后提醒。可用 `{hours}`、`{deadline}`。'),
|
|
109
110
|
codeTemplate: koishi_1.Schema.string().role('textarea').default(exports.DEFAULT_TEXTS.codeTemplate)
|
|
110
111
|
.description('发验证码的私聊。可用 `{code}`、`{minutes}`。'),
|
|
112
|
+
cardTemplate: koishi_1.Schema.string().role('textarea').default(exports.DEFAULT_TEXTS.cardTemplate)
|
|
113
|
+
.description('「验证」频道里固定卡片的正文(KMarkdown,原样使用)。可用 `{bindUrl}`。运维发 `kookaa.card` 才会发出新卡片。'),
|
|
111
114
|
}).description('文案'),
|
|
112
115
|
]);
|
|
113
116
|
/** `platform:id` -> parts; null when malformed. */
|
package/lib/guard.d.ts
CHANGED
|
@@ -145,6 +145,7 @@ export declare class Guard implements GuardControl {
|
|
|
145
145
|
private onBotRemoved;
|
|
146
146
|
private onLinkChange;
|
|
147
147
|
pause(actor: string, automatic?: boolean): Promise<string>;
|
|
148
|
+
postCard(actor: string): Promise<string>;
|
|
148
149
|
resume(actor: string): Promise<string>;
|
|
149
150
|
patrolNow(): Promise<string>;
|
|
150
151
|
kickNow(actor: string): Promise<string>;
|
package/lib/guard.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.Guard = void 0;
|
|
|
7
7
|
const aa_1 = require("./aa");
|
|
8
8
|
const config_1 = require("./config");
|
|
9
9
|
const kook_1 = require("./kook");
|
|
10
|
+
const card_1 = require("./card");
|
|
10
11
|
const link_1 = require("./link");
|
|
11
12
|
const notifier_1 = require("./notifier");
|
|
12
13
|
const policy_1 = require("./policy");
|
|
@@ -1227,6 +1228,25 @@ class Guard {
|
|
|
1227
1228
|
this.notifier.push('⚠️ 机器人被移出了本服务器,已自动暂停(不再改身份组、昵称,不提醒、不踢人)');
|
|
1228
1229
|
return '已暂停:不再改身份组、昵称,不提醒、不踢人。发送 kookaa.resume 恢复。';
|
|
1229
1230
|
}
|
|
1231
|
+
async postCard(actor) {
|
|
1232
|
+
const channel = (0, util_1.normalizeKookId)(this.config.verifyChannelId);
|
|
1233
|
+
if (!channel)
|
|
1234
|
+
return '没有发出卡片:插件配置里的「验证」频道 ID(verifyChannelId)是空的。请填上频道 ID 后再发 kookaa.card。';
|
|
1235
|
+
const api = this.kookApi();
|
|
1236
|
+
if (!api)
|
|
1237
|
+
return '没有发出卡片:KOOK 机器人不在线。等它上线后再发 kookaa.card。';
|
|
1238
|
+
if (this.config.mode === 'off')
|
|
1239
|
+
this.logger.info('模式是 off,但运维 %s 要求发卡片,照发', actor);
|
|
1240
|
+
try {
|
|
1241
|
+
const id = await api.sendCard(channel, (0, card_1.buildCard)(this.config));
|
|
1242
|
+
this.logger.info('运维 %s 在验证频道发出了绑定卡片(消息 ID %s)', actor, id || '未知');
|
|
1243
|
+
return `✅ 已在验证频道发出卡片,请手动置顶;旧卡片可以删掉。${id ? `(消息 ID:${id})` : ''}`;
|
|
1244
|
+
}
|
|
1245
|
+
catch (error) {
|
|
1246
|
+
this.logger.warn('发卡片失败:%s', (0, util_1.errorText)(error));
|
|
1247
|
+
return `❌ 没有发出卡片:${(0, util_1.errorText)(error)}。请确认机器人在验证频道有「发送消息」权限。`;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1230
1250
|
async resume(actor) {
|
|
1231
1251
|
await this.ready;
|
|
1232
1252
|
if (!this._paused)
|
package/lib/index.js
CHANGED
|
@@ -10,10 +10,10 @@ const store_1 = require("./store");
|
|
|
10
10
|
exports.name = 'aakook';
|
|
11
11
|
// Database: countdowns, links, cursor and pause state must survive reloads. http: calls AA.
|
|
12
12
|
exports.inject = { required: ['database', 'http'] };
|
|
13
|
-
exports.usage = `
|
|
14
|
-
配合 AllianceAuth 插件 **aa-qqbot** 给 KOOK 服务器把门:成员在 KOOK 里拿验证码、用自己的 QQ 发出,机器人按 AA 的判定发放身份组、同步昵称,到期未通过的人会被移出。
|
|
15
|
-
|
|
16
|
-
默认是 **report(只报告)** 模式,不会改动服务器里的任何东西。详细说明见 [README](https://github.com/yilifaer/koishi-plugin-aakook#readme)。
|
|
13
|
+
exports.usage = `
|
|
14
|
+
配合 AllianceAuth 插件 **aa-qqbot** 给 KOOK 服务器把门:成员在 KOOK 里拿验证码、用自己的 QQ 发出,机器人按 AA 的判定发放身份组、同步昵称,到期未通过的人会被移出。
|
|
15
|
+
|
|
16
|
+
默认是 **report(只报告)** 模式,不会改动服务器里的任何东西。详细说明见 [README](https://github.com/yilifaer/koishi-plugin-aakook#readme)。
|
|
17
17
|
`;
|
|
18
18
|
function apply(ctx, config) {
|
|
19
19
|
(0, store_1.extendModels)(ctx);
|
package/lib/kook.d.ts
CHANGED
|
@@ -187,4 +187,5 @@ export declare class KookClient implements KookApi {
|
|
|
187
187
|
sendDirect(userId: string, content: string): Promise<boolean>;
|
|
188
188
|
sendTemp(channelId: string, userId: string, content: string): Promise<boolean>;
|
|
189
189
|
sendChannel(channelId: string, content: string): Promise<boolean>;
|
|
190
|
+
sendCard(channelId: string, cardJson: string): Promise<string>;
|
|
190
191
|
}
|
package/lib/kook.js
CHANGED
|
@@ -322,5 +322,9 @@ class KookClient {
|
|
|
322
322
|
return false;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
+
async sendCard(channelId, cardJson) {
|
|
326
|
+
const result = await this.runner.call(() => this.internal().createMessage({ type: 10, target_id: channelId, content: cardJson }), { write: true });
|
|
327
|
+
return typeof result?.msg_id === 'string' ? result.msg_id : '';
|
|
328
|
+
}
|
|
325
329
|
}
|
|
326
330
|
exports.KookClient = KookClient;
|
package/lib/link.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export declare function describeStatus(input: {
|
|
|
11
11
|
record: MemberRecord | null;
|
|
12
12
|
roleNames: Record<string, string>;
|
|
13
13
|
}): string;
|
|
14
|
+
/** `value` of the buttons on the bind card (see card.ts). */
|
|
15
|
+
export declare const BUTTON_BIND = "aakook:bind";
|
|
16
|
+
export declare const BUTTON_STATUS = "aakook:status";
|
|
14
17
|
export declare class LinkService {
|
|
15
18
|
private deps;
|
|
16
19
|
private readonly logger;
|
|
@@ -34,11 +37,19 @@ export declare class LinkService {
|
|
|
34
37
|
private deliverPrivate;
|
|
35
38
|
/** A notice for someone outside any command (private only, failure is just logged). */
|
|
36
39
|
private notifyKook;
|
|
37
|
-
/**
|
|
40
|
+
/** Typed command: only our bot, our server (or a private chat with someone in it), and never bots. */
|
|
38
41
|
private gate;
|
|
42
|
+
private admit;
|
|
43
|
+
/**
|
|
44
|
+
* A click on a card button. Facts of @satorijs/adapter-kook 4.8.1: `session.userId` is undefined (a click has no
|
|
45
|
+
* `author_id`), the clicker is `session.event.user` and `extra.body.user_id`, the server and channel are also in the body.
|
|
46
|
+
*/
|
|
47
|
+
private onButton;
|
|
39
48
|
private onBind;
|
|
49
|
+
private bind;
|
|
40
50
|
private onUnbind;
|
|
41
51
|
private onStatus;
|
|
52
|
+
private status;
|
|
42
53
|
private onQqMessage;
|
|
43
54
|
private qqReply;
|
|
44
55
|
private handleCode;
|
package/lib/link.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// The QQ number always comes from the QQ message event (`session.userId`), never from what the user typed.
|
|
5
5
|
// Nothing here calls AA: after a link changes, `hooks.onLinkChange` lets guard judge the person again.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.LinkService = exports.CODE_ALPHABET = void 0;
|
|
7
|
+
exports.LinkService = exports.BUTTON_STATUS = exports.BUTTON_BIND = exports.CODE_ALPHABET = void 0;
|
|
8
8
|
exports.parseCode = parseCode;
|
|
9
9
|
exports.parseConfirm = parseConfirm;
|
|
10
10
|
exports.generateCode = generateCode;
|
|
@@ -102,6 +102,9 @@ class RateLimiter {
|
|
|
102
102
|
return true;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
/** `value` of the buttons on the bind card (see card.ts). */
|
|
106
|
+
exports.BUTTON_BIND = 'aakook:bind';
|
|
107
|
+
exports.BUTTON_STATUS = 'aakook:status';
|
|
105
108
|
class LinkService {
|
|
106
109
|
deps;
|
|
107
110
|
logger;
|
|
@@ -127,6 +130,10 @@ class LinkService {
|
|
|
127
130
|
this.disposers.push(() => command.dispose());
|
|
128
131
|
// a plain listener, not a middleware: it can never stop other plugins from seeing the message
|
|
129
132
|
this.disposers.push(ctx.on('message', (session) => this.onQqMessage(session)));
|
|
133
|
+
// clicks on the bind card's buttons: the same paths as the typed commands
|
|
134
|
+
this.disposers.push(ctx.on('interaction/button', (session) => {
|
|
135
|
+
this.onButton(session).catch((error) => this.logger.warn('处理按钮点击出错:%s', (0, util_1.errorText)(error)));
|
|
136
|
+
}));
|
|
130
137
|
}
|
|
131
138
|
dispose() {
|
|
132
139
|
for (const dispose of this.disposers.splice(0))
|
|
@@ -203,16 +210,25 @@ class LinkService {
|
|
|
203
210
|
this.logger.warn('给 KOOK 用户 %s 的通知私聊失败', userId);
|
|
204
211
|
}
|
|
205
212
|
// ---------------------------------------------------------------- KOOK side
|
|
206
|
-
/**
|
|
213
|
+
/** Typed command: only our bot, our server (or a private chat with someone in it), and never bots. */
|
|
207
214
|
async gate(session) {
|
|
215
|
+
return this.admit(session, {
|
|
216
|
+
userId: session.userId,
|
|
217
|
+
// whether the author is a bot is in the raw event (`extra.author.bot`); `isBot` of the Satori user is only a fallback
|
|
218
|
+
isBot: session.kook?.extra?.author?.bot === true || !!session.event.user?.isBot,
|
|
219
|
+
direct: !!session.isDirect,
|
|
220
|
+
guildId: session.guildId,
|
|
221
|
+
channelId: session.channelId,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async admit(session, actor) {
|
|
208
225
|
const { config, hooks } = this.deps;
|
|
209
226
|
if (session.platform !== 'kook' || session.selfId !== config.kookBotId)
|
|
210
227
|
return null;
|
|
211
|
-
const userId =
|
|
212
|
-
|
|
213
|
-
if (!userId || userId === session.selfId || session.kook?.extra?.author?.bot === true || session.event.user?.isBot)
|
|
228
|
+
const userId = actor.userId;
|
|
229
|
+
if (!userId || userId === session.selfId || actor.isBot)
|
|
214
230
|
return null;
|
|
215
|
-
if (
|
|
231
|
+
if (actor.direct) {
|
|
216
232
|
try {
|
|
217
233
|
if (!(await hooks.isInGuild(userId)))
|
|
218
234
|
return null;
|
|
@@ -223,14 +239,40 @@ class LinkService {
|
|
|
223
239
|
}
|
|
224
240
|
return { userId, channelId: null };
|
|
225
241
|
}
|
|
226
|
-
if (
|
|
242
|
+
if (actor.guildId !== config.guildId || !actor.channelId)
|
|
227
243
|
return null;
|
|
228
|
-
return { userId, channelId:
|
|
244
|
+
return { userId, channelId: actor.channelId };
|
|
229
245
|
}
|
|
230
|
-
|
|
231
|
-
|
|
246
|
+
/**
|
|
247
|
+
* A click on a card button. Facts of @satorijs/adapter-kook 4.8.1: `session.userId` is undefined (a click has no
|
|
248
|
+
* `author_id`), the clicker is `session.event.user` and `extra.body.user_id`, the server and channel are also in the body.
|
|
249
|
+
*/
|
|
250
|
+
async onButton(session) {
|
|
251
|
+
const value = session.event?.button?.id;
|
|
252
|
+
if (value !== exports.BUTTON_BIND && value !== exports.BUTTON_STATUS)
|
|
253
|
+
return;
|
|
254
|
+
const body = session.kook?.extra?.body ?? {};
|
|
255
|
+
const clicker = session.userId || session.event?.user?.id || body.user_id;
|
|
256
|
+
const gate = await this.admit(session, {
|
|
257
|
+
userId: clicker ? String(clicker) : undefined,
|
|
258
|
+
isBot: body.user_info?.bot === true || !!session.event?.user?.isBot,
|
|
259
|
+
direct: false,
|
|
260
|
+
guildId: session.guildId || body.guild_id,
|
|
261
|
+
channelId: session.channelId || body.target_id,
|
|
262
|
+
});
|
|
232
263
|
if (!gate)
|
|
233
264
|
return;
|
|
265
|
+
if (value === exports.BUTTON_BIND)
|
|
266
|
+
await this.bind(gate);
|
|
267
|
+
else
|
|
268
|
+
await this.status(gate);
|
|
269
|
+
}
|
|
270
|
+
async onBind(session) {
|
|
271
|
+
const gate = await this.gate(session);
|
|
272
|
+
if (gate)
|
|
273
|
+
await this.bind(gate);
|
|
274
|
+
}
|
|
275
|
+
async bind(gate) {
|
|
234
276
|
const { config, store } = this.deps;
|
|
235
277
|
const now = this.now;
|
|
236
278
|
if (!this.bindLimit.hit(gate.userId, now)) {
|
|
@@ -281,8 +323,10 @@ class LinkService {
|
|
|
281
323
|
}
|
|
282
324
|
async onStatus(session) {
|
|
283
325
|
const gate = await this.gate(session);
|
|
284
|
-
if (
|
|
285
|
-
|
|
326
|
+
if (gate)
|
|
327
|
+
await this.status(gate);
|
|
328
|
+
}
|
|
329
|
+
async status(gate) {
|
|
286
330
|
const { store, config } = this.deps;
|
|
287
331
|
if (!this.statusLimit.hit(gate.userId, this.now)) {
|
|
288
332
|
await this.deliverPrivate(gate, '请稍后再试。');
|
package/lib/types.d.ts
CHANGED
|
@@ -135,6 +135,8 @@ export interface KookApi {
|
|
|
135
135
|
sendTemp(channelId: string, userId: string, content: string): Promise<boolean>;
|
|
136
136
|
/** Plain channel message (KMarkdown). */
|
|
137
137
|
sendChannel(channelId: string, content: string): Promise<boolean>;
|
|
138
|
+
/** A card message (type 10) in a channel; returns the message id ('' if KOOK did not give one). Throws on failure. */
|
|
139
|
+
sendCard(channelId: string, cardJson: string): Promise<string>;
|
|
138
140
|
}
|
|
139
141
|
/** The config values policy needs, normalised (ids are strings). Built by `toPolicyConfig(config)` in config.ts. */
|
|
140
142
|
export interface PolicyConfig {
|
|
@@ -320,6 +322,8 @@ export interface GuardControl {
|
|
|
320
322
|
kind: 'kook' | 'qq';
|
|
321
323
|
id: string;
|
|
322
324
|
}): Promise<string | null>;
|
|
325
|
+
/** Post the bind card (buttons) into the verify channel (kookaa.card). Returns the text to answer with. */
|
|
326
|
+
postCard(actor: string): Promise<string>;
|
|
323
327
|
}
|
|
324
328
|
/** Audit actions written to `aakook_audit.action` (the breaker counts `kick` and `revoke-member`). */
|
|
325
329
|
export type AuditAction = 'link' | 'unlink' | 'relink' | 'transfer' | 'grant' | 'revoke' | 'revoke-member' | 'nickname' | 'countdown-start' | 'countdown-clear' | 'countdown-extend' | 'remind' | 'kick' | 'kick-released' | 'revoke-member-released' | 'hold' | 'release' | 'pause' | 'resume' | 'mode';
|
package/package.json
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koishi-plugin-aakook",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "配合 AllianceAuth 插件 aa-qqbot,通过 QQ 关联给 KOOK 服务器把门:按 AA 判定发放身份组、同步昵称,到期移出不合格的人",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"typings": "lib/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib",
|
|
9
|
-
"README.md",
|
|
10
|
-
"CHANGELOG.md",
|
|
11
|
-
"LICENSE"
|
|
12
|
-
],
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/yilifaer/koishi-plugin-aakook.git"
|
|
17
|
-
},
|
|
18
|
-
"homepage": "https://github.com/yilifaer/koishi-plugin-aakook#readme",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/yilifaer/koishi-plugin-aakook/issues"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"chatbot",
|
|
24
|
-
"koishi",
|
|
25
|
-
"plugin",
|
|
26
|
-
"kook",
|
|
27
|
-
"allianceauth",
|
|
28
|
-
"eve-online"
|
|
29
|
-
],
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=18"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc -p tsconfig.build.json",
|
|
35
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
36
|
-
"test": "vitest run",
|
|
37
|
-
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
38
|
-
},
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"koishi": "^4.18.0"
|
|
41
|
-
},
|
|
42
|
-
"koishi": {
|
|
43
|
-
"description": {
|
|
44
|
-
"zh": "配合 AllianceAuth 插件 aa-qqbot 给 KOOK 服务器把门:QQ 关联、发身份组、同步昵称、到期移出",
|
|
45
|
-
"en": "Gate a KOOK server with AllianceAuth (aa-qqbot): QQ linking, roles, nickname sync and timed removal"
|
|
46
|
-
},
|
|
47
|
-
"service": {
|
|
48
|
-
"required": [
|
|
49
|
-
"database",
|
|
50
|
-
"http"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@koishijs/plugin-database-memory": "^3.7.0",
|
|
56
|
-
"@koishijs/plugin-http": "^0.6.3",
|
|
57
|
-
"@types/node": "^22.20.4",
|
|
58
|
-
"koishi": "^4.18.11",
|
|
59
|
-
"typescript": "^5.9.3",
|
|
60
|
-
"vitest": "^3.2.7"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-aakook",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "配合 AllianceAuth 插件 aa-qqbot,通过 QQ 关联给 KOOK 服务器把门:按 AA 判定发放身份组、同步昵称,到期移出不合格的人",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"README.md",
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/yilifaer/koishi-plugin-aakook.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/yilifaer/koishi-plugin-aakook#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/yilifaer/koishi-plugin-aakook/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"chatbot",
|
|
24
|
+
"koishi",
|
|
25
|
+
"plugin",
|
|
26
|
+
"kook",
|
|
27
|
+
"allianceauth",
|
|
28
|
+
"eve-online"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.build.json",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"koishi": "^4.18.0"
|
|
41
|
+
},
|
|
42
|
+
"koishi": {
|
|
43
|
+
"description": {
|
|
44
|
+
"zh": "配合 AllianceAuth 插件 aa-qqbot 给 KOOK 服务器把门:QQ 关联、发身份组、同步昵称、到期移出",
|
|
45
|
+
"en": "Gate a KOOK server with AllianceAuth (aa-qqbot): QQ linking, roles, nickname sync and timed removal"
|
|
46
|
+
},
|
|
47
|
+
"service": {
|
|
48
|
+
"required": [
|
|
49
|
+
"database",
|
|
50
|
+
"http"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@koishijs/plugin-database-memory": "^3.7.0",
|
|
56
|
+
"@koishijs/plugin-http": "^0.6.3",
|
|
57
|
+
"@types/node": "^22.20.4",
|
|
58
|
+
"koishi": "^4.18.11",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"vitest": "^3.2.7"
|
|
61
|
+
}
|
|
62
|
+
}
|