@jackle.dev/zalox-plugin 1.0.21 → 1.0.22
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/package.json +1 -1
- package/src/tools.ts +14 -4
package/package.json
CHANGED
package/src/tools.ts
CHANGED
|
@@ -2,18 +2,18 @@ import { getCachedApi } from './client.js';
|
|
|
2
2
|
|
|
3
3
|
export const zaloxGroupTool = {
|
|
4
4
|
name: 'zalox_group',
|
|
5
|
-
description: 'Manage Zalo groups
|
|
5
|
+
description: 'Manage Zalo groups (kick/add/info) or check bot identity (me).',
|
|
6
6
|
parameters: {
|
|
7
7
|
type: 'object',
|
|
8
8
|
properties: {
|
|
9
9
|
action: {
|
|
10
10
|
type: 'string',
|
|
11
|
-
enum: ['kick', 'add', 'info'],
|
|
11
|
+
enum: ['kick', 'add', 'info', 'me'],
|
|
12
12
|
description: 'Action to perform'
|
|
13
13
|
},
|
|
14
14
|
groupId: {
|
|
15
15
|
type: 'string',
|
|
16
|
-
description: 'Target Group ID'
|
|
16
|
+
description: 'Target Group ID (required for kick/add/info)'
|
|
17
17
|
},
|
|
18
18
|
userId: {
|
|
19
19
|
type: 'string',
|
|
@@ -25,7 +25,7 @@ export const zaloxGroupTool = {
|
|
|
25
25
|
description: 'Zalo profile to use'
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
|
-
required: ['action'
|
|
28
|
+
required: ['action'],
|
|
29
29
|
},
|
|
30
30
|
execute: async (args: any) => {
|
|
31
31
|
const { action, groupId, userId, profile } = args;
|
|
@@ -35,6 +35,16 @@ export const zaloxGroupTool = {
|
|
|
35
35
|
const api = cached.api as any;
|
|
36
36
|
|
|
37
37
|
try {
|
|
38
|
+
if (action === 'me') {
|
|
39
|
+
return JSON.stringify({
|
|
40
|
+
id: api.ownId || 'unknown',
|
|
41
|
+
name: api.displayName || 'unknown',
|
|
42
|
+
profile: profile || 'default'
|
|
43
|
+
}, null, 2);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!groupId && action !== 'me') throw new Error('groupId required');
|
|
47
|
+
|
|
38
48
|
if (action === 'kick') {
|
|
39
49
|
if (!userId) throw new Error('userId required for kick');
|
|
40
50
|
await api.removeUserFromGroup(userId, groupId);
|