@ascegu/teamily 1.0.12 → 1.0.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascegu/teamily",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "OpenClaw Teamily channel plugin - Team instant messaging server integration",
5
5
  "keywords": [
6
6
  "channel",
package/src/channel.ts CHANGED
@@ -245,6 +245,10 @@ export const teamilyPlugin: ChannelPlugin<ResolvedTeamilyAccount> = {
245
245
 
246
246
  const isGroup = message.sessionType === SESSION_TYPES.GROUP;
247
247
  const from = message.sendID;
248
+
249
+ // In group chats, only respond when the bot is @-mentioned
250
+ if (isGroup && !message.isAtSelf) return;
251
+
248
252
  const text = message.content?.text || "";
249
253
  const sessionKey = isGroup ? `teamily:group:${message.recvID}` : `teamily:${from}`;
250
254
 
package/src/monitor.ts CHANGED
@@ -232,6 +232,12 @@ function convertSdkMessage(msg: MessageItem, selfUserID: string): TeamilyMessage
232
232
  return null;
233
233
  }
234
234
 
235
+ // Determine whether this message @-mentions the bot
236
+ const isAtSelf =
237
+ contentType === CONTENT_TYPES.AT_TEXT &&
238
+ (msg.atTextElem?.isAtSelf === true ||
239
+ (msg.atTextElem?.atUserList ?? []).includes(selfUserID));
240
+
235
241
  return {
236
242
  serverMsgID: msg.serverMsgID || msg.clientMsgID || `${Date.now()}_${Math.random()}`,
237
243
  sendID: msg.sendID || "unknown",
@@ -240,6 +246,7 @@ function convertSdkMessage(msg: MessageItem, selfUserID: string): TeamilyMessage
240
246
  contentType,
241
247
  sessionType,
242
248
  sendTime: msg.sendTime || Date.now(),
249
+ isAtSelf,
243
250
  };
244
251
  }
245
252
 
@@ -259,6 +266,10 @@ function parseSdkContent(msg: MessageItem, contentType: number): TeamilyMessage[
259
266
  return { video: msg.videoElem as unknown as TeamilyVideoContent };
260
267
  }
261
268
  return {};
269
+ case CONTENT_TYPES.AT_TEXT: {
270
+ const text = msg.atTextElem?.text ?? tryParseTextContent(msg.content);
271
+ return text ? { text } : {};
272
+ }
262
273
  case CONTENT_TYPES.VOICE:
263
274
  if (msg.soundElem?.sourceUrl) {
264
275
  return { audio: msg.soundElem as unknown as TeamilyAudioContent };
package/src/types.ts CHANGED
@@ -57,6 +57,8 @@ export interface TeamilyMessage {
57
57
  contentType: number;
58
58
  sessionType: number;
59
59
  sendTime: number;
60
+ /** True when the message is an @-mention that includes the bot's own userID. */
61
+ isAtSelf?: boolean;
60
62
  }
61
63
 
62
64
  export interface TeamilyPictureContent {