@zhin.js/plugin-group-suite 1.1.14 → 1.1.16
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/README.md +12 -0
- package/commands/checkin/index.js +3 -3
- package/commands/checkin/index.ts +3 -3
- package/commands/forget/index.js +3 -3
- package/commands/forget/index.ts +3 -3
- package/commands/keyword-add/[keyword]/index.js +4 -3
- package/commands/keyword-add/[keyword]/index.ts +4 -3
- package/commands/keyword-list/index.js +4 -3
- package/commands/keyword-list/index.ts +4 -3
- package/commands/keyword-remove/[keyword]/index.js +5 -4
- package/commands/keyword-remove/[keyword]/index.ts +5 -4
- package/commands/mypoints/index.js +3 -3
- package/commands/mypoints/index.ts +3 -3
- package/commands/mystats/index.js +3 -3
- package/commands/mystats/index.ts +3 -3
- package/commands/rank/index.js +3 -3
- package/commands/rank/index.ts +3 -3
- package/commands/stats/index.js +6 -5
- package/commands/stats/index.ts +6 -5
- package/commands/stats-card/index.js +4 -3
- package/commands/stats-card/index.ts +4 -3
- package/commands/stats-rank/index.js +6 -5
- package/commands/stats-rank/index.ts +6 -5
- package/commands/stats-week/index.js +6 -5
- package/commands/stats-week/index.ts +6 -5
- package/commands/teach/index.js +3 -3
- package/commands/teach/index.ts +3 -3
- package/commands/teach-list/[[page]]/index.js +3 -3
- package/commands/teach-list/[[page]]/index.ts +3 -3
- package/commands/teach-regex/index.js +3 -3
- package/commands/teach-regex/index.ts +3 -3
- package/handlers/welcome/index.js +9 -1
- package/handlers/welcome/index.ts +8 -1
- package/lib/analysis-card.d.ts +1 -1
- package/lib/analysis-card.d.ts.map +1 -1
- package/lib/analysis-card.js +12 -11
- package/lib/analysis-card.js.map +1 -1
- package/lib/analysis.d.ts +2 -2
- package/lib/analysis.d.ts.map +1 -1
- package/lib/analysis.js +14 -20
- package/lib/analysis.js.map +1 -1
- package/lib/checkin-lib.d.ts +1 -1
- package/lib/checkin-lib.d.ts.map +1 -1
- package/lib/checkin-lib.js +23 -22
- package/lib/checkin-lib.js.map +1 -1
- package/lib/conversation-scope.d.ts +1 -0
- package/lib/conversation-scope.d.ts.map +1 -1
- package/lib/conversation-scope.js.map +1 -1
- package/lib/i18n.d.ts +2 -0
- package/lib/i18n.d.ts.map +1 -0
- package/lib/i18n.js +480 -0
- package/lib/i18n.js.map +1 -0
- package/lib/keywords.d.ts +1 -0
- package/lib/keywords.d.ts.map +1 -1
- package/lib/keywords.js +8 -7
- package/lib/keywords.js.map +1 -1
- package/lib/shared-runtime.d.ts +1 -0
- package/lib/shared-runtime.d.ts.map +1 -1
- package/lib/shared-runtime.js +2 -1
- package/lib/shared-runtime.js.map +1 -1
- package/lib/stats-card.d.ts +2 -2
- package/lib/stats-card.d.ts.map +1 -1
- package/lib/stats-card.js +15 -14
- package/lib/stats-card.js.map +1 -1
- package/lib/stats-data.d.ts +3 -2
- package/lib/stats-data.d.ts.map +1 -1
- package/lib/stats-data.js +13 -12
- package/lib/stats-data.js.map +1 -1
- package/lib/stats-lib.d.ts.map +1 -1
- package/lib/stats-lib.js +8 -7
- package/lib/stats-lib.js.map +1 -1
- package/lib/teach-lib.d.ts +1 -1
- package/lib/teach-lib.d.ts.map +1 -1
- package/lib/teach-lib.js +27 -26
- package/lib/teach-lib.js.map +1 -1
- package/package.json +12 -12
- package/skills/checkin/tools/checkin_query/index.js +5 -4
- package/skills/checkin/tools/checkin_query/index.ts +5 -4
- package/skills/checkin/tools/checkin_rank/index.js +4 -3
- package/skills/checkin/tools/checkin_rank/index.ts +4 -3
- package/skills/group-daily-analysis/tools/group_announce/index.js +3 -2
- package/skills/group-daily-analysis/tools/group_announce/index.ts +3 -2
- package/skills/group-daily-analysis/tools/stats_query/index.js +4 -3
- package/skills/group-daily-analysis/tools/stats_query/index.ts +4 -3
- package/skills/group-daily-analysis/tools/stats_user/index.js +4 -3
- package/skills/group-daily-analysis/tools/stats_user/index.ts +4 -3
- package/src/analysis-card.ts +13 -11
- package/src/analysis.ts +15 -13
- package/src/checkin-lib.ts +23 -21
- package/src/conversation-scope.ts +1 -0
- package/src/i18n.ts +480 -0
- package/src/keywords.ts +9 -7
- package/src/shared-runtime.ts +3 -1
- package/src/stats-card.ts +17 -16
- package/src/stats-data.ts +14 -12
- package/src/stats-lib.ts +8 -7
- package/src/teach-lib.ts +27 -26
package/README.md
CHANGED
|
@@ -105,6 +105,12 @@ group-suite:
|
|
|
105
105
|
`null`、空 ID、残缺父容器和额外字段会被拒绝。重复条目不会重复发送欢迎。
|
|
106
106
|
白名单只筛选入站群成员加入事件,不改写原会话投递目标,也不限制签到、词库、统计等能力。
|
|
107
107
|
|
|
108
|
+
同一群若开启了 Agent 会话欢迎(ADR 0037 切片 A 的 `welcome.enabled`),本插件让路不发,
|
|
109
|
+
由会话欢迎发唯一一条(合并窗口、小时上限、控制面、session-gate 都按会话欢迎走;`mention_only` 不拦欢迎)。
|
|
110
|
+
两边同时开启也不会双发;未装 Agent 或会话未开启时本插件照常发送。
|
|
111
|
+
见[群欢迎指南](https://github.com/zhinjs/zhin/blob/main/docs/solutions/group-welcome.md)「与 Agent 会话欢迎的关系」。
|
|
112
|
+
成员退群时本插件不发送消息。
|
|
113
|
+
|
|
108
114
|
这不补充平台本身缺少的入站事件或目标:未提供 canonical 群会话的成员加入事件不会发送欢迎,
|
|
109
115
|
也不会推测频道。配置可热更新,校验失败保留旧配置与 generation;没有单独的范围数据库。
|
|
110
116
|
|
|
@@ -128,3 +134,9 @@ pnpm --filter @zhin.js/plugin-group-suite test
|
|
|
128
134
|
无数据库错误、热更新、配置失败回滚及新进程重启后的持久词库。HTML 渲染使用 stub,另测文本
|
|
129
135
|
降级;统计/签到/教学模型在此 fixture 为内存端口。它不代表真实平台登录、欢迎投递、截图质量或
|
|
130
136
|
生产数据库端到端验收;实机操作需要单独授权。
|
|
137
|
+
|
|
138
|
+
## 语言
|
|
139
|
+
|
|
140
|
+
签到、积分、问答管理、关键词管理与消息统计根据当前发送者语言显示中文或英文;统计图卡及统一发送链的文本降级使用同一语言。AI Tool 反馈使用可信调用上下文中的语言。
|
|
141
|
+
|
|
142
|
+
自定义欢迎语、词库回答、用户昵称和分析得到的内容保持原文;问答模板的日期与时间仅使用当前语言格式化,不改变既有时区。命令路径、别名、权限与统计范围不变。签到提示使用当前环境真实命令前缀和命名空间;无法确定调用头时只提示入口,不猜测命令。
|
|
@@ -4,9 +4,9 @@ import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
|
4
4
|
import { doCheckin } from "../../lib/checkin-lib.js";
|
|
5
5
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
6
6
|
export default defineCommand({
|
|
7
|
-
description: '每日签到获得积分',
|
|
7
|
+
description: '每日签到获得积分', descriptionI18n: { en: "Check in daily to earn points" },
|
|
8
8
|
alias: ['checkin do', '签到'],
|
|
9
|
-
execute({ config, input, owner, use }) {
|
|
10
|
-
return doCheckin(input
|
|
9
|
+
execute({ config, input, owner, use, locale }) {
|
|
10
|
+
return doCheckin({ ...input, locale }, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
|
|
11
11
|
},
|
|
12
12
|
});
|
|
@@ -5,9 +5,9 @@ import { doCheckin } from '../../src/checkin-lib.js';
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '每日签到获得积分',
|
|
8
|
+
description: '每日签到获得积分', descriptionI18n: { en: "Check in daily to earn points" },
|
|
9
9
|
alias: ['checkin do', '签到'],
|
|
10
|
-
execute({ config, input, owner, use }) {
|
|
11
|
-
return doCheckin(input
|
|
10
|
+
execute({ config, input, owner, use, locale }) {
|
|
11
|
+
return doCheckin({ ...input, locale }, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
|
|
12
12
|
},
|
|
13
13
|
});
|
package/commands/forget/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { teachForget } from "../../lib/teach-lib.js";
|
|
|
4
4
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
5
5
|
export default defineCommand({
|
|
6
6
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
7
|
-
description: '忘记问答(删除问答对)',
|
|
8
|
-
execute({ input, args, owner, use }) {
|
|
9
|
-
return teachForget(input
|
|
7
|
+
description: '忘记问答(删除问答对)', descriptionI18n: { en: "Delete a learned question and answer pair" },
|
|
8
|
+
execute({ input, args, owner, use, locale }) {
|
|
9
|
+
return teachForget({ ...input, locale }, args.join(' '), resolveGroupSuiteRuntime({ owner, use }));
|
|
10
10
|
},
|
|
11
11
|
});
|
package/commands/forget/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
8
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
9
|
-
description: '忘记问答(删除问答对)',
|
|
10
|
-
execute({ input, args, owner, use }) {
|
|
11
|
-
return teachForget(input
|
|
9
|
+
description: '忘记问答(删除问答对)', descriptionI18n: { en: "Delete a learned question and answer pair" },
|
|
10
|
+
execute({ input, args, owner, use, locale }) {
|
|
11
|
+
return teachForget({ ...input, locale }, args.join(' '), resolveGroupSuiteRuntime({ owner, use }));
|
|
12
12
|
},
|
|
13
13
|
});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { keywordsForCommand } from "../../../lib/keywords.js";
|
|
4
5
|
export default defineCommand({
|
|
5
6
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
6
|
-
description: '添加当前群关键词自动回复',
|
|
7
|
+
description: '添加当前群关键词自动回复', descriptionI18n: { en: "Add a keyword reply in this group" },
|
|
7
8
|
params: { keyword: { type: 'string' } },
|
|
8
9
|
async execute(context) {
|
|
9
10
|
const keyword = String(context.params.keyword ?? '');
|
|
10
11
|
const reply = context.args.join(' ').trim();
|
|
11
12
|
if (!keyword || !reply)
|
|
12
|
-
return '
|
|
13
|
+
return t(context.locale, 'keywordRequired');
|
|
13
14
|
const repository = keywordsForCommand(context.input, context);
|
|
14
15
|
if (typeof repository === 'string')
|
|
15
16
|
return repository;
|
|
16
17
|
await repository.update(store => { store.set(keyword, reply); });
|
|
17
|
-
return
|
|
18
|
+
return t(context.locale, 'keywordAdded', { keyword, reply });
|
|
18
19
|
},
|
|
19
20
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import type { Message } from '@zhin.js/core/runtime';
|
|
3
4
|
import type { GroupSuiteConfig } from '../../../src/config.js';
|
|
@@ -5,15 +6,15 @@ import { keywordsForCommand } from '../../../src/keywords.js';
|
|
|
5
6
|
|
|
6
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
7
8
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
8
|
-
description: '添加当前群关键词自动回复',
|
|
9
|
+
description: '添加当前群关键词自动回复', descriptionI18n: { en: "Add a keyword reply in this group" },
|
|
9
10
|
params: { keyword: { type: 'string' } },
|
|
10
11
|
async execute(context) {
|
|
11
12
|
const keyword = String(context.params.keyword ?? '');
|
|
12
13
|
const reply = context.args.join(' ').trim();
|
|
13
|
-
if (!keyword || !reply) return '
|
|
14
|
+
if (!keyword || !reply) return t(context.locale, 'keywordRequired');
|
|
14
15
|
const repository = keywordsForCommand(context.input, context);
|
|
15
16
|
if (typeof repository === 'string') return repository;
|
|
16
17
|
await repository.update(store => { store.set(keyword, reply); });
|
|
17
|
-
return
|
|
18
|
+
return t(context.locale, 'keywordAdded', { keyword, reply });
|
|
18
19
|
},
|
|
19
20
|
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { keywordsForCommand } from "../../lib/keywords.js";
|
|
4
5
|
export default defineCommand({
|
|
5
6
|
permit: ['group()'],
|
|
6
|
-
description: '查看当前群关键词回复对',
|
|
7
|
+
description: '查看当前群关键词回复对', descriptionI18n: { en: "List this group's keyword replies" },
|
|
7
8
|
async execute(context) {
|
|
8
9
|
const repository = keywordsForCommand(context.input, context);
|
|
9
10
|
if (typeof repository === 'string')
|
|
10
11
|
return repository;
|
|
11
12
|
const entries = await repository.read();
|
|
12
13
|
if (entries.length === 0)
|
|
13
|
-
return '
|
|
14
|
+
return t(context.locale, 'keywordEmpty');
|
|
14
15
|
const lines = entries.map(([k, v], i) => `${i + 1}. 「${k}」→「${v}」`);
|
|
15
|
-
return
|
|
16
|
+
return t(context.locale, 'keywordList', { count: entries.length, lines: lines.join('\n') });
|
|
16
17
|
},
|
|
17
18
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import type { Message } from '@zhin.js/core/runtime';
|
|
3
4
|
import type { GroupSuiteConfig } from '../../src/config.js';
|
|
@@ -5,13 +6,13 @@ import { keywordsForCommand } from '../../src/keywords.js';
|
|
|
5
6
|
|
|
6
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
7
8
|
permit: ['group()'],
|
|
8
|
-
description: '查看当前群关键词回复对',
|
|
9
|
+
description: '查看当前群关键词回复对', descriptionI18n: { en: "List this group's keyword replies" },
|
|
9
10
|
async execute(context) {
|
|
10
11
|
const repository = keywordsForCommand(context.input, context);
|
|
11
12
|
if (typeof repository === 'string') return repository;
|
|
12
13
|
const entries = await repository.read();
|
|
13
|
-
if (entries.length === 0) return '
|
|
14
|
+
if (entries.length === 0) return t(context.locale, 'keywordEmpty');
|
|
14
15
|
const lines = entries.map(([k, v], i) => `${i + 1}. 「${k}」→「${v}」`);
|
|
15
|
-
return
|
|
16
|
+
return t(context.locale, 'keywordList', { count: entries.length, lines: lines.join('\n') });
|
|
16
17
|
},
|
|
17
18
|
});
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { keywordsForCommand } from "../../../lib/keywords.js";
|
|
4
5
|
export default defineCommand({
|
|
5
6
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
6
|
-
description: '删除当前群关键词自动回复',
|
|
7
|
+
description: '删除当前群关键词自动回复', descriptionI18n: { en: "Delete a keyword reply in this group" },
|
|
7
8
|
params: { keyword: { type: 'string' } },
|
|
8
9
|
async execute(context) {
|
|
9
10
|
const keyword = String(context.params.keyword ?? '');
|
|
10
11
|
if (!keyword)
|
|
11
|
-
return '
|
|
12
|
+
return t(context.locale, 'keywordRemoveRequired');
|
|
12
13
|
const repository = keywordsForCommand(context.input, context);
|
|
13
14
|
if (typeof repository === 'string')
|
|
14
15
|
return repository;
|
|
15
16
|
if (!(await repository.read()).some(([entry]) => entry === keyword))
|
|
16
|
-
return
|
|
17
|
+
return t(context.locale, 'keywordMissing', { keyword });
|
|
17
18
|
await repository.update(store => { store.delete(keyword); });
|
|
18
|
-
return
|
|
19
|
+
return t(context.locale, 'keywordRemoved', { keyword });
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import type { Message } from '@zhin.js/core/runtime';
|
|
3
4
|
import type { GroupSuiteConfig } from '../../../src/config.js';
|
|
@@ -5,15 +6,15 @@ import { keywordsForCommand } from '../../../src/keywords.js';
|
|
|
5
6
|
|
|
6
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
7
8
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
8
|
-
description: '删除当前群关键词自动回复',
|
|
9
|
+
description: '删除当前群关键词自动回复', descriptionI18n: { en: "Delete a keyword reply in this group" },
|
|
9
10
|
params: { keyword: { type: 'string' } },
|
|
10
11
|
async execute(context) {
|
|
11
12
|
const keyword = String(context.params.keyword ?? '');
|
|
12
|
-
if (!keyword) return '
|
|
13
|
+
if (!keyword) return t(context.locale, 'keywordRemoveRequired');
|
|
13
14
|
const repository = keywordsForCommand(context.input, context);
|
|
14
15
|
if (typeof repository === 'string') return repository;
|
|
15
|
-
if (!(await repository.read()).some(([entry]) => entry === keyword)) return
|
|
16
|
+
if (!(await repository.read()).some(([entry]) => entry === keyword)) return t(context.locale, 'keywordMissing', { keyword });
|
|
16
17
|
await repository.update(store => { store.delete(keyword); });
|
|
17
|
-
return
|
|
18
|
+
return t(context.locale, 'keywordRemoved', { keyword });
|
|
18
19
|
},
|
|
19
20
|
});
|
|
@@ -3,9 +3,9 @@ import { defineCommand } from 'zhin.js/command';
|
|
|
3
3
|
import { myPoints } from "../../lib/checkin-lib.js";
|
|
4
4
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
5
5
|
export default defineCommand({
|
|
6
|
-
description: '查看个人积分与签到信息',
|
|
6
|
+
description: '查看个人积分与签到信息', descriptionI18n: { en: "View your points and daily check-in" },
|
|
7
7
|
alias: ['checkin streak'],
|
|
8
|
-
execute({ input, owner, use }) {
|
|
9
|
-
return myPoints(input
|
|
8
|
+
execute({ input, owner, use, locale, formatCommand }) {
|
|
9
|
+
return myPoints({ ...input, locale }, resolveGroupSuiteRuntime({ owner, use }), formatCommand?.('checkin'));
|
|
10
10
|
},
|
|
11
11
|
});
|
|
@@ -5,9 +5,9 @@ import { myPoints } from '../../src/checkin-lib.js';
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '查看个人积分与签到信息',
|
|
8
|
+
description: '查看个人积分与签到信息', descriptionI18n: { en: "View your points and daily check-in" },
|
|
9
9
|
alias: ['checkin streak'],
|
|
10
|
-
execute({ input, owner, use }) {
|
|
11
|
-
return myPoints(input
|
|
10
|
+
execute({ input, owner, use, locale, formatCommand }) {
|
|
11
|
+
return myPoints({ ...input, locale }, resolveGroupSuiteRuntime({ owner, use }), formatCommand?.('checkin'));
|
|
12
12
|
},
|
|
13
13
|
});
|
|
@@ -3,8 +3,8 @@ import { defineCommand } from 'zhin.js/command';
|
|
|
3
3
|
import { myStatsText } from "../../lib/stats-lib.js";
|
|
4
4
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
5
5
|
export default defineCommand({
|
|
6
|
-
description: '查看个人消息统计',
|
|
7
|
-
execute({ input, owner, use }) {
|
|
8
|
-
return myStatsText(input
|
|
6
|
+
description: '查看个人消息统计', descriptionI18n: { en: "View your message statistics" },
|
|
7
|
+
execute({ input, owner, use, locale, formatCommand }) {
|
|
8
|
+
return myStatsText({ ...input, locale }, resolveGroupSuiteRuntime({ owner, use }));
|
|
9
9
|
},
|
|
10
10
|
});
|
|
@@ -5,8 +5,8 @@ import { myStatsText } from '../../src/stats-lib.js';
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '查看个人消息统计',
|
|
9
|
-
execute({ input, owner, use }) {
|
|
10
|
-
return myStatsText(input
|
|
8
|
+
description: '查看个人消息统计', descriptionI18n: { en: "View your message statistics" },
|
|
9
|
+
execute({ input, owner, use, locale, formatCommand }) {
|
|
10
|
+
return myStatsText({ ...input, locale }, resolveGroupSuiteRuntime({ owner, use }));
|
|
11
11
|
},
|
|
12
12
|
});
|
package/commands/rank/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
|
4
4
|
import { pointsRank } from "../../lib/checkin-lib.js";
|
|
5
5
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
6
6
|
export default defineCommand({
|
|
7
|
-
description: '查看积分排行榜',
|
|
7
|
+
description: '查看积分排行榜', descriptionI18n: { en: "View the points leaderboard" },
|
|
8
8
|
alias: ['checkin rank'],
|
|
9
|
-
execute({ config, input, owner, use }) {
|
|
10
|
-
return pointsRank(input
|
|
9
|
+
execute({ config, input, owner, use, locale }) {
|
|
10
|
+
return pointsRank({ ...input, locale }, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
|
|
11
11
|
},
|
|
12
12
|
});
|
package/commands/rank/index.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { pointsRank } from '../../src/checkin-lib.js';
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '查看积分排行榜',
|
|
8
|
+
description: '查看积分排行榜', descriptionI18n: { en: "View the points leaderboard" },
|
|
9
9
|
alias: ['checkin rank'],
|
|
10
|
-
execute({ config, input, owner, use }) {
|
|
11
|
-
return pointsRank(input
|
|
10
|
+
execute({ config, input, owner, use, locale }) {
|
|
11
|
+
return pointsRank({ ...input, locale }, resolveGroupSuiteConfig(config), resolveGroupSuiteRuntime({ owner, use }));
|
|
12
12
|
},
|
|
13
13
|
});
|
package/commands/stats/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
4
5
|
import { todayStr } from "../../lib/shared-runtime.js";
|
|
5
6
|
import { resolveGroupId, statsRankText } from "../../lib/stats-lib.js";
|
|
6
7
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
7
8
|
export default defineCommand({
|
|
8
|
-
description: '查看今日消息统计',
|
|
9
|
-
execute({ config, input, owner, use }) {
|
|
10
|
-
const groupId = resolveGroupId(input
|
|
11
|
-
const title = groupId ? '
|
|
12
|
-
return statsRankText(input
|
|
9
|
+
description: '查看今日消息统计', descriptionI18n: { en: "View today's message statistics" },
|
|
10
|
+
execute({ config, input, owner, use, locale }) {
|
|
11
|
+
const groupId = resolveGroupId({ ...input, locale });
|
|
12
|
+
const title = groupId ? t(locale, 'statsTodayGroup') : t(locale, 'statsTodayAll');
|
|
13
|
+
return statsRankText({ ...input, locale }, resolveGroupSuiteConfig(config), todayStr(), title, resolveGroupSuiteRuntime({ owner, use }));
|
|
13
14
|
},
|
|
14
15
|
});
|
package/commands/stats/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import type { Message } from '@zhin.js/core/runtime';
|
|
3
4
|
import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
|
|
@@ -6,12 +7,12 @@ import { resolveGroupId, statsRankText } from '../../src/stats-lib.js';
|
|
|
6
7
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
7
8
|
|
|
8
9
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
9
|
-
description: '查看今日消息统计',
|
|
10
|
-
execute({ config, input, owner, use }) {
|
|
11
|
-
const groupId = resolveGroupId(input
|
|
12
|
-
const title = groupId ? '
|
|
10
|
+
description: '查看今日消息统计', descriptionI18n: { en: "View today's message statistics" },
|
|
11
|
+
execute({ config, input, owner, use, locale }) {
|
|
12
|
+
const groupId = resolveGroupId({ ...input, locale });
|
|
13
|
+
const title = groupId ? t(locale, 'statsTodayGroup') : t(locale, 'statsTodayAll');
|
|
13
14
|
return statsRankText(
|
|
14
|
-
input
|
|
15
|
+
{ ...input, locale },
|
|
15
16
|
resolveGroupSuiteConfig(config),
|
|
16
17
|
todayStr(),
|
|
17
18
|
title,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { segment } from 'zhin.js';
|
|
4
5
|
import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
@@ -8,7 +9,7 @@ import { buildStatsRankReportData } from "../../lib/stats-data.js";
|
|
|
8
9
|
import { buildStatsRankHtml, STATS_REPORT_CANVAS } from "../../lib/stats-card.js";
|
|
9
10
|
import { todayStr, resolveSender } from "../../lib/shared-runtime.js";
|
|
10
11
|
export default defineCommand({
|
|
11
|
-
description: '查看今日群消息统计卡片(不支持图片时显示文本)',
|
|
12
|
+
description: '查看今日群消息统计卡片(不支持图片时显示文本)', descriptionI18n: { en: "View today's group statistics card, with a text fallback" },
|
|
12
13
|
permit: ['group()'],
|
|
13
14
|
async execute(context) {
|
|
14
15
|
if (!context.input)
|
|
@@ -16,8 +17,8 @@ export default defineCommand({
|
|
|
16
17
|
const runtime = resolveGroupSuiteRuntime(context);
|
|
17
18
|
await flushStatsBuffer(runtime);
|
|
18
19
|
const stats = await queryStats(resolveGroupId(context.input), todayStr(), runtime);
|
|
19
|
-
const data = buildStatsRankReportData(stats, '
|
|
20
|
-
return segment.html({ html: await buildStatsRankHtml(data), width: 540,
|
|
20
|
+
const data = buildStatsRankReportData(stats, t(context.locale, 'statsTodayGroup'), resolveGroupSuiteConfig(context.config).rankSize, resolveSender(context.input).id);
|
|
21
|
+
return segment.html({ html: await buildStatsRankHtml(data, context.locale), width: 540,
|
|
21
22
|
backgroundColor: STATS_REPORT_CANVAS, fileName: 'group-stats.png' });
|
|
22
23
|
},
|
|
23
24
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import { segment } from 'zhin.js';
|
|
3
4
|
import type { Message, SendContent } from '@zhin.js/core/runtime';
|
|
@@ -9,16 +10,16 @@ import { buildStatsRankHtml, STATS_REPORT_CANVAS } from '../../src/stats-card.js
|
|
|
9
10
|
import { todayStr, resolveSender } from '../../src/shared-runtime.js';
|
|
10
11
|
|
|
11
12
|
export default defineCommand<GroupSuiteConfig, SendContent, Message>({
|
|
12
|
-
description: '查看今日群消息统计卡片(不支持图片时显示文本)',
|
|
13
|
+
description: '查看今日群消息统计卡片(不支持图片时显示文本)', descriptionI18n: { en: "View today's group statistics card, with a text fallback" },
|
|
13
14
|
permit: ['group()'],
|
|
14
15
|
async execute(context) {
|
|
15
16
|
if (!context.input) throw new Error('Group statistics require an incoming message');
|
|
16
17
|
const runtime = resolveGroupSuiteRuntime(context);
|
|
17
18
|
await flushStatsBuffer(runtime);
|
|
18
19
|
const stats = await queryStats(resolveGroupId(context.input), todayStr(), runtime);
|
|
19
|
-
const data = buildStatsRankReportData(stats, '
|
|
20
|
+
const data = buildStatsRankReportData(stats, t(context.locale, 'statsTodayGroup'),
|
|
20
21
|
resolveGroupSuiteConfig(context.config).rankSize, resolveSender(context.input).id);
|
|
21
|
-
return segment.html({ html: await buildStatsRankHtml(data), width: 540,
|
|
22
|
+
return segment.html({ html: await buildStatsRankHtml(data, context.locale), width: 540,
|
|
22
23
|
backgroundColor: STATS_REPORT_CANVAS, fileName: 'group-stats.png' });
|
|
23
24
|
},
|
|
24
25
|
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
4
5
|
import { monthStartStr, resolveGroupId, statsRankText } from "../../lib/stats-lib.js";
|
|
5
6
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '查看本月话唠排行',
|
|
8
|
-
execute({ config, input, owner, use }) {
|
|
9
|
-
const groupId = resolveGroupId(input
|
|
10
|
-
const title = groupId ? '
|
|
11
|
-
return statsRankText(input
|
|
8
|
+
description: '查看本月话唠排行', descriptionI18n: { en: "View this month's most active members" },
|
|
9
|
+
execute({ config, input, owner, use, locale }) {
|
|
10
|
+
const groupId = resolveGroupId({ ...input, locale });
|
|
11
|
+
const title = groupId ? t(locale, 'statsMonthGroup') : t(locale, 'statsMonthAll');
|
|
12
|
+
return statsRankText({ ...input, locale }, resolveGroupSuiteConfig(config), monthStartStr(), title, resolveGroupSuiteRuntime({ owner, use }));
|
|
12
13
|
},
|
|
13
14
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import type { Message } from '@zhin.js/core/runtime';
|
|
3
4
|
import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
|
|
@@ -5,12 +6,12 @@ import { monthStartStr, resolveGroupId, statsRankText } from '../../src/stats-li
|
|
|
5
6
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
6
7
|
|
|
7
8
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '查看本月话唠排行',
|
|
9
|
-
execute({ config, input, owner, use }) {
|
|
10
|
-
const groupId = resolveGroupId(input
|
|
11
|
-
const title = groupId ? '
|
|
9
|
+
description: '查看本月话唠排行', descriptionI18n: { en: "View this month's most active members" },
|
|
10
|
+
execute({ config, input, owner, use, locale }) {
|
|
11
|
+
const groupId = resolveGroupId({ ...input, locale });
|
|
12
|
+
const title = groupId ? t(locale, 'statsMonthGroup') : t(locale, 'statsMonthAll');
|
|
12
13
|
return statsRankText(
|
|
13
|
-
input
|
|
14
|
+
{ ...input, locale },
|
|
14
15
|
resolveGroupSuiteConfig(config),
|
|
15
16
|
monthStartStr(),
|
|
16
17
|
title,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
4
5
|
import { resolveGroupId, statsRankText, weekStartStr } from "../../lib/stats-lib.js";
|
|
5
6
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '查看本周消息统计',
|
|
8
|
-
execute({ config, input, owner, use }) {
|
|
9
|
-
const groupId = resolveGroupId(input
|
|
10
|
-
const title = groupId ? '
|
|
11
|
-
return statsRankText(input
|
|
8
|
+
description: '查看本周消息统计', descriptionI18n: { en: "View this week's message statistics" },
|
|
9
|
+
execute({ config, input, owner, use, locale }) {
|
|
10
|
+
const groupId = resolveGroupId({ ...input, locale });
|
|
11
|
+
const title = groupId ? t(locale, 'statsWeekGroup') : t(locale, 'statsWeekAll');
|
|
12
|
+
return statsRankText({ ...input, locale }, resolveGroupSuiteConfig(config), weekStartStr(), title, resolveGroupSuiteRuntime({ owner, use }));
|
|
12
13
|
},
|
|
13
14
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from '../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import type { Message } from '@zhin.js/core/runtime';
|
|
3
4
|
import { resolveGroupSuiteConfig, type GroupSuiteConfig } from '../../src/config.js';
|
|
@@ -5,12 +6,12 @@ import { resolveGroupId, statsRankText, weekStartStr } from '../../src/stats-lib
|
|
|
5
6
|
import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
6
7
|
|
|
7
8
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '查看本周消息统计',
|
|
9
|
-
execute({ config, input, owner, use }) {
|
|
10
|
-
const groupId = resolveGroupId(input
|
|
11
|
-
const title = groupId ? '
|
|
9
|
+
description: '查看本周消息统计', descriptionI18n: { en: "View this week's message statistics" },
|
|
10
|
+
execute({ config, input, owner, use, locale }) {
|
|
11
|
+
const groupId = resolveGroupId({ ...input, locale });
|
|
12
|
+
const title = groupId ? t(locale, 'statsWeekGroup') : t(locale, 'statsWeekAll');
|
|
12
13
|
return statsRankText(
|
|
13
|
-
input
|
|
14
|
+
{ ...input, locale },
|
|
14
15
|
resolveGroupSuiteConfig(config),
|
|
15
16
|
weekStartStr(),
|
|
16
17
|
title,
|
package/commands/teach/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { teachAdd } from "../../lib/teach-lib.js";
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
8
|
-
description: '教我问答(teach 问题 回答 或 问题|答案)',
|
|
9
|
-
execute({ config, input, args, owner, use }) {
|
|
10
|
-
return teachAdd(input
|
|
8
|
+
description: '教我问答(teach 问题 回答 或 问题|答案)', descriptionI18n: { en: "Teach a question and answer pair" },
|
|
9
|
+
execute({ config, input, args, owner, use, locale }) {
|
|
10
|
+
return teachAdd({ ...input, locale }, resolveGroupSuiteConfig(config), args.join(' '), false, resolveGroupSuiteRuntime({ owner, use }));
|
|
11
11
|
},
|
|
12
12
|
});
|
package/commands/teach/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
8
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
9
|
-
description: '教我问答(teach 问题 回答 或 问题|答案)',
|
|
10
|
-
execute({ config, input, args, owner, use }) {
|
|
11
|
-
return teachAdd(input
|
|
9
|
+
description: '教我问答(teach 问题 回答 或 问题|答案)', descriptionI18n: { en: "Teach a question and answer pair" },
|
|
10
|
+
execute({ config, input, args, owner, use, locale }) {
|
|
11
|
+
return teachAdd({ ...input, locale }, resolveGroupSuiteConfig(config), args.join(' '), false, resolveGroupSuiteRuntime({ owner, use }));
|
|
12
12
|
},
|
|
13
13
|
});
|
|
@@ -4,10 +4,10 @@ import { resolveGroupSuiteConfig } from "../../../lib/config.js";
|
|
|
4
4
|
import { teachList } from "../../../lib/teach-lib.js";
|
|
5
5
|
import { resolveGroupSuiteRuntime } from "../../../lib/runtime-state.js";
|
|
6
6
|
export default defineCommand({
|
|
7
|
-
description: '查看问答列表',
|
|
7
|
+
description: '查看问答列表', descriptionI18n: { en: "List learned questions and answers" },
|
|
8
8
|
params: { page: { type: 'number', default: 1 } },
|
|
9
|
-
execute({ config, input, params, owner, use }) {
|
|
9
|
+
execute({ config, input, params, owner, use, locale }) {
|
|
10
10
|
const page = Number(params.page ?? 1);
|
|
11
|
-
return teachList(input
|
|
11
|
+
return teachList({ ...input, locale }, resolveGroupSuiteConfig(config), page, resolveGroupSuiteRuntime({ owner, use }));
|
|
12
12
|
},
|
|
13
13
|
});
|
|
@@ -5,10 +5,10 @@ import { teachList } from '../../../src/teach-lib.js';
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from '../../../src/runtime-state.js';
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
|
-
description: '查看问答列表',
|
|
8
|
+
description: '查看问答列表', descriptionI18n: { en: "List learned questions and answers" },
|
|
9
9
|
params: { page: { type: 'number', default: 1 } },
|
|
10
|
-
execute({ config, input, params, owner, use }) {
|
|
10
|
+
execute({ config, input, params, owner, use, locale }) {
|
|
11
11
|
const page = Number(params.page ?? 1);
|
|
12
|
-
return teachList(input
|
|
12
|
+
return teachList({ ...input, locale }, resolveGroupSuiteConfig(config), page, resolveGroupSuiteRuntime({ owner, use }));
|
|
13
13
|
},
|
|
14
14
|
});
|
|
@@ -5,8 +5,8 @@ import { teachAdd } from "../../lib/teach-lib.js";
|
|
|
5
5
|
import { resolveGroupSuiteRuntime } from "../../lib/runtime-state.js";
|
|
6
6
|
export default defineCommand({
|
|
7
7
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
8
|
-
description: '教我正则问答',
|
|
9
|
-
execute({ config, input, args, owner, use }) {
|
|
10
|
-
return teachAdd(input
|
|
8
|
+
description: '教我正则问答', descriptionI18n: { en: "Teach a regular-expression question and answer pair" },
|
|
9
|
+
execute({ config, input, args, owner, use, locale }) {
|
|
10
|
+
return teachAdd({ ...input, locale }, resolveGroupSuiteConfig(config), args.join(' '), true, resolveGroupSuiteRuntime({ owner, use }));
|
|
11
11
|
},
|
|
12
12
|
});
|
|
@@ -6,8 +6,8 @@ import { resolveGroupSuiteRuntime } from '../../src/runtime-state.js';
|
|
|
6
6
|
|
|
7
7
|
export default defineCommand<GroupSuiteConfig, string, Message>({
|
|
8
8
|
permit: ['group()', 'role(owner,admin,master,trusted)'],
|
|
9
|
-
description: '教我正则问答',
|
|
10
|
-
execute({ config, input, args, owner, use }) {
|
|
11
|
-
return teachAdd(input
|
|
9
|
+
description: '教我正则问答', descriptionI18n: { en: "Teach a regular-expression question and answer pair" },
|
|
10
|
+
execute({ config, input, args, owner, use, locale }) {
|
|
11
|
+
return teachAdd({ ...input, locale }, resolveGroupSuiteConfig(config), args.join(' '), true, resolveGroupSuiteRuntime({ owner, use }));
|
|
12
12
|
},
|
|
13
13
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { defineHandler } from 'zhin.js/handler';
|
|
3
|
-
import {
|
|
3
|
+
import { hasResource } from 'zhin.js';
|
|
4
|
+
import { memberWelcomeOwnerToken, outboundMessageToken } from '@zhin.js/core/runtime';
|
|
4
5
|
import { resolveGroupSuiteConfig } from "../../lib/config.js";
|
|
5
6
|
import { welcomeConversationAllowed } from "../../lib/welcome-scope.js";
|
|
6
7
|
/** Canonical notice input only; no SDK-specific callbacks or direct platform sends. */
|
|
@@ -14,6 +15,13 @@ export default defineHandler({
|
|
|
14
15
|
return;
|
|
15
16
|
if (!welcomeConversationAllowed(config.welcomeConversations, notice.conversation))
|
|
16
17
|
return;
|
|
18
|
+
// #1012 A9 option 2: once the Agent session welcome (session-ops `welcome.enabled`) owns this
|
|
19
|
+
// conversation, MemberLifecycle sends the single welcome with its own gates; this plugin stays silent.
|
|
20
|
+
if (hasResource(this, memberWelcomeOwnerToken)) {
|
|
21
|
+
const owner = this.use(memberWelcomeOwnerToken);
|
|
22
|
+
if (owner.ownsWelcome(notice.conversation))
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
17
25
|
const content = text.replaceAll('{name}', notice.target.name ?? notice.target.id)
|
|
18
26
|
.replaceAll('{id}', notice.target.id);
|
|
19
27
|
const result = await this.use(outboundMessageToken).send({
|