@gloablehive/ipad-wechat-plugin 1.0.8 → 1.0.10
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/dist/src/channel.js +58 -1
- package/package.json +1 -1
- package/src/channel.ts +57 -1
package/dist/src/channel.js
CHANGED
|
@@ -134,7 +134,7 @@ export const ipadWeChatPlugin = createChatChannelPlugin({
|
|
|
134
134
|
topLevelReplyToMode: "reply",
|
|
135
135
|
},
|
|
136
136
|
outbound: {
|
|
137
|
-
deliveryMode: "
|
|
137
|
+
deliveryMode: "gateway",
|
|
138
138
|
channel: "ipad-wechat",
|
|
139
139
|
// Resolve target - for WeChat, just pass through the ID
|
|
140
140
|
resolveTarget: (params) => {
|
|
@@ -218,6 +218,63 @@ export const ipadWeChatPlugin = createChatChannelPlugin({
|
|
|
218
218
|
},
|
|
219
219
|
},
|
|
220
220
|
},
|
|
221
|
+
// Directory adapter - for contact resolution
|
|
222
|
+
directory: {
|
|
223
|
+
self: async (params) => {
|
|
224
|
+
const section = getConfigSection(params.cfg);
|
|
225
|
+
return {
|
|
226
|
+
id: section?.wechatId || "",
|
|
227
|
+
name: section?.nickName || "WeChat User",
|
|
228
|
+
accountId: params.accountId || "default",
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
listPeers: async (params) => {
|
|
232
|
+
const section = getConfigSection(params.cfg);
|
|
233
|
+
const client = createIPadClient({
|
|
234
|
+
appKey: section?.appKey,
|
|
235
|
+
appSecret: section?.appSecret,
|
|
236
|
+
guid: section?.guid,
|
|
237
|
+
});
|
|
238
|
+
try {
|
|
239
|
+
const contacts = await client.syncContacts();
|
|
240
|
+
return contacts.map((contact) => ({
|
|
241
|
+
id: contact.wechatId || contact.wxid,
|
|
242
|
+
name: contact.nickName || contact.remark || contact.wechatId,
|
|
243
|
+
accountId: params.accountId || "default",
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
console.error("[iPad WeChat] Failed to list peers:", error);
|
|
248
|
+
return [];
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
listGroups: async (params) => {
|
|
252
|
+
// Note: JuHeBot API doesn't have a direct "list all chatrooms" endpoint
|
|
253
|
+
// For now, return empty array - users can still send to known chatroom IDs
|
|
254
|
+
console.log("[iPad WeChat] listGroups: API not available, returning empty");
|
|
255
|
+
return [];
|
|
256
|
+
},
|
|
257
|
+
listGroupMembers: async (params) => {
|
|
258
|
+
const section = getConfigSection(params.cfg);
|
|
259
|
+
const client = createIPadClient({
|
|
260
|
+
appKey: section?.appKey,
|
|
261
|
+
appSecret: section?.appSecret,
|
|
262
|
+
guid: section?.guid,
|
|
263
|
+
});
|
|
264
|
+
try {
|
|
265
|
+
const members = await client.getRoomMembers(params.groupId);
|
|
266
|
+
return members.map((member) => ({
|
|
267
|
+
id: member.userId || member.wxid,
|
|
268
|
+
name: member.nickName || member.displayName || member.userId,
|
|
269
|
+
accountId: params.accountId || "default",
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
console.error("[iPad WeChat] Failed to list group members:", error);
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
},
|
|
221
278
|
capabilities: {
|
|
222
279
|
supportedMessageTypes: ["text", "image", "video", "file", "link", "location", "contact"],
|
|
223
280
|
maxAttachmentSize: 25 * 1024 * 1024,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gloablehive/ipad-wechat-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw channel plugin for iPad WeChat protocol - enables sending/receiving WeChat messages through iPad protocol",
|
|
6
6
|
"main": "index.ts",
|
package/src/channel.ts
CHANGED
|
@@ -175,7 +175,7 @@ export const ipadWeChatPlugin = createChatChannelPlugin<IPadWeChatResolvedAccoun
|
|
|
175
175
|
},
|
|
176
176
|
|
|
177
177
|
outbound: {
|
|
178
|
-
deliveryMode: "
|
|
178
|
+
deliveryMode: "gateway",
|
|
179
179
|
channel: "ipad-wechat",
|
|
180
180
|
// Resolve target - for WeChat, just pass through the ID
|
|
181
181
|
resolveTarget: (params: any) => {
|
|
@@ -264,6 +264,62 @@ export const ipadWeChatPlugin = createChatChannelPlugin<IPadWeChatResolvedAccoun
|
|
|
264
264
|
},
|
|
265
265
|
},
|
|
266
266
|
|
|
267
|
+
// Directory adapter - for contact resolution
|
|
268
|
+
directory: {
|
|
269
|
+
self: async (params: any) => {
|
|
270
|
+
const section = getConfigSection(params.cfg);
|
|
271
|
+
return {
|
|
272
|
+
id: section?.wechatId || "",
|
|
273
|
+
name: section?.nickName || "WeChat User",
|
|
274
|
+
accountId: params.accountId || "default",
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
listPeers: async (params: any) => {
|
|
278
|
+
const section = getConfigSection(params.cfg);
|
|
279
|
+
const client = createIPadClient({
|
|
280
|
+
appKey: section?.appKey,
|
|
281
|
+
appSecret: section?.appSecret,
|
|
282
|
+
guid: section?.guid,
|
|
283
|
+
});
|
|
284
|
+
try {
|
|
285
|
+
const contacts = await client.syncContacts();
|
|
286
|
+
return contacts.map((contact: any) => ({
|
|
287
|
+
id: contact.wechatId || contact.wxid,
|
|
288
|
+
name: contact.nickName || contact.remark || contact.wechatId,
|
|
289
|
+
accountId: params.accountId || "default",
|
|
290
|
+
}));
|
|
291
|
+
} catch (error) {
|
|
292
|
+
console.error("[iPad WeChat] Failed to list peers:", error);
|
|
293
|
+
return [];
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
listGroups: async (params: any) => {
|
|
297
|
+
// Note: JuHeBot API doesn't have a direct "list all chatrooms" endpoint
|
|
298
|
+
// For now, return empty array - users can still send to known chatroom IDs
|
|
299
|
+
console.log("[iPad WeChat] listGroups: API not available, returning empty");
|
|
300
|
+
return [];
|
|
301
|
+
},
|
|
302
|
+
listGroupMembers: async (params: any) => {
|
|
303
|
+
const section = getConfigSection(params.cfg);
|
|
304
|
+
const client = createIPadClient({
|
|
305
|
+
appKey: section?.appKey,
|
|
306
|
+
appSecret: section?.appSecret,
|
|
307
|
+
guid: section?.guid,
|
|
308
|
+
});
|
|
309
|
+
try {
|
|
310
|
+
const members = await client.getRoomMembers(params.groupId);
|
|
311
|
+
return members.map((member: any) => ({
|
|
312
|
+
id: member.userId || member.wxid,
|
|
313
|
+
name: member.nickName || member.displayName || member.userId,
|
|
314
|
+
accountId: params.accountId || "default",
|
|
315
|
+
}));
|
|
316
|
+
} catch (error) {
|
|
317
|
+
console.error("[iPad WeChat] Failed to list group members:", error);
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
|
|
267
323
|
capabilities: {
|
|
268
324
|
supportedMessageTypes: ["text", "image", "video", "file", "link", "location", "contact"],
|
|
269
325
|
maxAttachmentSize: 25 * 1024 * 1024,
|