clawgram 2.2.1 → 2.3.0

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/channel.js CHANGED
@@ -1148,6 +1148,7 @@ const createChannelPlugin = (runtimes) => {
1148
1148
  const replyToId = (0, param_readers_1.readStringOrNumberParam)(params, "replyToId") ?? (0, param_readers_1.readStringOrNumberParam)(params, "replyTo");
1149
1149
  const threadId = (0, param_readers_1.readStringOrNumberParam)(params, "threadId");
1150
1150
  const messageThreadId = parseOptionalThreadId(threadId);
1151
+ const parseMode = (0, helpers_1.normalizeParseMode)(params?.parseMode);
1151
1152
  actionLog.info("clawgram handleAction send", {
1152
1153
  requestedAccountId: accountId,
1153
1154
  dryRun: dryRun === true,
@@ -1156,6 +1157,7 @@ const createChannelPlugin = (runtimes) => {
1156
1157
  targetKind,
1157
1158
  replyToId: replyToId ?? null,
1158
1159
  threadId: threadId ?? null,
1160
+ parseMode: parseMode ?? null,
1159
1161
  toolContextCurrentChannelId: toolContext?.currentChannelId ?? null,
1160
1162
  });
1161
1163
  const resolvedAccountId = resolveRuntimeAccountId(cfg, accountId);
@@ -1240,6 +1242,7 @@ const createChannelPlugin = (runtimes) => {
1240
1242
  targetKind,
1241
1243
  replyToMessageId: (0, helpers_1.resolveReplyToMessageIdForTarget)(rawTo, replyToId),
1242
1244
  messageThreadId,
1245
+ parseMode,
1243
1246
  });
1244
1247
  if (sendingToCurrentGroup &&
1245
1248
  !replyToId &&
@@ -295,6 +295,9 @@ class GramJsClientManager {
295
295
  const replyParams = buildForumReplyParams(messageThreadId, args.replyToMessageId);
296
296
  return this.client.sendMessage(resolved.peer, {
297
297
  message: args.text,
298
+ // GramJS accepts "md" | "html"; absent keeps plain text so every
299
+ // pre-2.3.0 caller behaves exactly as before.
300
+ ...(args.parseMode ? { parseMode: args.parseMode === "markdown" ? "md" : "html" } : {}),
298
301
  ...replyParams,
299
302
  });
300
303
  }
package/dist/helpers.js CHANGED
@@ -33,6 +33,7 @@ exports.resolveChatTarget = resolveChatTarget;
33
33
  exports.isReplyToSelfMessage = isReplyToSelfMessage;
34
34
  exports.resolveSenderProfile = resolveSenderProfile;
35
35
  exports.resolveSenderProfileWithTimeout = resolveSenderProfileWithTimeout;
36
+ exports.normalizeParseMode = normalizeParseMode;
36
37
  const node_fs_1 = require("node:fs");
37
38
  const node_path_1 = __importDefault(require("node:path"));
38
39
  const core_1 = require("openclaw/plugin-sdk/core");
@@ -493,3 +494,19 @@ async function resolveSenderProfile(message, input) {
493
494
  async function resolveSenderProfileWithTimeout(message, input, timeoutMs = 1500) {
494
495
  return await withTimeout(resolveSenderProfile(message, input), timeoutMs) ?? {};
495
496
  }
497
+ /**
498
+ * Send accepts parseMode so drafts can carry real links ([text](url)) instead
499
+ * of bare URLs. The value reaches GramJS, so it is validated here: an unknown
500
+ * mode fails loudly at the action boundary rather than silently sending
501
+ * markup as literal text to a live human.
502
+ */
503
+ function normalizeParseMode(raw) {
504
+ if (raw === undefined || raw === null || raw === "")
505
+ return undefined;
506
+ const value = String(raw).toLowerCase();
507
+ if (value === "md" || value === "markdown")
508
+ return "markdown";
509
+ if (value === "html")
510
+ return "html";
511
+ throw new Error(`clawgram: invalid parseMode "${String(raw)}" — use "markdown" or "html"`);
512
+ }
@@ -2,7 +2,7 @@
2
2
  "id": "clawgram",
3
3
  "name": "Clawgram",
4
4
  "description": "Clawgram — personal Telegram (MTProto userbot) channel for OpenClaw. Your AI assistant reads and responds as you.",
5
- "version": "2.1.0",
5
+ "version": "2.3.0",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawgram",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Clawgram — personal Telegram (MTProto userbot) channel for OpenClaw. Your AI assistant reads and responds as you.",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -8,6 +8,7 @@
8
8
  "build:test": "tsc -p tsconfig.test.json",
9
9
  "test": "npm run build:test && node test/ensure-compiled.mjs && node --test \"dist-test/test/*.test.js\"",
10
10
  "prepublishOnly": "npm run build && npm test",
11
+ "release:clawhub": "node scripts/publish-clawhub.mjs",
11
12
  "clawgram-cli": "node dist/clawgram-cli.js",
12
13
  "clawgram-cli:hello": "node dist/clawgram-cli.js --hello",
13
14
  "clawgram-cli:auth": "node dist/clawgram-cli.js --auth"