@poolzin/pool-bot 2026.4.14 → 2026.4.15
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/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-native-command-menu.d.ts","sourceRoot":"","sources":["../../src/telegram/bot-native-command-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAKlC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE;IACtD,KAAK,EAAE,yBAAyB,EAAE,CAAC;IACnC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC/B,GAAG;IAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCxD;
|
|
1
|
+
{"version":3,"file":"bot-native-command-menu.d.ts","sourceRoot":"","sources":["../../src/telegram/bot-native-command-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAKlC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE;IACtD,KAAK,EAAE,yBAAyB,EAAE,CAAC;IACnC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC/B,GAAG;IAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCxD;AAOD,wBAAgB,+BAA+B,CAAC,MAAM,EAAE;IACtD,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG;IACF,kBAAkB,EAAE,mBAAmB,EAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB,CAuBA;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,UAAU,CAAC;IACpB,kBAAkB,EAAE,mBAAmB,EAAE,CAAC;CAC3C,GAAG,IAAI,CA0BP"}
|
|
@@ -32,12 +32,31 @@ export function buildPluginTelegramMenuCommands(params) {
|
|
|
32
32
|
}
|
|
33
33
|
return { commands, issues };
|
|
34
34
|
}
|
|
35
|
+
// Telegram enforces an undocumented ~5300 character limit on the total of all
|
|
36
|
+
// command names + descriptions combined (not just the 100-command count limit).
|
|
37
|
+
// We cap total chars to stay safely under this limit.
|
|
38
|
+
const TELEGRAM_MAX_TOTAL_CHARS = 5000;
|
|
35
39
|
export function buildCappedTelegramMenuCommands(params) {
|
|
36
40
|
const { allCommands } = params;
|
|
37
41
|
const maxCommands = params.maxCommands ?? TELEGRAM_MAX_COMMANDS;
|
|
38
42
|
const totalCommands = allCommands.length;
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
// First, truncate descriptions so the total fits under the character limit.
|
|
44
|
+
let remainingChars = TELEGRAM_MAX_TOTAL_CHARS;
|
|
45
|
+
const capped = [];
|
|
46
|
+
for (const cmd of allCommands) {
|
|
47
|
+
const nameCost = cmd.command.length;
|
|
48
|
+
const minDescCost = Math.min(cmd.description.length, 3); // keep at least 3 chars
|
|
49
|
+
if (remainingChars - nameCost - minDescCost < 0)
|
|
50
|
+
break;
|
|
51
|
+
const descBudget = Math.min(cmd.description.length, remainingChars - nameCost);
|
|
52
|
+
const desc = descBudget < cmd.description.length
|
|
53
|
+
? cmd.description.slice(0, Math.max(0, descBudget - 1)) + "\u2026"
|
|
54
|
+
: cmd.description;
|
|
55
|
+
capped.push({ command: cmd.command, description: desc });
|
|
56
|
+
remainingChars -= nameCost + desc.length;
|
|
57
|
+
}
|
|
58
|
+
const overflowCount = Math.max(0, totalCommands - capped.length);
|
|
59
|
+
const commandsToRegister = capped.slice(0, maxCommands);
|
|
41
60
|
return { commandsToRegister, totalCommands, maxCommands, overflowCount };
|
|
42
61
|
}
|
|
43
62
|
export function syncTelegramMenuCommands(params) {
|