@capybara-hq/plugin-telegram 0.1.0-rc.5 → 0.1.0-rc.6
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/.capybara-plugin/plugin.json +2 -2
- package/dist/index.mjs +10 -6
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "telegram",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.6",
|
|
5
5
|
"publisher": "Capybara",
|
|
6
6
|
"description": {
|
|
7
7
|
"en": "Telegram (channel@1 bot over the Bot API: long polling or webhook, inline keyboard cards)",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"entry": "./dist/index.mjs",
|
|
18
18
|
"manifest": {
|
|
19
19
|
"name": "telegram",
|
|
20
|
-
"version": "0.1.0-rc.
|
|
20
|
+
"version": "0.1.0-rc.6",
|
|
21
21
|
"sdk": "^0.1.0-rc.4",
|
|
22
22
|
"provides": [
|
|
23
23
|
"channel@1"
|
package/dist/index.mjs
CHANGED
|
@@ -599,10 +599,12 @@ var urlButton = (text, url) => isHttp(url) ? [{ text, url }] : [];
|
|
|
599
599
|
function cardText(card, locale) {
|
|
600
600
|
const url = card.kind === "connect" || card.kind === "bind" ? card.url : card.webUrl;
|
|
601
601
|
const lines = renderCardAsText(card, locale).split("\n");
|
|
602
|
-
|
|
603
|
-
if (
|
|
604
|
-
|
|
605
|
-
|
|
602
|
+
let at = lines.length - 1;
|
|
603
|
+
if (card.kind === "question" && card.state === "pending" && card.textReply !== void 0) at--;
|
|
604
|
+
const line = lines[at];
|
|
605
|
+
if (at > 0 && line?.endsWith(url)) {
|
|
606
|
+
lines.splice(at, 1);
|
|
607
|
+
const label = markdownToTelegramHtml(line.slice(0, line.length - url.length));
|
|
606
608
|
return { body: markdownToTelegramHtml(lines.join("\n")), linkLine: `${label}${htmlLink(url)}` };
|
|
607
609
|
}
|
|
608
610
|
return { body: markdownToTelegramHtml(lines.join("\n")) };
|
|
@@ -649,7 +651,9 @@ async function keyboard(card, locale, tokens) {
|
|
|
649
651
|
case "question": {
|
|
650
652
|
const f = card.form.fields[0];
|
|
651
653
|
const rows = [];
|
|
652
|
-
if (card.state === "pending" && f && !f.multiSelect &&
|
|
654
|
+
if (card.state === "pending" && f && !f.multiSelect && // With textReply the Other path is a plain reply: a field with allowOther still gets its
|
|
655
|
+
// option buttons, never an Other button.
|
|
656
|
+
questionRenderableInline(card.form, { textReply: card.textReply !== void 0 }) && "enum" in f.schema) {
|
|
653
657
|
for (const option of f.schema.enum) {
|
|
654
658
|
rows.push(
|
|
655
659
|
await callbackButton(tokens, option, {
|
|
@@ -1342,7 +1346,7 @@ function createTelegramChannel(o) {
|
|
|
1342
1346
|
// src/index.ts
|
|
1343
1347
|
var index_default = defineExtension({
|
|
1344
1348
|
name: "telegram",
|
|
1345
|
-
version: "0.1.0-rc.
|
|
1349
|
+
version: "0.1.0-rc.6",
|
|
1346
1350
|
sdk: "^0.1.0-rc.4",
|
|
1347
1351
|
provides: [CHANNEL_EXTENSION_POINT],
|
|
1348
1352
|
permissions: { network: ["api.telegram.org"] },
|
package/package.json
CHANGED