@zhin.js/plugin-group-suite 1.0.1 → 1.1.2

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.
Files changed (143) hide show
  1. package/README.md +42 -58
  2. package/commands/checkin/index.js +11 -0
  3. package/commands/checkin/index.ts +12 -0
  4. package/commands/forget/index.js +10 -0
  5. package/commands/forget/index.ts +12 -0
  6. package/commands/keyword-add/[keyword]/index.js +16 -0
  7. package/commands/keyword-add/[keyword]/index.ts +16 -0
  8. package/commands/keyword-list/index.js +14 -0
  9. package/commands/keyword-list/index.ts +14 -0
  10. package/commands/keyword-remove/[keyword]/index.js +16 -0
  11. package/commands/keyword-remove/[keyword]/index.ts +15 -0
  12. package/commands/mypoints/index.js +10 -0
  13. package/commands/mypoints/index.ts +12 -0
  14. package/commands/mystats/index.js +10 -0
  15. package/commands/mystats/index.ts +12 -0
  16. package/commands/rank/index.js +11 -0
  17. package/commands/rank/index.ts +12 -0
  18. package/commands/stats/index.js +14 -0
  19. package/commands/stats/index.ts +21 -0
  20. package/commands/stats-rank/index.js +13 -0
  21. package/commands/stats-rank/index.ts +20 -0
  22. package/commands/stats-week/index.js +13 -0
  23. package/commands/stats-week/index.ts +20 -0
  24. package/commands/teach/index.js +11 -0
  25. package/commands/teach/index.ts +12 -0
  26. package/commands/teach-list/[[page]]/index.js +13 -0
  27. package/commands/teach-list/[[page]]/index.ts +14 -0
  28. package/commands/teach-regex/index.js +11 -0
  29. package/commands/teach-regex/index.ts +12 -0
  30. package/lib/checkin-lib.d.ts +27 -0
  31. package/lib/checkin-lib.d.ts.map +1 -0
  32. package/lib/checkin-lib.js +133 -0
  33. package/lib/checkin-lib.js.map +1 -0
  34. package/lib/config.d.ts +4 -57
  35. package/lib/config.d.ts.map +1 -1
  36. package/lib/config.js +18 -40
  37. package/lib/config.js.map +1 -1
  38. package/lib/db-store.d.ts +5 -0
  39. package/lib/db-store.d.ts.map +1 -0
  40. package/lib/db-store.js +11 -0
  41. package/lib/db-store.js.map +1 -0
  42. package/lib/index.d.ts +9 -1
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +7 -29
  45. package/lib/index.js.map +1 -1
  46. package/lib/keyword-store.d.ts +5 -0
  47. package/lib/keyword-store.d.ts.map +1 -0
  48. package/lib/keyword-store.js +17 -0
  49. package/lib/keyword-store.js.map +1 -0
  50. package/lib/memory-store.d.ts +31 -0
  51. package/lib/memory-store.d.ts.map +1 -0
  52. package/lib/memory-store.js +63 -0
  53. package/lib/memory-store.js.map +1 -0
  54. package/lib/runtime-state.d.ts +24 -0
  55. package/lib/runtime-state.d.ts.map +1 -0
  56. package/lib/runtime-state.js +15 -0
  57. package/lib/runtime-state.js.map +1 -0
  58. package/lib/shared-runtime.d.ts +26 -0
  59. package/lib/shared-runtime.d.ts.map +1 -0
  60. package/lib/shared-runtime.js +34 -0
  61. package/lib/shared-runtime.js.map +1 -0
  62. package/lib/stats-lib.d.ts +39 -0
  63. package/lib/stats-lib.d.ts.map +1 -0
  64. package/lib/stats-lib.js +172 -0
  65. package/lib/stats-lib.js.map +1 -0
  66. package/lib/tables.d.ts +4 -0
  67. package/lib/tables.d.ts.map +1 -0
  68. package/lib/tables.js +40 -0
  69. package/lib/tables.js.map +1 -0
  70. package/lib/teach-lib.d.ts +23 -0
  71. package/lib/teach-lib.d.ts.map +1 -0
  72. package/lib/teach-lib.js +228 -0
  73. package/lib/teach-lib.js.map +1 -0
  74. package/middlewares/keyword-reply/index.js +36 -0
  75. package/middlewares/keyword-reply/index.ts +37 -0
  76. package/middlewares/stats-count/index.js +20 -0
  77. package/middlewares/stats-count/index.ts +22 -0
  78. package/middlewares/teach-reply/index.js +21 -0
  79. package/middlewares/teach-reply/index.ts +22 -0
  80. package/package.json +57 -14
  81. package/plugin.js +38 -0
  82. package/schema.json +17 -0
  83. package/skills/checkin/tools/checkin_query/index.js +42 -0
  84. package/skills/checkin/tools/checkin_query/index.ts +41 -0
  85. package/skills/checkin/tools/checkin_rank/index.js +34 -0
  86. package/skills/checkin/tools/checkin_rank/index.ts +34 -0
  87. package/skills/group-daily-analysis/SKILL.md +11 -4
  88. package/skills/group-daily-analysis/tools/group_announce/index.js +14 -0
  89. package/skills/group-daily-analysis/tools/group_announce/index.ts +14 -0
  90. package/skills/group-daily-analysis/tools/stats_query/index.js +35 -0
  91. package/skills/group-daily-analysis/tools/stats_query/index.ts +36 -0
  92. package/skills/group-daily-analysis/tools/stats_user/index.js +50 -0
  93. package/skills/group-daily-analysis/tools/stats_user/index.ts +46 -0
  94. package/src/checkin-lib.ts +167 -0
  95. package/src/config.ts +23 -57
  96. package/src/db-store.ts +19 -0
  97. package/src/index.ts +39 -33
  98. package/src/keyword-store.ts +18 -0
  99. package/src/memory-store.ts +90 -0
  100. package/src/runtime-state.ts +41 -0
  101. package/src/shared-runtime.ts +44 -0
  102. package/src/stats-lib.ts +198 -0
  103. package/src/tables.ts +46 -0
  104. package/src/teach-lib.ts +294 -0
  105. package/lib/admin.d.ts +0 -4
  106. package/lib/admin.d.ts.map +0 -1
  107. package/lib/admin.js +0 -123
  108. package/lib/admin.js.map +0 -1
  109. package/lib/checkin.d.ts +0 -5
  110. package/lib/checkin.d.ts.map +0 -1
  111. package/lib/checkin.js +0 -168
  112. package/lib/checkin.js.map +0 -1
  113. package/lib/daily-analysis.d.ts +0 -7
  114. package/lib/daily-analysis.d.ts.map +0 -1
  115. package/lib/daily-analysis.js +0 -334
  116. package/lib/daily-analysis.js.map +0 -1
  117. package/lib/shared.d.ts +0 -25
  118. package/lib/shared.d.ts.map +0 -1
  119. package/lib/shared.js +0 -40
  120. package/lib/shared.js.map +0 -1
  121. package/lib/stats.d.ts +0 -12
  122. package/lib/stats.d.ts.map +0 -1
  123. package/lib/stats.js +0 -256
  124. package/lib/stats.js.map +0 -1
  125. package/lib/teach.d.ts +0 -4
  126. package/lib/teach.d.ts.map +0 -1
  127. package/lib/teach.js +0 -294
  128. package/lib/teach.js.map +0 -1
  129. package/plugin.yml +0 -3
  130. package/src/admin.ts +0 -145
  131. package/src/checkin.ts +0 -196
  132. package/src/daily-analysis.ts +0 -458
  133. package/src/shared.ts +0 -51
  134. package/src/stats.ts +0 -297
  135. package/src/teach.ts +0 -307
  136. package/tools/checkin-query/checkin-query.tool.md +0 -11
  137. package/tools/checkin-query/handler.ts +0 -22
  138. package/tools/checkin-rank/checkin-rank.tool.md +0 -11
  139. package/tools/checkin-rank/handler.ts +0 -16
  140. package/tools/stats-query/handler.ts +0 -31
  141. package/tools/stats-query/stats-query.tool.md +0 -16
  142. package/tools/stats-user/handler.ts +0 -28
  143. package/tools/stats-user/stats-user.tool.md +0 -12
