fix(11-01): fix bitmap node references to use Parse Callback Data
Is Bitmap Batch Stop and Resolve Batch Stop Names were checking $json.bitmap
which contains the Telegram API response, not the parsed callback data. Changed
both to reference $("Parse Callback Data").item.json directly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -4825,7 +4825,7 @@
|
||||
"conditions": [
|
||||
{
|
||||
"id": "has-bitmap",
|
||||
"leftValue": "={{ $json.bitmap }}",
|
||||
"leftValue": "={{ $(\"Parse Callback Data\").item.json.bitmap }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
@@ -4864,7 +4864,7 @@
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Resolve bitmap to container names for batch stop\nfunction decodeBitmap(b36) {\n if (!b36 || b36 === '0') return new Set();\n let val = 0n;\n for (const ch of b36) {\n val = val * 36n + BigInt(parseInt(ch, 36));\n }\n const indices = new Set();\n let i = 0;\n let v = val;\n while (v > 0n) {\n if (v & 1n) indices.add(i);\n v >>= 1n;\n i++;\n }\n return indices;\n}\n\n// Get batch stop data\nconst stopData = $('Check Batch Stop Expired').item.json;\nconst bitmap = stopData.bitmap;\n\n// Get containers from HTTP request\nconst containers = $input.all();\nlet allContainers = [];\nfor (const item of containers) {\n if (Array.isArray(item.json)) {\n allContainers = allContainers.concat(item.json);\n } else {\n allContainers.push(item.json);\n }\n}\n\n// Sort: running first, then alphabetically (same as keyboard build)\nconst sortedContainers = allContainers\n .map(c => ({\n name: (c.Names && c.Names[0]) ? c.Names[0].replace(/^\\//, '') : 'unknown',\n state: c.State,\n id: c.Id.substring(0, 12)\n }))\n .sort((a, b) => {\n if (a.state === 'running' && b.state !== 'running') return -1;\n if (a.state !== 'running' && b.state === 'running') return 1;\n return a.name.localeCompare(b.name);\n });\n\n// Decode bitmap to indices\nconst selectedIndices = decodeBitmap(bitmap);\n\n// Map indices to container names\nconst containerNames = Array.from(selectedIndices)\n .filter(i => i < sortedContainers.length)\n .map(i => sortedContainers[i].name);\n\n// Return in same format as legacy bstop parser (containerNames array)\nreturn {\n json: {\n containerNames: containerNames,\n chatId: stopData.chatId,\n messageId: stopData.messageId,\n queryId: stopData.queryId,\n batchAction: 'stop',\n fromKeyboard: stopData.fromKeyboard || true\n }\n};"
|
||||
"jsCode": "// Resolve bitmap to container names for batch stop\nfunction decodeBitmap(b36) {\n if (!b36 || b36 === '0') return new Set();\n let val = 0n;\n for (const ch of b36) {\n val = val * 36n + BigInt(parseInt(ch, 36));\n }\n const indices = new Set();\n let i = 0;\n let v = val;\n while (v > 0n) {\n if (v & 1n) indices.add(i);\n v >>= 1n;\n i++;\n }\n return indices;\n}\n\n// Get batch stop data\nconst stopData = $('Parse Callback Data').item.json;\nconst bitmap = stopData.bitmap;\n\n// Get containers from HTTP request\nconst containers = $input.all();\nlet allContainers = [];\nfor (const item of containers) {\n if (Array.isArray(item.json)) {\n allContainers = allContainers.concat(item.json);\n } else {\n allContainers.push(item.json);\n }\n}\n\n// Sort: running first, then alphabetically (same as keyboard build)\nconst sortedContainers = allContainers\n .map(c => ({\n name: (c.Names && c.Names[0]) ? c.Names[0].replace(/^\\//, '') : 'unknown',\n state: c.State,\n id: c.Id.substring(0, 12)\n }))\n .sort((a, b) => {\n if (a.state === 'running' && b.state !== 'running') return -1;\n if (a.state !== 'running' && b.state === 'running') return 1;\n return a.name.localeCompare(b.name);\n });\n\n// Decode bitmap to indices\nconst selectedIndices = decodeBitmap(bitmap);\n\n// Map indices to container names\nconst containerNames = Array.from(selectedIndices)\n .filter(i => i < sortedContainers.length)\n .map(i => sortedContainers[i].name);\n\n// Return in same format as legacy bstop parser (containerNames array)\nreturn {\n json: {\n containerNames: containerNames,\n chatId: stopData.chatId,\n messageId: stopData.messageId,\n queryId: stopData.queryId,\n batchAction: 'stop',\n fromKeyboard: stopData.fromKeyboard || true\n }\n};"
|
||||
},
|
||||
"id": "code-resolve-batch-stop-names",
|
||||
"name": "Resolve Batch Stop Names",
|
||||
|
||||
Reference in New Issue
Block a user