@zhin.js/adapter-telegram 1.1.15 → 1.1.17
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 +46 -0
- package/agents/telegram/messages.js +52 -0
- package/agents/telegram/messages.ts +52 -0
- package/agents/telegram/skills/telegram-chat-admin/tools/create_invite/index.js +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/create_invite/index.ts +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/member_count/index.js +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/member_count/index.ts +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/pin_message/index.js +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/pin_message/index.ts +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/set_description/index.js +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/set_description/index.ts +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/unpin_message/index.js +2 -1
- package/agents/telegram/skills/telegram-chat-admin/tools/unpin_message/index.ts +2 -1
- package/agents/telegram/skills/telegram-group-permissions/tools/set_permissions/index.js +2 -1
- package/agents/telegram/skills/telegram-group-permissions/tools/set_permissions/index.ts +2 -1
- package/agents/telegram/skills/telegram-messages/tools/react/index.js +2 -1
- package/agents/telegram/skills/telegram-messages/tools/react/index.ts +2 -1
- package/agents/telegram/skills/telegram-messages/tools/send_poll/index.js +4 -3
- package/agents/telegram/skills/telegram-messages/tools/send_poll/index.ts +4 -3
- package/agents/telegram/skills/telegram-messages/tools/send_sticker/index.js +2 -1
- package/agents/telegram/skills/telegram-messages/tools/send_sticker/index.ts +2 -1
- package/package.json +16 -16
- package/schema.json +35 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f67883e]
|
|
8
|
+
- Updated dependencies [e23cabc]
|
|
9
|
+
- Updated dependencies [4d728c0]
|
|
10
|
+
- Updated dependencies [eb8feeb]
|
|
11
|
+
- Updated dependencies [24a2b71]
|
|
12
|
+
- Updated dependencies [d0e1fac]
|
|
13
|
+
- Updated dependencies [1ca669a]
|
|
14
|
+
- Updated dependencies [3771f7a]
|
|
15
|
+
- Updated dependencies [4f96ad5]
|
|
16
|
+
- @zhin.js/core@1.1.52
|
|
17
|
+
- @zhin.js/adapter@1.1.24
|
|
18
|
+
- @zhin.js/tool@1.1.11
|
|
19
|
+
- @zhin.js/host-http@1.1.11
|
|
20
|
+
- @zhin.js/im-contract@1.1.8
|
|
21
|
+
|
|
22
|
+
## 1.1.16
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 53bc6a0: 适配器配置标签、端点命令和工具反馈支持中英文;复用当前操作语言,保持协议值、用户内容、身份、权限与发送链路不变。Sandbox 展示使用项目语言,QQ 绑定与交互状态保留完整会话身份。
|
|
27
|
+
- Updated dependencies [334e92d]
|
|
28
|
+
- Updated dependencies [f3b7c9f]
|
|
29
|
+
- Updated dependencies [658a5fb]
|
|
30
|
+
- Updated dependencies [144a17b]
|
|
31
|
+
- Updated dependencies [18296cf]
|
|
32
|
+
- Updated dependencies [08e64de]
|
|
33
|
+
- Updated dependencies [9cade30]
|
|
34
|
+
- Updated dependencies [53bc6a0]
|
|
35
|
+
- Updated dependencies [7595136]
|
|
36
|
+
- Updated dependencies [66b6404]
|
|
37
|
+
- Updated dependencies [adb4af2]
|
|
38
|
+
- Updated dependencies [69f9ef6]
|
|
39
|
+
- Updated dependencies [17d1301]
|
|
40
|
+
- @zhin.js/adapter@1.1.23
|
|
41
|
+
- @zhin.js/host-http@1.1.10
|
|
42
|
+
- @zhin.js/core@1.1.51
|
|
43
|
+
- @zhin.js/tool@1.1.10
|
|
44
|
+
- @zhin.js/skill@1.1.10
|
|
45
|
+
- @zhin.js/im-contract@1.1.7
|
|
46
|
+
- @zhin.js/agent-feature@1.1.10
|
|
47
|
+
- @zhin.js/feature-kit@1.1.9
|
|
48
|
+
|
|
3
49
|
## 1.1.15
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { createMessages } from 'zhin.js/i18n';
|
|
3
|
+
export const messages = createMessages({
|
|
4
|
+
"inviteLink": {
|
|
5
|
+
"zh-CN": "邀请链接: {p0}",
|
|
6
|
+
"en": "Invite link: {p0}"
|
|
7
|
+
},
|
|
8
|
+
"memberCount": {
|
|
9
|
+
"zh-CN": "群组共有 {p0} 名成员",
|
|
10
|
+
"en": "The group has {p0} members"
|
|
11
|
+
},
|
|
12
|
+
"operationFailed": {
|
|
13
|
+
"zh-CN": "操作失败",
|
|
14
|
+
"en": "Operation failed"
|
|
15
|
+
},
|
|
16
|
+
"pinDone": {
|
|
17
|
+
"zh-CN": "消息已置顶",
|
|
18
|
+
"en": "Message pinned"
|
|
19
|
+
},
|
|
20
|
+
"descriptionUpdated": {
|
|
21
|
+
"zh-CN": "群描述已更新",
|
|
22
|
+
"en": "Group description updated"
|
|
23
|
+
},
|
|
24
|
+
"messageUnpinned": {
|
|
25
|
+
"zh-CN": "已取消置顶",
|
|
26
|
+
"en": "Message unpinned"
|
|
27
|
+
},
|
|
28
|
+
"permissionsUpdated": {
|
|
29
|
+
"zh-CN": "群权限已更新",
|
|
30
|
+
"en": "Group permissions updated"
|
|
31
|
+
},
|
|
32
|
+
"reactionAdded": {
|
|
33
|
+
"zh-CN": "已添加反应 {p0}",
|
|
34
|
+
"en": "Reaction added: {p0}"
|
|
35
|
+
},
|
|
36
|
+
"pollSent": {
|
|
37
|
+
"zh-CN": "投票已发送",
|
|
38
|
+
"en": "Poll sent"
|
|
39
|
+
},
|
|
40
|
+
"pollOptionCount": {
|
|
41
|
+
"zh-CN": "至少需要 2 个选项",
|
|
42
|
+
"en": "At least two options are required"
|
|
43
|
+
},
|
|
44
|
+
"invalidPollOptions": {
|
|
45
|
+
"zh-CN": "options 格式错误,应为 JSON 数组",
|
|
46
|
+
"en": "options must be a JSON array"
|
|
47
|
+
},
|
|
48
|
+
"stickerSent": {
|
|
49
|
+
"zh-CN": "贴纸已发送",
|
|
50
|
+
"en": "Sticker sent"
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createMessages } from 'zhin.js/i18n';
|
|
2
|
+
|
|
3
|
+
export const messages = createMessages({
|
|
4
|
+
"inviteLink": {
|
|
5
|
+
"zh-CN": "邀请链接: {p0}",
|
|
6
|
+
"en": "Invite link: {p0}"
|
|
7
|
+
},
|
|
8
|
+
"memberCount": {
|
|
9
|
+
"zh-CN": "群组共有 {p0} 名成员",
|
|
10
|
+
"en": "The group has {p0} members"
|
|
11
|
+
},
|
|
12
|
+
"operationFailed": {
|
|
13
|
+
"zh-CN": "操作失败",
|
|
14
|
+
"en": "Operation failed"
|
|
15
|
+
},
|
|
16
|
+
"pinDone": {
|
|
17
|
+
"zh-CN": "消息已置顶",
|
|
18
|
+
"en": "Message pinned"
|
|
19
|
+
},
|
|
20
|
+
"descriptionUpdated": {
|
|
21
|
+
"zh-CN": "群描述已更新",
|
|
22
|
+
"en": "Group description updated"
|
|
23
|
+
},
|
|
24
|
+
"messageUnpinned": {
|
|
25
|
+
"zh-CN": "已取消置顶",
|
|
26
|
+
"en": "Message unpinned"
|
|
27
|
+
},
|
|
28
|
+
"permissionsUpdated": {
|
|
29
|
+
"zh-CN": "群权限已更新",
|
|
30
|
+
"en": "Group permissions updated"
|
|
31
|
+
},
|
|
32
|
+
"reactionAdded": {
|
|
33
|
+
"zh-CN": "已添加反应 {p0}",
|
|
34
|
+
"en": "Reaction added: {p0}"
|
|
35
|
+
},
|
|
36
|
+
"pollSent": {
|
|
37
|
+
"zh-CN": "投票已发送",
|
|
38
|
+
"en": "Poll sent"
|
|
39
|
+
},
|
|
40
|
+
"pollOptionCount": {
|
|
41
|
+
"zh-CN": "至少需要 2 个选项",
|
|
42
|
+
"en": "At least two options are required"
|
|
43
|
+
},
|
|
44
|
+
"invalidPollOptions": {
|
|
45
|
+
"zh-CN": "options 格式错误,应为 JSON 数组",
|
|
46
|
+
"en": "options must be a JSON array"
|
|
47
|
+
},
|
|
48
|
+
"stickerSent": {
|
|
49
|
+
"zh-CN": "贴纸已发送",
|
|
50
|
+
"en": "Sticker sent"
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -14,6 +15,6 @@ export default defineAgentTool({
|
|
|
14
15
|
async execute({ chat_id }, context) {
|
|
15
16
|
const endpoint = context.$client;
|
|
16
17
|
const link = await endpoint.createInviteLink(Number(chat_id));
|
|
17
|
-
return { invite_link: link, message:
|
|
18
|
+
return { invite_link: link, message: t(context.locale, 'inviteLink', { p0: link }) };
|
|
18
19
|
},
|
|
19
20
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -14,6 +15,6 @@ export default defineAgentTool<{ chat_id: string }>({
|
|
|
14
15
|
async execute({ chat_id }: { chat_id: string }, context) {
|
|
15
16
|
const endpoint = context.$client;
|
|
16
17
|
const link = await endpoint.createInviteLink(Number(chat_id));
|
|
17
|
-
return { invite_link: link, message:
|
|
18
|
+
return { invite_link: link, message: t(context.locale, 'inviteLink', { p0: link }) };
|
|
18
19
|
},
|
|
19
20
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -12,6 +13,6 @@ export default defineAgentTool({
|
|
|
12
13
|
async execute({ chat_id }, context) {
|
|
13
14
|
const endpoint = context.$client;
|
|
14
15
|
const count = await endpoint.getChatMemberCount(Number(chat_id));
|
|
15
|
-
return { count, message:
|
|
16
|
+
return { count, message: t(context.locale, 'memberCount', { p0: count }) };
|
|
16
17
|
},
|
|
17
18
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -12,6 +13,6 @@ export default defineAgentTool<{ chat_id: string }>({
|
|
|
12
13
|
async execute({ chat_id }: { chat_id: string }, context) {
|
|
13
14
|
const endpoint = context.$client;
|
|
14
15
|
const count = await endpoint.getChatMemberCount(Number(chat_id));
|
|
15
|
-
return { count, message:
|
|
16
|
+
return { count, message: t(context.locale, 'memberCount', { p0: count }) };
|
|
16
17
|
},
|
|
17
18
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -15,6 +16,6 @@ export default defineAgentTool({
|
|
|
15
16
|
async execute({ chat_id, message_id }, context) {
|
|
16
17
|
const endpoint = context.$client;
|
|
17
18
|
const success = await endpoint.pinMessage(Number(chat_id), Number(message_id));
|
|
18
|
-
return { success, message: success ? '
|
|
19
|
+
return { success, message: success ? t(context.locale, 'pinDone') : t(context.locale, 'operationFailed') };
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -15,6 +16,6 @@ export default defineAgentTool<{ chat_id: string; message_id: string }>({
|
|
|
15
16
|
async execute({ chat_id, message_id }: { chat_id: string; message_id: string }, context) {
|
|
16
17
|
const endpoint = context.$client;
|
|
17
18
|
const success = await endpoint.pinMessage(Number(chat_id), Number(message_id));
|
|
18
|
-
return { success, message: success ? '
|
|
19
|
+
return { success, message: success ? t(context.locale, 'pinDone') : t(context.locale, 'operationFailed') };
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool({
|
|
|
13
14
|
async execute({ chat_id, description }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
const success = await endpoint.setChatDescription(Number(chat_id), description);
|
|
16
|
-
return { success, message: success ? '
|
|
17
|
+
return { success, message: success ? t(context.locale, 'descriptionUpdated') : t(context.locale, 'operationFailed') };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool<{ chat_id: string; description: string }>({
|
|
|
13
14
|
async execute({ chat_id, description }: { chat_id: string; description: string }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
const success = await endpoint.setChatDescription(Number(chat_id), description);
|
|
16
|
-
return { success, message: success ? '
|
|
17
|
+
return { success, message: success ? t(context.locale, 'descriptionUpdated') : t(context.locale, 'operationFailed') };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -15,6 +16,6 @@ export default defineAgentTool({
|
|
|
15
16
|
async execute({ chat_id, message_id }, context) {
|
|
16
17
|
const endpoint = context.$client;
|
|
17
18
|
const success = await endpoint.unpinMessage(Number(chat_id), message_id ? Number(message_id) : undefined);
|
|
18
|
-
return { success, message: success ? '
|
|
19
|
+
return { success, message: success ? t(context.locale, 'messageUnpinned') : t(context.locale, 'operationFailed') };
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -15,6 +16,6 @@ export default defineAgentTool<{ chat_id: string; message_id?: string }>({
|
|
|
15
16
|
async execute({ chat_id, message_id }: { chat_id: string; message_id?: string }, context) {
|
|
16
17
|
const endpoint = context.$client;
|
|
17
18
|
const success = await endpoint.unpinMessage(Number(chat_id), message_id ? Number(message_id) : undefined);
|
|
18
|
-
return { success, message: success ? '
|
|
19
|
+
return { success, message: success ? t(context.locale, 'messageUnpinned') : t(context.locale, 'operationFailed') };
|
|
19
20
|
},
|
|
20
21
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -28,6 +29,6 @@ export default defineAgentTool({
|
|
|
28
29
|
permissions[k] = v;
|
|
29
30
|
}
|
|
30
31
|
const success = await endpoint.setChatPermissionsAll(Number(chat_id), permissions);
|
|
31
|
-
return { success, message: success ? '
|
|
32
|
+
return { success, message: success ? t(context.locale, 'permissionsUpdated') : t(context.locale, 'operationFailed') };
|
|
32
33
|
},
|
|
33
34
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { platformPermission } from '@zhin.js/permission';
|
|
@@ -27,6 +28,6 @@ export default defineAgentTool<{ chat_id: string; can_send_messages?: boolean; c
|
|
|
27
28
|
if (typeof v === 'boolean') permissions[k] = v;
|
|
28
29
|
}
|
|
29
30
|
const success = await endpoint.setChatPermissionsAll(Number(chat_id), permissions);
|
|
30
|
-
return { success, message: success ? '
|
|
31
|
+
return { success, message: success ? t(context.locale, 'permissionsUpdated') : t(context.locale, 'operationFailed') };
|
|
31
32
|
},
|
|
32
33
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool({
|
|
|
13
14
|
async execute({ chat_id, message_id, reaction }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
const success = await endpoint.setMessageReaction(Number(chat_id), Number(message_id), reaction);
|
|
16
|
-
return { success, message: success ?
|
|
17
|
+
return { success, message: success ? t(context.locale, 'reactionAdded', { p0: reaction }) : t(context.locale, 'operationFailed') };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool<{ chat_id: string; message_id: string; reaction:
|
|
|
13
14
|
async execute({ chat_id, message_id, reaction }: { chat_id: string; message_id: string; reaction: string }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
const success = await endpoint.setMessageReaction(Number(chat_id), Number(message_id), reaction);
|
|
16
|
-
return { success, message: success ?
|
|
17
|
+
return { success, message: success ? t(context.locale, 'reactionAdded', { p0: reaction }) : t(context.locale, 'operationFailed') };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -19,12 +20,12 @@ export default defineAgentTool({
|
|
|
19
20
|
optList = JSON.parse(options);
|
|
20
21
|
}
|
|
21
22
|
catch {
|
|
22
|
-
return { success: false, message:
|
|
23
|
+
return { success: false, message: t(context.locale, 'invalidPollOptions') };
|
|
23
24
|
}
|
|
24
25
|
if (!Array.isArray(optList) || optList.length < 2) {
|
|
25
|
-
return { success: false, message:
|
|
26
|
+
return { success: false, message: t(context.locale, 'pollOptionCount') };
|
|
26
27
|
}
|
|
27
28
|
const result = await endpoint.sendPoll(Number(chat_id), question, optList, is_anonymous ?? true, allows_multiple ?? false);
|
|
28
|
-
return { success: true, message_id: result.message_id, message: '
|
|
29
|
+
return { success: true, message_id: result.message_id, message: t(context.locale, 'pollSent') };
|
|
29
30
|
},
|
|
30
31
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -18,15 +19,15 @@ export default defineAgentTool<{ chat_id: string; question: string; options: str
|
|
|
18
19
|
try {
|
|
19
20
|
optList = JSON.parse(options);
|
|
20
21
|
} catch {
|
|
21
|
-
return { success: false, message:
|
|
22
|
+
return { success: false, message: t(context.locale, 'invalidPollOptions') };
|
|
22
23
|
}
|
|
23
24
|
if (!Array.isArray(optList) || optList.length < 2) {
|
|
24
|
-
return { success: false, message:
|
|
25
|
+
return { success: false, message: t(context.locale, 'pollOptionCount') };
|
|
25
26
|
}
|
|
26
27
|
const result = await endpoint.sendPoll(
|
|
27
28
|
Number(chat_id), question, optList,
|
|
28
29
|
is_anonymous ?? true, allows_multiple ?? false,
|
|
29
30
|
);
|
|
30
|
-
return { success: true, message_id: result.message_id, message: '
|
|
31
|
+
return { success: true, message_id: result.message_id, message: t(context.locale, 'pollSent') };
|
|
31
32
|
},
|
|
32
33
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -12,6 +13,6 @@ export default defineAgentTool({
|
|
|
12
13
|
async execute({ chat_id, sticker }, context) {
|
|
13
14
|
const endpoint = context.$client;
|
|
14
15
|
const result = await endpoint.sendStickerMessage(Number(chat_id), sticker);
|
|
15
|
-
return { success: true, message_id: result.message_id, message: '
|
|
16
|
+
return { success: true, message_id: result.message_id, message: t(context.locale, 'stickerSent') };
|
|
16
17
|
},
|
|
17
18
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -12,6 +13,6 @@ export default defineAgentTool<{ chat_id: string; sticker: string }>({
|
|
|
12
13
|
async execute({ chat_id, sticker }: { chat_id: string; sticker: string }, context) {
|
|
13
14
|
const endpoint = context.$client;
|
|
14
15
|
const result = await endpoint.sendStickerMessage(Number(chat_id), sticker);
|
|
15
|
-
return { success: true, message_id: result.message_id, message: '
|
|
16
|
+
return { success: true, message_id: result.message_id, message: t(context.locale, 'stickerSent') };
|
|
16
17
|
},
|
|
17
18
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-telegram",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"description": "Zhin.js Telegram Bot API adapter for Plugin Runtime (long-poll getUpdates)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -31,23 +31,23 @@
|
|
|
31
31
|
"directory": "plugins/adapters/telegram"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@zhin.js/adapter": "1.1.
|
|
35
|
-
"@zhin.js/agent-feature": "1.1.
|
|
36
|
-
"@zhin.js/core": "1.1.
|
|
37
|
-
"@zhin.js/feature-kit": "1.1.
|
|
38
|
-
"@zhin.js/host-http": "1.1.
|
|
39
|
-
"@zhin.js/im-contract": "1.1.
|
|
34
|
+
"@zhin.js/adapter": "1.1.24",
|
|
35
|
+
"@zhin.js/agent-feature": "1.1.10",
|
|
36
|
+
"@zhin.js/core": "1.1.52",
|
|
37
|
+
"@zhin.js/feature-kit": "1.1.9",
|
|
38
|
+
"@zhin.js/host-http": "1.1.11",
|
|
39
|
+
"@zhin.js/im-contract": "1.1.8",
|
|
40
40
|
"@zhin.js/logger": "1.1.2",
|
|
41
|
-
"@zhin.js/skill": "1.1.
|
|
42
|
-
"@zhin.js/tool": "1.1.
|
|
41
|
+
"@zhin.js/skill": "1.1.10",
|
|
42
|
+
"@zhin.js/tool": "1.1.11"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"zod": "^4.0.0",
|
|
46
|
-
"@zhin.js/adapter": "^1.1.
|
|
47
|
-
"@zhin.js/command": "^1.1.
|
|
48
|
-
"@zhin.js/core": "^1.1.
|
|
49
|
-
"@zhin.js/permission": "^1.1.
|
|
50
|
-
"zhin.js": "^1.1.
|
|
46
|
+
"@zhin.js/adapter": "^1.1.24",
|
|
47
|
+
"@zhin.js/command": "^1.1.11",
|
|
48
|
+
"@zhin.js/core": "^1.1.52",
|
|
49
|
+
"@zhin.js/permission": "^1.1.9",
|
|
50
|
+
"zhin.js": "^1.1.17"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@zhin.js/command": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
67
|
"zod": "^4.4.3",
|
|
68
|
-
"@zhin.js/host-http": "1.1.
|
|
69
|
-
"zhin.js": "1.1.
|
|
68
|
+
"@zhin.js/host-http": "1.1.11",
|
|
69
|
+
"zhin.js": "1.1.17"
|
|
70
70
|
},
|
|
71
71
|
"files": [
|
|
72
72
|
"adapters",
|
package/schema.json
CHANGED
|
@@ -45,7 +45,12 @@
|
|
|
45
45
|
"string",
|
|
46
46
|
"number"
|
|
47
47
|
],
|
|
48
|
-
"description": "框架 master(Telegram user id;AI/工具权限、endpoint 管理)。endpoints[i].master 可逐项覆盖"
|
|
48
|
+
"description": "框架 master(Telegram user id;AI/工具权限、endpoint 管理)。endpoints[i].master 可逐项覆盖",
|
|
49
|
+
"x-i18n": {
|
|
50
|
+
"en": {
|
|
51
|
+
"description": "Framework masters (Telegram user id; AI/tool permissions and endpoint management). endpoints[i].master can override this value."
|
|
52
|
+
}
|
|
53
|
+
}
|
|
49
54
|
},
|
|
50
55
|
"trusted": {
|
|
51
56
|
"type": "array",
|
|
@@ -56,7 +61,12 @@
|
|
|
56
61
|
],
|
|
57
62
|
"description": "Trusted Telegram user id"
|
|
58
63
|
},
|
|
59
|
-
"description": "框架 trusted 用户列表(弱于 master)。endpoints[i].trusted 可逐项追加"
|
|
64
|
+
"description": "框架 trusted 用户列表(弱于 master)。endpoints[i].trusted 可逐项追加",
|
|
65
|
+
"x-i18n": {
|
|
66
|
+
"en": {
|
|
67
|
+
"description": "Framework trusted users, below master authority. endpoints[i].trusted can add users."
|
|
68
|
+
}
|
|
69
|
+
}
|
|
60
70
|
},
|
|
61
71
|
"endpoints": {
|
|
62
72
|
"type": "array",
|
|
@@ -71,7 +81,12 @@
|
|
|
71
81
|
"string",
|
|
72
82
|
"number"
|
|
73
83
|
],
|
|
74
|
-
"description": "本 endpoint 的框架 master(Telegram user id);覆盖顶层 master"
|
|
84
|
+
"description": "本 endpoint 的框架 master(Telegram user id);覆盖顶层 master",
|
|
85
|
+
"x-i18n": {
|
|
86
|
+
"en": {
|
|
87
|
+
"description": "Framework masters for this endpoint (Telegram user id), overriding the top-level master list."
|
|
88
|
+
}
|
|
89
|
+
}
|
|
75
90
|
},
|
|
76
91
|
"trusted": {
|
|
77
92
|
"type": "array",
|
|
@@ -82,7 +97,12 @@
|
|
|
82
97
|
],
|
|
83
98
|
"description": "Trusted Telegram user id"
|
|
84
99
|
},
|
|
85
|
-
"description": "本 endpoint 的 trusted 列表"
|
|
100
|
+
"description": "本 endpoint 的 trusted 列表",
|
|
101
|
+
"x-i18n": {
|
|
102
|
+
"en": {
|
|
103
|
+
"description": "Trusted users for this endpoint."
|
|
104
|
+
}
|
|
105
|
+
}
|
|
86
106
|
},
|
|
87
107
|
"token": {
|
|
88
108
|
"type": "string",
|
|
@@ -127,12 +147,22 @@
|
|
|
127
147
|
"id",
|
|
128
148
|
"token"
|
|
129
149
|
]
|
|
150
|
+
},
|
|
151
|
+
"x-i18n": {
|
|
152
|
+
"en": {
|
|
153
|
+
"description": "Multiple accounts: mount multiple endpoints in one plugin instance. Each entry uses the top-level fields; id is required and other fields override defaults."
|
|
154
|
+
}
|
|
130
155
|
}
|
|
131
156
|
},
|
|
132
157
|
"commandPrefix": {
|
|
133
158
|
"type": "string",
|
|
134
159
|
"default": "",
|
|
135
|
-
"description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
|
|
160
|
+
"description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖",
|
|
161
|
+
"x-i18n": {
|
|
162
|
+
"en": {
|
|
163
|
+
"description": "Command prefix. The default empty string allows unprefixed commands; '/' requires a leading slash. Each endpoints[i] can override it."
|
|
164
|
+
}
|
|
165
|
+
}
|
|
136
166
|
}
|
|
137
167
|
},
|
|
138
168
|
"required": [
|