package/README.md CHANGED
@@ -1,80 +1,64 @@
1
1
  # @zhin.js/plugin-group-suite
2
2
 
3
- 群运营一体化插件(**破坏性合并**,替代以下独立包,不再维护):
3
+ Plugin Runtime 群运营能力包,提供签到积分、消息统计、关键词回复与群问答。所有能力
4
+ 由 `commands/`、`middlewares/` 和 `skills/` 约定目录发现,不注册 legacy Plugin 回调。
4
5
 
5
- - `@zhin.js/plugin-group-admin`
6
- - `@zhin.js/plugin-checkin`
7
- - `@zhin.js/plugin-stats`
8
- - `@zhin.js/plugin-group-daily-analysis`
9
- - `@zhin.js/plugin-teach`
10
-
11
- ## 安装
6
+ ## 安装与拓扑
12
7
 
13
8
  ```bash
14
9
  pnpm add @zhin.js/plugin-group-suite
15
10
  ```
16
11
 
17
- 旧包已在 npm 标记废弃(维护者执行):
12
+ 父插件在 `package.json#zhin.plugins` 中声明子插件:
18
13
 
19
- ```bash
20
- npm login # 或 export NODE_AUTH_TOKEN=...
21
- node scripts/deprecate-group-legacy-packages.mjs
14
+ ```json
15
+ {
16
+ "package": "@zhin.js/plugin-group-suite",
17
+ "instanceKey": "group-suite"
18
+ }
22
19
  ```
23
20
 
24
- ## 配置(扁平 `groupSuite`,多数项有默认值)
21
+ 配置位于该实例的层级节点:
25
22
 
26
23
  ```yaml
27
24
  plugins:
28
- - "@zhin.js/plugin-group-suite"
29
- # 可选:stats / 群分析 等自动出图;未安装则框架自动发纯文本
30
- - "@zhin.js/plugin-html-renderer"
31
-
32
- database:
33
- dialect: sqlite
34
- filename: ./data/bot.db
35
-
36
- inbox:
37
- enabled: true # 群日报需要
38
-
39
- # 可整段省略,使用默认值
40
- groupSuite:
41
- noticeAdapters: [icqq]
42
- autoAnalysisEnabled: true
43
- autoAnalysisCron: "0 9 * * *"
25
+ group-suite:
26
+ keywordReply: false
27
+ basePointsMin: 10
28
+ basePointsMax: 30
29
+ streakBonus: 5
30
+ streakCap: 50
31
+ rankSize: 10
32
+ teachMaxPerGroup: 200
33
+ teachCooldownMs: 3000
34
+ teachAllowRegex: true
35
+ teachPageSize: 10
44
36
  ```
45
37
 
46
- 常用可选字段(单层,无需 `admin:` / `checkin:` 等嵌套):
47
-
48
- | 字段 | 默认 | 说明 |
49
- |------|------|------|
50
- | `welcome` | 欢迎新成员… | 入群欢迎语 |
51
- | `recallNotify` | `true` | 撤回提示 |
52
- | `keywordReply` | `false` | 内置关键词(建议用 teach) |
53
- | `noticeAdapters` | `[icqq]` | 处理 notice 的适配器 |
54
- | `basePointsMin` / `basePointsMax` | 10 / 30 | 签到积分 |
55
- | `rankSize` | 10 | 签到与统计排行人数 |
56
- | `statsRetentionDays` | 90 | 统计保留天数 |
57
- | `analysisDays` | 1 | 群分析天数 |
58
- | `analysisGroups` | `[]` | 日报白名单(空=不限制) |
59
- | `analysisGroupsBlock` | `[]` | 日报黑名单 |
60
- | `teachMaxPerGroup` | 200 | 每群问答上限 |
61
- | `teachCooldownMs` | 3000 | 问答冷却(毫秒) |
38
+ 完整约束以 [`schema.json`](./schema.json) 为 SSOT。数据优先写入 Runtime
39
+ `DatabaseHost`;未配置数据库时使用插件实例私有的内存存储,适合测试。
62
40
 
63
- ## 统计与群分析出图
41
+ 数据库、关键词、教学冷却和消息统计缓冲统一封装为 owner-scoped
42
+ `GroupSuiteRuntime`。commands/middlewares 只通过 Capability Context 解析该资源;因此同一
43
+ 进程中的多个实例、HMR 新旧 generation 不会共享可变状态。
64
44
 
65
- `stats`、`mystats`、`群分析` 等命令返回 **`segment.html({ html })`**,由出站链统一处理:
45
+ ## 能力
66
46
 
67
- - 安装 **`@zhin.js/plugin-html-renderer`** → 自动渲染为 PNG 卡片
68
- - 未安装 → core 从 HTML 自动剥离纯文本(零业务侧 detect)
47
+ | 路径 | 说明 |
48
+ |---|---|
49
+ | `checkin` / `mypoints` / `rank` | 签到、积分与排行 |
50
+ | `stats` / `stats-week` / `stats-rank` / `mystats` | 消息统计 |
51
+ | `teach` / `teach-regex` / `teach-list` / `forget` | 群问答管理 |
52
+ | `keyword-add` / `keyword-list` / `keyword-remove` | 关键词回复管理 |
53
+ | `middlewares/*` | 入站统计、关键词和问答匹配 |
54
+ | `skills/<name>/tools/<tool>/index.ts` | Skill 激活后披露签到查询、排行、消息统计和群公告 Tool |
69
55
 
70
- 卡片 HTML 在 `stats-card.ts` / `analysis-card.ts` 中用 **`@zhin.js/satori`** 的 `h()` 与内置组件构建,视觉对齐 test-bot 的 `zt-report-card`。
56
+ 本 major 不包含 Adapter side-event 欢迎/撤回、AI 群日报或 HTML 报表。这些旧能力
57
+ 需要独立的事件与渲染 Feature,已从 schema 移除,避免出现“可配置但不生效”的字段。
71
58
 
72
- ## 命令
59
+ ## 验证
73
60
 
74
- | 命令 | 模块 |
75
- |------|------|
76
- | `签到` / `checkin` / `mypoints` / `rank` | 签到 |
77
- | `stats` / `stats-week` / `stats-rank` / `mystats` | 统计 |
78
- | `群分析` / `分析设置` | 日报 |
79
- | `teach` / `teach-regex` / `forget` / `teach-list` | 问答(`teach 问题 回答` 或 `teach 问题\|答案`) |
80
- | `添加关键词` … | 仅 `keywordReply: true` |
61
+ ```bash
62
+ pnpm --filter @zhin.js/plugin-group-suite build
63
+ pnpm --filter @zhin.js/plugin-group-suite test
64
+ ```
@@ -0,0 +1,11 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { doCheckin } from "../../lib/checkin-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '每日签到获得积分',
8
+ execute({ config, input, owner, use }) {
9
+ return doCheckin(input ?? {}, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
10
+ },
11
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { doCheckin } from '../../src/checkin-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '每日签到获得积分',
9
+ execute({ config, input, owner, use }) {
10
+ return doCheckin(input ?? {}, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,10 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { teachForget } from "../../lib/teach-lib.js";
4
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
5
+ export default defineCommand({
6
+ description: '忘记问答(删除问答对)',
7
+ execute({ input, args, owner, use }) {
8
+ return teachForget(input ?? {}, args.join(' '), resolveGroupSuiteRuntime({ owner, use }));
9
+ },
10
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import type { GroupSuiteConfig } from '../../src/config.js';
4
+ import { teachForget } from '../../src/teach-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '忘记问答(删除问答对)',
9
+ execute({ input, args, owner, use }) {
10
+ return teachForget(input ?? {}, args.join(' '), resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,16 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { addKeyword } from "../../../lib/keyword-store.js";
4
+ import { resolveGroupSuiteRuntime } from "../../../lib/runtime-state.js";
5
+ export default defineCommand({
6
+ description: '添加关键词自动回复',
7
+ params: { keyword: { type: 'string' } },
8
+ execute({ params, args, owner, use }) {
9
+ const keyword = String(params.keyword ?? '');
10
+ const reply = args.join(' ').trim();
11
+ if (!keyword || !reply)
12
+ return '请提供关键词和回复内容';
13
+ addKeyword(keyword, reply, resolveGroupSuiteRuntime({ owner, use }).keywords);
14
+ return `已添加关键词「${keyword}」→「${reply}」`;
15
+ },
16
+ });
@@ -0,0 +1,16 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import { addKeyword } from '../../../src/keyword-store.js';
3
+ import type { GroupSuiteConfig } from '../../../src/config.js';
4
+ import { resolveGroupSuiteRuntime } from '../../../src/runtime-state.js';
5
+
6
+ export default defineCommand<GroupSuiteConfig>({
7
+ description: '添加关键词自动回复',
8
+ params: { keyword: { type: 'string' } },
9
+ execute({ params, args, owner, use }) {
10
+ const keyword = String(params.keyword ?? '');
11
+ const reply = args.join(' ').trim();
12
+ if (!keyword || !reply) return '请提供关键词和回复内容';
13
+ addKeyword(keyword, reply, resolveGroupSuiteRuntime({ owner, use }).keywords);
14
+ return `已添加关键词「${keyword}」→「${reply}」`;
15
+ },
16
+ });
@@ -0,0 +1,14 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { listKeywords } from "../../lib/keyword-store.js";
4
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
5
+ export default defineCommand({
6
+ description: '查看所有关键词回复对',
7
+ execute({ owner, use }) {
8
+ const entries = listKeywords(resolveGroupSuiteRuntime({ owner, use }).keywords);
9
+ if (entries.length === 0)
10
+ return '当前没有设置任何关键词';
11
+ const lines = entries.map(([k, v], i) => `${i + 1}. 「${k}」→「${v}」`);
12
+ return `关键词列表(共 ${entries.length} 条):\n${lines.join('\n')}`;
13
+ },
14
+ });
@@ -0,0 +1,14 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import { listKeywords } from '../../src/keyword-store.js';
3
+ import type { GroupSuiteConfig } from '../../src/config.js';
4
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
5
+
6
+ export default defineCommand<GroupSuiteConfig>({
7
+ description: '查看所有关键词回复对',
8
+ execute({ owner, use }) {
9
+ const entries = listKeywords(resolveGroupSuiteRuntime({ owner, use }).keywords);
10
+ if (entries.length === 0) return '当前没有设置任何关键词';
11
+ const lines = entries.map(([k, v], i) => `${i + 1}. 「${k}」→「${v}」`);
12
+ return `关键词列表(共 ${entries.length} 条):\n${lines.join('\n')}`;
13
+ },
14
+ });
@@ -0,0 +1,16 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { removeKeyword } from "../../../lib/keyword-store.js";
4
+ import { resolveGroupSuiteRuntime } from "../../../lib/runtime-state.js";
5
+ export default defineCommand({
6
+ description: '删除关键词自动回复',
7
+ params: { keyword: { type: 'string' } },
8
+ execute({ params, owner, use }) {
9
+ const keyword = String(params.keyword ?? '');
10
+ if (!keyword)
11
+ return '请提供要删除的关键词';
12
+ if (!removeKeyword(keyword, resolveGroupSuiteRuntime({ owner, use }).keywords))
13
+ return `关键词「${keyword}」不存在`;
14
+ return `已删除关键词「${keyword}」`;
15
+ },
16
+ });
@@ -0,0 +1,15 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import { removeKeyword } from '../../../src/keyword-store.js';
3
+ import type { GroupSuiteConfig } from '../../../src/config.js';
4
+ import { resolveGroupSuiteRuntime } from '../../../src/runtime-state.js';
5
+
6
+ export default defineCommand<GroupSuiteConfig>({
7
+ description: '删除关键词自动回复',
8
+ params: { keyword: { type: 'string' } },
9
+ execute({ params, owner, use }) {
10
+ const keyword = String(params.keyword ?? '');
11
+ if (!keyword) return '请提供要删除的关键词';
12
+ if (!removeKeyword(keyword, resolveGroupSuiteRuntime({ owner, use }).keywords)) return `关键词「${keyword}」不存在`;
13
+ return `已删除关键词「${keyword}」`;
14
+ },
15
+ });
@@ -0,0 +1,10 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { myPoints } from "../../lib/checkin-lib.js";
4
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
5
+ export default defineCommand({
6
+ description: '查看个人积分与签到信息',
7
+ execute({ input, owner, use }) {
8
+ return myPoints(input ?? {}, resolveGroupSuiteRuntime({ owner, use }));
9
+ },
10
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import type { GroupSuiteConfig } from '../../src/config.js';
4
+ import { myPoints } from '../../src/checkin-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '查看个人积分与签到信息',
9
+ execute({ input, owner, use }) {
10
+ return myPoints(input ?? {}, resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,10 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { myStatsText } from "../../lib/stats-lib.js";
4
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
5
+ export default defineCommand({
6
+ description: '查看个人消息统计',
7
+ execute({ input, owner, use }) {
8
+ return myStatsText(input ?? {}, resolveGroupSuiteRuntime({ owner, use }));
9
+ },
10
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import type { GroupSuiteConfig } from '../../src/config.js';
4
+ import { myStatsText } from '../../src/stats-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '查看个人消息统计',
9
+ execute({ input, owner, use }) {
10
+ return myStatsText(input ?? {}, resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,11 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { pointsRank } from "../../lib/checkin-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '查看积分排行榜',
8
+ execute({ config, input, owner, use }) {
9
+ return pointsRank(input ?? {}, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
10
+ },
11
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { pointsRank } from '../../src/checkin-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '查看积分排行榜',
9
+ execute({ config, input, owner, use }) {
10
+ return pointsRank(input ?? {}, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,14 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { todayStr } from "../../lib/shared-runtime.js";
5
+ import { resolveGroupId, statsRankText } from "../../lib/stats-lib.js";
6
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
7
+ export default defineCommand({
8
+ description: '查看今日消息统计',
9
+ execute({ config, input, owner, use }) {
10
+ const groupId = resolveGroupId(input ?? {});
11
+ const title = groupId ? '今日本群消息统计' : '今日全局消息统计';
12
+ return statsRankText(input ?? {}, resolveGroupSuiteConfig(config), todayStr(), title, resolveGroupSuiteRuntime({ owner, use }));
13
+ },
14
+ });
@@ -0,0 +1,21 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { todayStr } from '../../src/shared-runtime.js';
5
+ import { resolveGroupId, statsRankText } from '../../src/stats-lib.js';
6
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
7
+
8
+ export default defineCommand<GroupSuiteConfig, string, Message>({
9
+ description: '查看今日消息统计',
10
+ execute({ config, input, owner, use }) {
11
+ const groupId = resolveGroupId(input ?? {});
12
+ const title = groupId ? '今日本群消息统计' : '今日全局消息统计';
13
+ return statsRankText(
14
+ input ?? {},
15
+ resolveGroupSuiteConfig(config),
16
+ todayStr(),
17
+ title,
18
+ resolveGroupSuiteRuntime({ owner, use }),
19
+ );
20
+ },
21
+ });
@@ -0,0 +1,13 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { monthStartStr, resolveGroupId, statsRankText } from "../../lib/stats-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '查看本月话唠排行',
8
+ execute({ config, input, owner, use }) {
9
+ const groupId = resolveGroupId(input ?? {});
10
+ const title = groupId ? '本月话唠排行' : '全局话唠排行';
11
+ return statsRankText(input ?? {}, resolveGroupSuiteConfig(config), monthStartStr(), title, resolveGroupSuiteRuntime({ owner, use }));
12
+ },
13
+ });
@@ -0,0 +1,20 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { monthStartStr, resolveGroupId, statsRankText } from '../../src/stats-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '查看本月话唠排行',
9
+ execute({ config, input, owner, use }) {
10
+ const groupId = resolveGroupId(input ?? {});
11
+ const title = groupId ? '本月话唠排行' : '全局话唠排行';
12
+ return statsRankText(
13
+ input ?? {},
14
+ resolveGroupSuiteConfig(config),
15
+ monthStartStr(),
16
+ title,
17
+ resolveGroupSuiteRuntime({ owner, use }),
18
+ );
19
+ },
20
+ });
@@ -0,0 +1,13 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { resolveGroupId, statsRankText, weekStartStr } from "../../lib/stats-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '查看本周消息统计',
8
+ execute({ config, input, owner, use }) {
9
+ const groupId = resolveGroupId(input ?? {});
10
+ const title = groupId ? '本周本群消息统计' : '本周全局消息统计';
11
+ return statsRankText(input ?? {}, resolveGroupSuiteConfig(config), weekStartStr(), title, resolveGroupSuiteRuntime({ owner, use }));
12
+ },
13
+ });
@@ -0,0 +1,20 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { resolveGroupId, statsRankText, weekStartStr } from '../../src/stats-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '查看本周消息统计',
9
+ execute({ config, input, owner, use }) {
10
+ const groupId = resolveGroupId(input ?? {});
11
+ const title = groupId ? '本周本群消息统计' : '本周全局消息统计';
12
+ return statsRankText(
13
+ input ?? {},
14
+ resolveGroupSuiteConfig(config),
15
+ weekStartStr(),
16
+ title,
17
+ resolveGroupSuiteRuntime({ owner, use }),
18
+ );
19
+ },
20
+ });
@@ -0,0 +1,11 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { teachAdd } from "../../lib/teach-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '教我问答(teach 问题 回答 或 问题|答案)',
8
+ execute({ config, input, args, owner, use }) {
9
+ return teachAdd(input ?? {}, resolveGroupSuiteConfig(config), args.join(' '), false, resolveGroupSuiteRuntime({ owner, use }));
10
+ },
11
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { teachAdd } from '../../src/teach-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '教我问答(teach 问题 回答 或 问题|答案)',
9
+ execute({ config, input, args, owner, use }) {
10
+ return teachAdd(input ?? {}, resolveGroupSuiteConfig(config), args.join(' '), false, resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,13 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../../lib/config.js";
4
+ import { teachList } from "../../../lib/teach-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '查看问答列表',
8
+ params: { page: { type: 'number', default: 1 } },
9
+ execute({ config, input, params, owner, use }) {
10
+ const page = Number(params.page ?? 1);
11
+ return teachList(input ?? {}, resolveGroupSuiteConfig(config), page, resolveGroupSuiteRuntime({ owner, use }));
12
+ },
13
+ });
@@ -0,0 +1,14 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../../src/config.js';
4
+ import { teachList } from '../../../src/teach-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '查看问答列表',
9
+ params: { page: { type: 'number', default: 1 } },
10
+ execute({ config, input, params, owner, use }) {
11
+ const page = Number(params.page ?? 1);
12
+ return teachList(input ?? {}, resolveGroupSuiteConfig(config), page, resolveGroupSuiteRuntime({ owner, use }));
13
+ },
14
+ });
@@ -0,0 +1,11 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { defineCommand } from 'zhin.js/command';
3
+ import { resolveGroupSuiteConfig } from "../../lib/config.js";
4
+ import { teachAdd } from "../../lib/teach-lib.js";
5
+ import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
6
+ export default defineCommand({
7
+ description: '教我正则问答',
8
+ execute({ config, input, args, owner, use }) {
9
+ return teachAdd(input ?? {}, resolveGroupSuiteConfig(config), args.join(' '), true, resolveGroupSuiteRuntime({ owner, use }));
10
+ },
11
+ });
@@ -0,0 +1,12 @@
1
+ import { defineCommand } from 'zhin.js/command';
2
+ import type { Message } from '@zhin.js/core/runtime';
3
+ import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
4
+ import { teachAdd } from '../../src/teach-lib.js';
5
+ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
6
+
7
+ export default defineCommand<GroupSuiteConfig, string, Message>({
8
+ description: '教我正则问答',
9
+ execute({ config, input, args, owner, use }) {
10
+ return teachAdd(input ?? {}, resolveGroupSuiteConfig(config), args.join(' '), true, resolveGroupSuiteRuntime({ owner, use }));
11
+ },
12
+ });
@@ -0,0 +1,27 @@
1
+ import type { GroupSuiteConfig } from './config.js';
2
+ import type { GroupSuiteRuntime } from './runtime-state.js';
3
+ export declare function doCheckin(input: {
4
+ sender?: {
5
+ readonly id: string;
6
+ readonly name?: string;
7
+ };
8
+ target?: string;
9
+ metadata?: Readonly<Record<string, unknown>>;
10
+ }, cfg: GroupSuiteConfig, runtime: GroupSuiteRuntime): Promise<string>;
11
+ export declare function myPoints(input: {
12
+ sender?: {
13
+ readonly id: string;
14
+ readonly name?: string;
15
+ };
16
+ target?: string;
17
+ metadata?: Readonly<Record<string, unknown>>;
18
+ }, runtime: GroupSuiteRuntime): Promise<string>;
19
+ export declare function pointsRank(input: {
20
+ sender?: {
21
+ readonly id: string;
22
+ readonly name?: string;
23
+ };
24
+ target?: string;
25
+ metadata?: Readonly<Record<string, unknown>>;
26
+ }, cfg: GroupSuiteConfig, runtime: GroupSuiteRuntime): Promise<string>;
27
+ //# sourceMappingURL=checkin-lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkin-lib.d.ts","sourceRoot":"","sources":["../src/checkin-lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAUpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAuD5D,wBAAsB,SAAS,CAC7B,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,EAClI,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAED,wBAAsB,QAAQ,CAC5B,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,EAClI,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,EAClI,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CAsBjB"}