telegix 1.1.1 → 1.1.2
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/README.md +539 -63
- package/index.cjs +6305 -0
- package/index.d.ts +120 -0
- package/index.js +11 -2
- package/lib/api.js +97 -19
- package/lib/context.js +111 -0
- package/lib/format.js +6 -0
- package/lib/link-preview.js +256 -0
- package/lib/markdownv2.js +3 -0
- package/lib/markup.js +116 -4
- package/lib/rich.js +54 -0
- package/lib/stream.js +251 -0
- package/lib/webapp.js +511 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,12 @@ Telegix is a high-performance, developer-friendly Telegram Bot API library built
|
|
|
51
51
|
- [Custom Reply Keyboards](#custom-reply-keyboards)
|
|
52
52
|
- [Inline Keyboards](#inline-keyboards)
|
|
53
53
|
- [Complete Button Builder Reference](#complete-button-builder-reference)
|
|
54
|
+
- [🎨 Colored Buttons for Bots (Bot API 9.4+)](#-colored-buttons-for-bots-bot-api-94)
|
|
54
55
|
- [Removing Keyboards & Force Reply](#removing-keyboards--force-reply)
|
|
56
|
+
- [🌊 Streaming Text for Bots (`streamText` & `streamDraft`)](#-streaming-text-for-bots-streamtext--streamdraft)
|
|
57
|
+
- [Real-Time Message Edit Streaming](#real-time-message-edit-streaming)
|
|
58
|
+
- [Live Draft Streaming (Bot API 10.3+)](#live-draft-streaming-bot-api-103)
|
|
59
|
+
- [Streaming AI & LLM Responses (Gemini, OpenAI, Generators)](#streaming-ai--llm-responses-gemini-openai-generators)
|
|
55
60
|
- [💬 Asynchronous Conversations & Wizard Scenes](#-asynchronous-conversations--wizard-scenes)
|
|
56
61
|
- [Interactive Inline Prompts (`await ctx.prompt`)](#interactive-inline-prompts-await-ctxprompt)
|
|
57
62
|
- [Multi-Step Wizard Scenes (`WizardScene` & `Stage`)](#multi-step-wizard-scenes-wizardscene--stage)
|
|
@@ -63,8 +68,15 @@ Telegix is a high-performance, developer-friendly Telegram Bot API library built
|
|
|
63
68
|
- [✒️ Message Formatting (`fmt`, `html`, `mdv2`)](#️-message-formatting-fmt-html-mdv2)
|
|
64
69
|
- [XSS-Safe HTML Builder (`fmt` & `html`)](#xss-safe-html-builder-fmt--html)
|
|
65
70
|
- [MarkdownV2 Escaping Helpers (`mdv2`)](#markdownv2-escaping-helpers-mdv2)
|
|
71
|
+
- [📜 Collapsible Quotes (`fmt`, `mdv2`, `RichMessage`)](#-collapsible-quotes-fmt-mdv2-richmessage)
|
|
72
|
+
- [🔗 Adjustable Link Previews (`LinkPreview`)](#-adjustable-link-previews-linkpreview)
|
|
66
73
|
- [💳 Payments, Invoices & Telegram Stars (`InvoiceBuilder`)](#-payments-invoices--telegram-stars-invoicebuilder)
|
|
67
|
-
- [📱 Telegram Mini Apps
|
|
74
|
+
- [📱 Telegram Mini Apps Suite (`MiniApp` & Utilities)](#-telegram-mini-apps-suite-miniapp--utilities)
|
|
75
|
+
- [Mini App Authentication (`validateWebAppInitData`)](#mini-app-authentication-validatewebappinitdata)
|
|
76
|
+
- [Full-Screen Mode](#full-screen-mode)
|
|
77
|
+
- [Device Motion Tracking (Accelerometer, Orientation, Gyroscope)](#device-motion-tracking-accelerometer-orientation-gyroscope)
|
|
78
|
+
- [Custom Loading Screen Generator (`MiniAppLoadingScreen`)](#custom-loading-screen-generator-miniapploadingscreen)
|
|
79
|
+
- [Home Screen & Prepared Inline Messages](#home-screen--prepared-inline-messages)
|
|
68
80
|
- [🤖 Multi-Bot Process Manager (`TelegixManager`)](#-multi-bot-process-manager-telegixmanager)
|
|
69
81
|
- [⚡ Advanced Built-in Middlewares](#-advanced-built-in-middlewares)
|
|
70
82
|
- [Rate Limiter Middleware (`rateLimit`)](#rate-limiter-middleware-ratelimit)
|
|
@@ -429,6 +441,32 @@ await ctx.reply('Choose an option:', {
|
|
|
429
441
|
[Markup.button.callback('Option 1', 'opt_1')],
|
|
430
442
|
]),
|
|
431
443
|
});
|
|
444
|
+
|
|
445
|
+
// Stream real-time tokens/text with automated throttle control
|
|
446
|
+
await ctx.streamText(tokenGenerator(), { initialMessage: '⏳ Thinking...' });
|
|
447
|
+
|
|
448
|
+
// Stream real-time draft into chat input bar (Bot API 10.3)
|
|
449
|
+
await ctx.streamDraft(tokenGenerator());
|
|
450
|
+
|
|
451
|
+
// Reply with customized link preview (small/large, above/below, disabled)
|
|
452
|
+
await ctx.replyWithLinkPreview('Visit Docs:', LinkPreview.large('https://telegix.dev'));
|
|
453
|
+
|
|
454
|
+
// Reply with expandable/collapsible blockquote
|
|
455
|
+
await ctx.replyWithCollapsibleQuote('Full debug stack trace...', '⚠️ <b>System Warning</b>');
|
|
456
|
+
|
|
457
|
+
// Reply with button launching a Telegram Mini App
|
|
458
|
+
await ctx.replyWithWebApp('Launch Dashboard:', 'https://app.example.com', '🚀 Open App');
|
|
459
|
+
|
|
460
|
+
// Save a prepared inline message for Mini App sharing (Bot API 8.0+)
|
|
461
|
+
const prepared = await ctx.savePreparedInlineMessage({
|
|
462
|
+
type: 'article',
|
|
463
|
+
id: 'share_1',
|
|
464
|
+
title: 'Share Score',
|
|
465
|
+
input_message_content: { message_text: 'I reached Level 10!' },
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// Retrieve bot user identity
|
|
469
|
+
const me = await ctx.getMe();
|
|
432
470
|
```
|
|
433
471
|
|
|
434
472
|
---
|
|
@@ -958,6 +996,10 @@ await ctx.reply('Interactive Post:', inline);
|
|
|
958
996
|
| `Markup.button.text(text)` | Standard reply keyboard text button. |
|
|
959
997
|
| `Markup.button.callback(text, data)` | Inline button triggering a callback query with `data`. |
|
|
960
998
|
| `Markup.button.url(text, url)` | Inline button opening an external URL. |
|
|
999
|
+
| `Markup.button.primary(text, dataOrUrl)` | **Primary (Blue)** styled button for prominent calls to action (**Bot API 9.4+**). |
|
|
1000
|
+
| `Markup.button.danger(text, dataOrUrl)` | **Danger (Red)** styled button for destructive actions (**Bot API 9.4+**). |
|
|
1001
|
+
| `Markup.button.success(text, dataOrUrl)` | **Success (Green)** styled button for positive confirmations (**Bot API 9.4+**). |
|
|
1002
|
+
| `Markup.button.colored(text, style, dataOrUrl)` | Custom styled button with `'primary' \| 'danger' \| 'success'` style. |
|
|
961
1003
|
| `Markup.button.webApp(text, url)` | Button launching a Telegram Mini App. |
|
|
962
1004
|
| `Markup.button.copyText(text, textToCopy)` | Inline button that copies `textToCopy` to the clipboard. |
|
|
963
1005
|
| `Markup.button.disabled(text)` | Disabled, non-clickable button (**Bot API 10.3**). |
|
|
@@ -975,6 +1017,50 @@ await ctx.reply('Interactive Post:', inline);
|
|
|
975
1017
|
|
|
976
1018
|
---
|
|
977
1019
|
|
|
1020
|
+
### 🎨 Colored Buttons for Bots (Bot API 9.4+)
|
|
1021
|
+
|
|
1022
|
+
Telegram Bot API 9.4 introduced native visual styling for inline buttons, allowing developers to emphasize specific actions with colors:
|
|
1023
|
+
|
|
1024
|
+
- `primary`: Emphasized primary button (accent/blue styling)
|
|
1025
|
+
- `danger`: Destructive actions such as account deletion, bans, or cancelations (red styling)
|
|
1026
|
+
- `success`: Confirmations, approvals, and checkout completions (green styling)
|
|
1027
|
+
|
|
1028
|
+
You can use colored buttons with callback queries or URLs via `Markup.button` or the `RichMessage` builder:
|
|
1029
|
+
|
|
1030
|
+
```javascript
|
|
1031
|
+
import { Markup, RichMessage } from 'telegix';
|
|
1032
|
+
|
|
1033
|
+
// 1. Using Markup.inlineKeyboard
|
|
1034
|
+
bot.command('confirm_delete', async (ctx) => {
|
|
1035
|
+
const keyboard = Markup.inlineKeyboard([
|
|
1036
|
+
[
|
|
1037
|
+
Markup.button.danger('🗑️ Delete Account', 'action_confirm_delete'),
|
|
1038
|
+
Markup.button.primary('Keep Account', 'action_cancel'),
|
|
1039
|
+
],
|
|
1040
|
+
[
|
|
1041
|
+
Markup.button.success('💳 Upgrade to Pro', 'https://example.com/checkout'),
|
|
1042
|
+
],
|
|
1043
|
+
]);
|
|
1044
|
+
|
|
1045
|
+
await ctx.reply('⚠️ Are you sure you want to delete your account permanently?', keyboard);
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
// 2. Using RichMessageBuilder
|
|
1049
|
+
bot.command('order_status', async (ctx) => {
|
|
1050
|
+
const message = RichMessage.card('📦 Order #98124', 'Order ready for dispatch')
|
|
1051
|
+
.header('Delivery Status', '🚚')
|
|
1052
|
+
.badge('Status', 'Pending Signature')
|
|
1053
|
+
.row(
|
|
1054
|
+
Markup.button.success('✅ Approve & Sign', 'approve_98124'),
|
|
1055
|
+
Markup.button.danger('❌ Reject Order', 'reject_98124')
|
|
1056
|
+
);
|
|
1057
|
+
|
|
1058
|
+
await ctx.replyWithRichMessage(message);
|
|
1059
|
+
});
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
---
|
|
1063
|
+
|
|
978
1064
|
### Removing Keyboards & Force Reply
|
|
979
1065
|
|
|
980
1066
|
```javascript
|
|
@@ -987,6 +1073,102 @@ await ctx.reply('Please enter your email address:', Markup.forceReply());
|
|
|
987
1073
|
|
|
988
1074
|
---
|
|
989
1075
|
|
|
1076
|
+
## 🌊 Streaming Text for Bots (`streamText` & `streamDraft`)
|
|
1077
|
+
|
|
1078
|
+
Real-time streaming is essential for modern AI-driven conversational bots (e.g. Gemini, OpenAI, Claude) and live progress updates. Telegix provides two powerful streaming modes:
|
|
1079
|
+
|
|
1080
|
+
1. **Real-Time Message Edit Streaming**: Sends an initial placeholder message and progressively updates it with incoming chunks using an intelligent throttling buffer to safely prevent Telegram `429 Too Many Requests` errors.
|
|
1081
|
+
2. **Live Draft Streaming (Bot API 10.3+)**: Broadcasts ephemeral text chunks into the chat input bar via `sendMessageDraft` as typing occurs, then sends the finalized message once the stream completes.
|
|
1082
|
+
|
|
1083
|
+
### Real-Time Message Edit Streaming
|
|
1084
|
+
|
|
1085
|
+
```javascript
|
|
1086
|
+
import { Telegix, toTextStream } from 'telegix';
|
|
1087
|
+
|
|
1088
|
+
const bot = new Telegix(process.env.BOT_TOKEN);
|
|
1089
|
+
|
|
1090
|
+
// Custom token generator simulation
|
|
1091
|
+
async function* generateResponseTokens() {
|
|
1092
|
+
const words = 'Telegix provides blazing fast, zero-dependency streaming for modern Telegram bots.'.split(' ');
|
|
1093
|
+
for (const word of words) {
|
|
1094
|
+
yield `${word} `;
|
|
1095
|
+
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
bot.command('generate', async (ctx) => {
|
|
1100
|
+
// Directly stream onto chat via ctx.streamText
|
|
1101
|
+
const result = await ctx.streamText(generateResponseTokens(), {
|
|
1102
|
+
initialMessage: '💭 Generating your answer...',
|
|
1103
|
+
intervalMs: 800, // Buffer updates to edit at most once every 800ms
|
|
1104
|
+
minDeltaChars: 15, // Only edit if at least 15 new characters arrived
|
|
1105
|
+
parse_mode: 'HTML',
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
console.log(`Stream complete! Final message ID: ${result.message_id}`);
|
|
1109
|
+
});
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
### Live Draft Streaming (Bot API 10.3+)
|
|
1113
|
+
|
|
1114
|
+
Live drafts display real-time streamed text directly in the chat preview or input box without producing edit notifications:
|
|
1115
|
+
|
|
1116
|
+
```javascript
|
|
1117
|
+
bot.command('stream_draft', async (ctx) => {
|
|
1118
|
+
async function* aiStream() {
|
|
1119
|
+
yield 'Searching knowledge base...\n';
|
|
1120
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
1121
|
+
yield 'Synthesizing response:\n';
|
|
1122
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
1123
|
+
yield 'Everything is configured and running at optimal speeds!';
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
// Stream preview as draft, then send final message
|
|
1127
|
+
await ctx.streamDraft(aiStream(), {
|
|
1128
|
+
intervalMs: 600,
|
|
1129
|
+
minDeltaChars: 10,
|
|
1130
|
+
});
|
|
1131
|
+
});
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
### Streaming AI & LLM Responses (Gemini, OpenAI, Generators)
|
|
1135
|
+
|
|
1136
|
+
Telegix automatically accepts any `AsyncIterable`, `ReadableStream`, Generator, Array, or String:
|
|
1137
|
+
|
|
1138
|
+
```javascript
|
|
1139
|
+
import { GoogleGenAI } from '@google/genai';
|
|
1140
|
+
|
|
1141
|
+
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
|
|
1142
|
+
|
|
1143
|
+
bot.command('ask', async (ctx) => {
|
|
1144
|
+
if (!ctx.payload) {
|
|
1145
|
+
return ctx.reply('Please provide a prompt! Example: /ask Explain quantum computing');
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
// Create Gemini streaming response
|
|
1149
|
+
const responseStream = await ai.models.generateContentStream({
|
|
1150
|
+
model: 'gemini-2.5-flash',
|
|
1151
|
+
contents: ctx.payload,
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
// Convert Gemini chunks to text stream
|
|
1155
|
+
async function* extractText(stream) {
|
|
1156
|
+
for await (const chunk of stream) {
|
|
1157
|
+
if (chunk.text) yield chunk.text;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
await ctx.streamText(extractText(responseStream), {
|
|
1162
|
+
initialMessage: '🤖 Thinking...',
|
|
1163
|
+
intervalMs: 800,
|
|
1164
|
+
minDeltaChars: 20,
|
|
1165
|
+
parse_mode: 'HTML',
|
|
1166
|
+
});
|
|
1167
|
+
});
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
---
|
|
1171
|
+
|
|
990
1172
|
## 💬 Asynchronous Conversations & Wizard Scenes
|
|
991
1173
|
|
|
992
1174
|
### Interactive Inline Prompts (`await ctx.prompt`)
|
|
@@ -1225,6 +1407,110 @@ bot.command('md', async (ctx) => {
|
|
|
1225
1407
|
|
|
1226
1408
|
---
|
|
1227
1409
|
|
|
1410
|
+
## 📜 Collapsible Quotes (`fmt`, `mdv2`, `RichMessage`)
|
|
1411
|
+
|
|
1412
|
+
Telegram supports expandable/collapsible blockquotes (`<blockquote expandable>`), allowing users to tuck away long logs, detailed terms of service, technical stack traces, or FAQ answers behind a clean toggle.
|
|
1413
|
+
|
|
1414
|
+
Telegix provides first-class helpers across HTML, MarkdownV2, the `Context` object, and the `RichMessage` builder:
|
|
1415
|
+
|
|
1416
|
+
### 1. HTML Formatting (`fmt.collapsibleQuote` / `html.expandableQuote`)
|
|
1417
|
+
|
|
1418
|
+
```javascript
|
|
1419
|
+
import { fmt } from 'telegix';
|
|
1420
|
+
|
|
1421
|
+
bot.command('faq', async (ctx) => {
|
|
1422
|
+
const answer = fmt`
|
|
1423
|
+
<b>Frequently Asked Questions:</b>
|
|
1424
|
+
|
|
1425
|
+
${fmt.collapsibleQuote('Here is a very long, comprehensive answer explaining step-by-step how to integrate Telegix with your custom backend infrastructure...')}
|
|
1426
|
+
`;
|
|
1427
|
+
|
|
1428
|
+
await ctx.reply(answer, { parse_mode: 'HTML' });
|
|
1429
|
+
});
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
### 2. Context Shortcut (`ctx.replyWithCollapsibleQuote`)
|
|
1433
|
+
|
|
1434
|
+
```javascript
|
|
1435
|
+
bot.command('terms', async (ctx) => {
|
|
1436
|
+
await ctx.replyWithCollapsibleQuote(
|
|
1437
|
+
'1. All user data is encrypted end-to-end.\n2. No telemetry is gathered without consent.\n3. Pure JavaScript runtime guarantees zero binary bloat.',
|
|
1438
|
+
'📋 <b>Terms of Service</b> (Tap to expand):'
|
|
1439
|
+
);
|
|
1440
|
+
});
|
|
1441
|
+
```
|
|
1442
|
+
|
|
1443
|
+
### 3. MarkdownV2 Formatting (`mdv2.collapsibleQuote`)
|
|
1444
|
+
|
|
1445
|
+
```javascript
|
|
1446
|
+
import { mdv2 } from 'telegix';
|
|
1447
|
+
|
|
1448
|
+
bot.command('logs', async (ctx) => {
|
|
1449
|
+
const hiddenLogs = mdv2.collapsibleQuote('Error: Connection timed out at line 42 in server.ts');
|
|
1450
|
+
await ctx.reply(hiddenLogs, { parse_mode: 'MarkdownV2' });
|
|
1451
|
+
});
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1454
|
+
### 4. RichMessage Builder (`collapsibleQuote` / `expandableQuote`)
|
|
1455
|
+
|
|
1456
|
+
```javascript
|
|
1457
|
+
import { RichMessage } from 'telegix';
|
|
1458
|
+
|
|
1459
|
+
bot.command('patchnotes', async (ctx) => {
|
|
1460
|
+
const card = RichMessage.card('⚡ Release v1.1.0', 'Modern Telegram Bot API updates')
|
|
1461
|
+
.header('Changelog Details', '🚀')
|
|
1462
|
+
.collapsibleQuote('• Added Streaming Text engine\n• Added Colored Buttons\n• Added Mini App Fullscreen & Motion\n• Added Adjustable Link Previews');
|
|
1463
|
+
|
|
1464
|
+
await ctx.replyWithRichMessage(card);
|
|
1465
|
+
});
|
|
1466
|
+
```
|
|
1467
|
+
|
|
1468
|
+
---
|
|
1469
|
+
|
|
1470
|
+
## 🔗 Adjustable Link Previews (`LinkPreview`)
|
|
1471
|
+
|
|
1472
|
+
Telegram Bot API 7.0+ replaced the legacy `disable_web_page_preview` flag with the granular `link_preview_options` object.
|
|
1473
|
+
|
|
1474
|
+
Telegix provides the fluent `LinkPreview` builder to control whether media appears above or below text, display large image cards or compact thumbnails, or override preview URLs:
|
|
1475
|
+
|
|
1476
|
+
```javascript
|
|
1477
|
+
import { LinkPreview } from 'telegix';
|
|
1478
|
+
|
|
1479
|
+
// 1. Fluent Builder pattern
|
|
1480
|
+
bot.command('preview_custom', async (ctx) => {
|
|
1481
|
+
const preview = LinkPreview.create('https://telegix.dev')
|
|
1482
|
+
.largeMedia() // Display large prominent card
|
|
1483
|
+
.aboveText() // Position preview above text
|
|
1484
|
+
.toJSON();
|
|
1485
|
+
|
|
1486
|
+
await ctx.reply('Check out the official documentation:', {
|
|
1487
|
+
link_preview_options: preview,
|
|
1488
|
+
});
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
// 2. Direct Context Helper: ctx.replyWithLinkPreview
|
|
1492
|
+
bot.command('docs', async (ctx) => {
|
|
1493
|
+
await ctx.replyWithLinkPreview(
|
|
1494
|
+
'Explore the Telegix GitHub repository:',
|
|
1495
|
+
LinkPreview.small('https://github.com/telegix/telegix', true) // Small thumbnail, above text
|
|
1496
|
+
);
|
|
1497
|
+
});
|
|
1498
|
+
|
|
1499
|
+
// 3. Static helper factories
|
|
1500
|
+
LinkPreview.disabled(); // Completely disables preview ({ is_disabled: true })
|
|
1501
|
+
LinkPreview.small('https://t.me'); // Shrinks media to small thumbnail
|
|
1502
|
+
LinkPreview.large('https://t.me'); // Expands media to large header card
|
|
1503
|
+
LinkPreview.above('https://t.me'); // Positions preview above message text
|
|
1504
|
+
LinkPreview.below('https://t.me'); // Positions preview below message text
|
|
1505
|
+
|
|
1506
|
+
// 4. Automatic normalization in all sendMessage / editMessageText calls
|
|
1507
|
+
await bot.telegram.sendMessage(chatId, 'https://example.com', {
|
|
1508
|
+
link_preview_options: LinkPreview.large('https://example.com'),
|
|
1509
|
+
});
|
|
1510
|
+
```
|
|
1511
|
+
|
|
1512
|
+
---
|
|
1513
|
+
|
|
1228
1514
|
## 💳 Payments, Invoices & Telegram Stars (`InvoiceBuilder`)
|
|
1229
1515
|
|
|
1230
1516
|
Create and dispatch invoices for fiat currencies or **Telegram Stars (`XTR`)**:
|
|
@@ -1267,27 +1553,182 @@ bot.on('successful_payment', async (ctx) => {
|
|
|
1267
1553
|
|
|
1268
1554
|
---
|
|
1269
1555
|
|
|
1270
|
-
## 📱 Telegram Mini Apps
|
|
1556
|
+
## 📱 Telegram Mini Apps Suite (`MiniApp` & Utilities)
|
|
1271
1557
|
|
|
1272
|
-
|
|
1558
|
+
Telegix provides a complete end-to-end toolkit for Telegram Mini Apps (TMAs), encompassing both **backend cryptographic validation / message preparation** and **client-side WebApp SDK bridging** for modern features like full-screen mode, 3D device motion tracking, and theme-adaptive loading screens.
|
|
1559
|
+
|
|
1560
|
+
### Mini App Authentication (`validateWebAppInitData`)
|
|
1561
|
+
|
|
1562
|
+
Verify incoming Mini App authentication requests securely on your server using Telegram's HMAC-SHA256 signature protocol:
|
|
1273
1563
|
|
|
1274
1564
|
```javascript
|
|
1275
1565
|
import { validateWebAppInitData, parseWebAppInitData } from 'telegix';
|
|
1276
1566
|
|
|
1277
|
-
//
|
|
1278
|
-
app.post('/api/auth
|
|
1567
|
+
// Express / Fastify / Node.js HTTP backend route:
|
|
1568
|
+
app.post('/api/tma/auth', (req, res) => {
|
|
1279
1569
|
const { initData } = req.body;
|
|
1280
|
-
|
|
1570
|
+
|
|
1571
|
+
// Cryptographically verifies hash with your bot token
|
|
1572
|
+
const isValid = validateWebAppInitData(initData, process.env.BOT_TOKEN, {
|
|
1573
|
+
maxAgeSeconds: 86400, // Reject if older than 24 hours
|
|
1574
|
+
});
|
|
1281
1575
|
|
|
1282
1576
|
if (!isValid) {
|
|
1283
|
-
return res.status(401).json({ error: '
|
|
1577
|
+
return res.status(401).json({ error: 'Unauthorized Mini App session' });
|
|
1284
1578
|
}
|
|
1285
1579
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1580
|
+
// Parse user profile, auth_date, and query_id safely
|
|
1581
|
+
const session = parseWebAppInitData(initData);
|
|
1582
|
+
console.log(`Authenticated TMA User: ${session.user.first_name} (ID: ${session.user.id})`);
|
|
1583
|
+
|
|
1584
|
+
return res.json({ success: true, user: session.user });
|
|
1288
1585
|
});
|
|
1289
1586
|
```
|
|
1290
1587
|
|
|
1588
|
+
### Launching Mini Apps from the Bot
|
|
1589
|
+
|
|
1590
|
+
```javascript
|
|
1591
|
+
import { createMiniAppLaunchUrl, Markup } from 'telegix';
|
|
1592
|
+
|
|
1593
|
+
// 1. Generate Direct TMA Link
|
|
1594
|
+
const launchUrl = createMiniAppLaunchUrl('MyBot', 'shop', 'referrer_123');
|
|
1595
|
+
// -> https://t.me/MyBot/shop?startapp=referrer_123
|
|
1596
|
+
|
|
1597
|
+
// 2. Reply to users with a WebApp button directly
|
|
1598
|
+
bot.command('app', async (ctx) => {
|
|
1599
|
+
await ctx.replyWithWebApp(
|
|
1600
|
+
'Welcome to our Mini App! Tap below to open:',
|
|
1601
|
+
'https://my-app.example.com',
|
|
1602
|
+
'🚀 Open WebApp'
|
|
1603
|
+
);
|
|
1604
|
+
});
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
### Full-Screen Mode
|
|
1608
|
+
|
|
1609
|
+
Telegram Mini Apps can expand to occupy the complete display height, hiding Telegram's top chrome:
|
|
1610
|
+
|
|
1611
|
+
```javascript
|
|
1612
|
+
import { MiniApp } from 'telegix';
|
|
1613
|
+
|
|
1614
|
+
// Inside your Mini App frontend (React, Vue, or Vanilla JS):
|
|
1615
|
+
if (MiniApp.isInsideTelegram()) {
|
|
1616
|
+
// Request full screen
|
|
1617
|
+
MiniApp.fullscreen.request();
|
|
1618
|
+
|
|
1619
|
+
// Listen for fullscreen state changes
|
|
1620
|
+
MiniApp.fullscreen.onChange((isFullscreen) => {
|
|
1621
|
+
console.log('Fullscreen active:', isFullscreen);
|
|
1622
|
+
});
|
|
1623
|
+
|
|
1624
|
+
// Handle failure / unsupported versions
|
|
1625
|
+
MiniApp.fullscreen.onFailed((err) => {
|
|
1626
|
+
console.warn('Fullscreen could not be enabled:', err);
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1629
|
+
// Check current status
|
|
1630
|
+
console.log('Is currently fullscreen:', MiniApp.fullscreen.isActive());
|
|
1631
|
+
}
|
|
1632
|
+
```
|
|
1633
|
+
|
|
1634
|
+
### Device Motion Tracking (Accelerometer, Orientation, Gyroscope)
|
|
1635
|
+
|
|
1636
|
+
Build immersive 3D games, VR experiences, or tilt-controlled interfaces directly within Telegram Mini Apps:
|
|
1637
|
+
|
|
1638
|
+
```javascript
|
|
1639
|
+
import { MiniApp } from 'telegix';
|
|
1640
|
+
|
|
1641
|
+
if (MiniApp.isInsideTelegram()) {
|
|
1642
|
+
// 1. Accelerometer (Linear acceleration in m/s²)
|
|
1643
|
+
MiniApp.motion.startAccelerometer({ refresh_rate: 20 });
|
|
1644
|
+
MiniApp.motion.onAccelerometer(({ x, y, z }) => {
|
|
1645
|
+
console.log(`Acceleration -> X: ${x.toFixed(2)}, Y: ${y.toFixed(2)}, Z: ${z.toFixed(2)}`);
|
|
1646
|
+
});
|
|
1647
|
+
|
|
1648
|
+
// 2. Device Orientation (Rotation in degrees)
|
|
1649
|
+
MiniApp.motion.startDeviceOrientation({ need_absolute: true });
|
|
1650
|
+
MiniApp.motion.onOrientation(({ alpha, beta, gamma, absolute }) => {
|
|
1651
|
+
console.log(`Tilt -> Alpha: ${alpha}, Beta (Pitch): ${beta}, Gamma (Roll): ${gamma}`);
|
|
1652
|
+
});
|
|
1653
|
+
|
|
1654
|
+
// 3. Gyroscope (Angular velocity in rad/s)
|
|
1655
|
+
MiniApp.motion.startGyroscope();
|
|
1656
|
+
MiniApp.motion.onGyroscope(({ x, y, z }) => {
|
|
1657
|
+
console.log(`Gyro -> X: ${x}, Y: ${y}, Z: ${z}`);
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
```
|
|
1661
|
+
|
|
1662
|
+
### Custom Loading Screen Generator (`MiniAppLoadingScreen`)
|
|
1663
|
+
|
|
1664
|
+
Deliver a polished, native launch experience while your frontend bundles load with theme-adaptive styles:
|
|
1665
|
+
|
|
1666
|
+
```javascript
|
|
1667
|
+
import { MiniAppLoadingScreen, generateMiniAppLoadingScreen } from 'telegix';
|
|
1668
|
+
|
|
1669
|
+
// 1. Generate full HTML loading splash
|
|
1670
|
+
const loadingHtml = generateMiniAppLoadingScreen({
|
|
1671
|
+
title: 'My Telegram WebApp',
|
|
1672
|
+
icon: 'https://my-app.example.com/logo.png',
|
|
1673
|
+
lightColor: '#2481cc',
|
|
1674
|
+
darkColor: '#53a8ff',
|
|
1675
|
+
skeleton: true, // Includes placeholder skeleton cards
|
|
1676
|
+
});
|
|
1677
|
+
|
|
1678
|
+
// 2. Or configure using the fluent MiniAppLoadingScreen builder
|
|
1679
|
+
const screen = new MiniAppLoadingScreen({
|
|
1680
|
+
title: 'Loading SuperApp...',
|
|
1681
|
+
skeleton: true,
|
|
1682
|
+
})
|
|
1683
|
+
.setColors('#007AFF', '#0A84FF')
|
|
1684
|
+
.setIcon('https://example.com/app-icon.svg');
|
|
1685
|
+
|
|
1686
|
+
// Output raw CSS or full HTML splash
|
|
1687
|
+
const splashCss = screen.toCSS();
|
|
1688
|
+
const splashHtml = screen.toHTML();
|
|
1689
|
+
```
|
|
1690
|
+
|
|
1691
|
+
### Home Screen & Prepared Inline Messages
|
|
1692
|
+
|
|
1693
|
+
Enable users to install your Mini App onto their phone's home screen and share dynamic game achievements directly into Telegram chats:
|
|
1694
|
+
|
|
1695
|
+
```javascript
|
|
1696
|
+
import { MiniApp } from 'telegix';
|
|
1697
|
+
|
|
1698
|
+
// 1. Add to Home Screen (PWA shortcut)
|
|
1699
|
+
MiniApp.homeScreen.addToHomeScreen();
|
|
1700
|
+
MiniApp.homeScreen.checkStatus((status) => {
|
|
1701
|
+
// 'unsupported' | 'unknown' | 'added' | 'missed'
|
|
1702
|
+
console.log('Home screen status:', status);
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
// 2. Prepared Inline Messages (Bot API 8.0+)
|
|
1706
|
+
// In your bot backend:
|
|
1707
|
+
bot.command('share_score', async (ctx) => {
|
|
1708
|
+
const prepared = await ctx.savePreparedInlineMessage({
|
|
1709
|
+
type: 'article',
|
|
1710
|
+
id: 'score_1',
|
|
1711
|
+
title: '🏆 High Score: 1,450 pts!',
|
|
1712
|
+
input_message_content: {
|
|
1713
|
+
message_text: '🎮 I just scored <b>1,450 points</b> in SuperApp! Can you beat me?',
|
|
1714
|
+
parse_mode: 'HTML',
|
|
1715
|
+
},
|
|
1716
|
+
});
|
|
1717
|
+
|
|
1718
|
+
// Send the prepared message ID to the Mini App frontend
|
|
1719
|
+
await ctx.reply(`Prepared Message ID: ${prepared.id}`);
|
|
1720
|
+
});
|
|
1721
|
+
|
|
1722
|
+
// In your Mini App frontend:
|
|
1723
|
+
// Triggers Telegram native chat selector to send the prepared message!
|
|
1724
|
+
MiniApp.sharePreparedMessage(preparedMessageId);
|
|
1725
|
+
|
|
1726
|
+
// 3. Native File Downloads & Haptic Feedback
|
|
1727
|
+
MiniApp.downloadFile({ url: 'https://example.com/receipt.pdf', file_name: 'receipt.pdf' });
|
|
1728
|
+
MiniApp.haptics.impact('medium');
|
|
1729
|
+
MiniApp.haptics.notification('success');
|
|
1730
|
+
```
|
|
1731
|
+
|
|
1291
1732
|
---
|
|
1292
1733
|
|
|
1293
1734
|
## 🤖 Multi-Bot Process Manager (`TelegixManager`)
|
|
@@ -1405,76 +1846,98 @@ bot.on('inline_query', async (ctx) => {
|
|
|
1405
1846
|
|
|
1406
1847
|
The `Telegram` client exposes every official method of the Telegram Bot API:
|
|
1407
1848
|
|
|
1849
|
+
### Updates & Webhooks
|
|
1850
|
+
- `getUpdates(options?)` — Receive incoming updates using long polling.
|
|
1851
|
+
- `setWebhook(url, options?)` — Specify a URL and receive incoming updates via outgoing webhook.
|
|
1852
|
+
- `deleteWebhook(options?)` — Remove webhook integration.
|
|
1853
|
+
- `getWebhookInfo()` — Get current webhook status.
|
|
1854
|
+
|
|
1408
1855
|
### Account & Identity
|
|
1409
|
-
- `getMe()` — Retrieve bot identity information.
|
|
1856
|
+
- `getMe()` — Retrieve bot identity information (ID, username, can join groups, etc.).
|
|
1410
1857
|
- `logOut()` / `close()` — Log out from the cloud Bot API or close the local bot instance.
|
|
1411
|
-
- `getMyName(extra)` / `setMyName(name, extra)` — Get or set bot name.
|
|
1412
|
-
- `getMyDescription(extra)` / `setMyDescription(description, extra)` — Get or set bot description.
|
|
1413
|
-
- `getMyShortDescription(extra)` / `setMyShortDescription(shortDescription, extra)` — Get or set short description.
|
|
1414
|
-
- `getMyCommands(extra)` / `setMyCommands(commands, extra)` / `deleteMyCommands(extra)` — Manage bot command menu list.
|
|
1415
|
-
- `getMyDefaultAdministratorRights(extra)` / `setMyDefaultAdministratorRights(rights, extra)` — Manage administrator rights.
|
|
1416
|
-
- `getChatMenuButton(extra)` / `setChatMenuButton(extra)` — Manage the chat menu button.
|
|
1858
|
+
- `getMyName(extra?)` / `setMyName(name, extra?)` — Get or set bot name.
|
|
1859
|
+
- `getMyDescription(extra?)` / `setMyDescription(description, extra?)` — Get or set bot description.
|
|
1860
|
+
- `getMyShortDescription(extra?)` / `setMyShortDescription(shortDescription, extra?)` — Get or set short description.
|
|
1861
|
+
- `getMyCommands(extra?)` / `setMyCommands(commands, extra?)` / `deleteMyCommands(extra?)` — Manage bot command menu list.
|
|
1862
|
+
- `getMyDefaultAdministratorRights(extra?)` / `setMyDefaultAdministratorRights(rights, extra?)` — Manage administrator rights.
|
|
1863
|
+
- `getChatMenuButton(extra?)` / `setChatMenuButton(extra?)` — Manage the chat menu button.
|
|
1417
1864
|
|
|
1418
1865
|
### Messages & Media Sending
|
|
1419
|
-
- `sendMessage(chatId, text, extra)`
|
|
1420
|
-
- `forwardMessage(chatId, fromChatId, messageId, extra)` / `forwardMessages(chatId, fromChatId, messageIds, extra)`
|
|
1421
|
-
- `copyMessage(chatId, fromChatId, messageId, extra)` / `copyMessages(chatId, fromChatId, messageIds, extra)`
|
|
1422
|
-
- `sendPhoto(chatId, photo, extra)`
|
|
1423
|
-
- `sendAudio(chatId, audio, extra)`
|
|
1424
|
-
- `sendDocument(chatId, document, extra)`
|
|
1425
|
-
- `sendVideo(chatId, video, extra)`
|
|
1426
|
-
- `sendAnimation(chatId, animation, extra)`
|
|
1427
|
-
- `sendVoice(chatId, voice, extra)`
|
|
1428
|
-
- `sendVideoNote(chatId, videoNote, extra)`
|
|
1429
|
-
- `sendPaidMedia(chatId, starCount, media, extra)`
|
|
1430
|
-
- `sendMediaGroup(chatId, media, extra)`
|
|
1431
|
-
- `sendLocation(chatId, latitude, longitude, extra)`
|
|
1432
|
-
- `sendVenue(chatId, latitude, longitude, title, address, extra)`
|
|
1433
|
-
- `sendContact(chatId, phoneNumber, firstName, extra)`
|
|
1434
|
-
- `sendPoll(chatId, question, options, extra)`
|
|
1435
|
-
- `sendDice(chatId, extra)`
|
|
1436
|
-
- `sendChatAction(chatId, action, extra)`
|
|
1437
|
-
- `setMessageReaction(chatId, messageId, reaction, extra)`
|
|
1438
|
-
- `sendSticker(chatId, sticker, extra)`
|
|
1439
|
-
- `sendGame(chatId, gameShortName, extra)`
|
|
1440
|
-
- `sendInvoice(chatId, title, description, payload, currency, prices, extra)`
|
|
1441
|
-
- `sendGift(userId, giftId, extra)`
|
|
1442
|
-
- `sendEphemeralMessage(chatId, text, ephemeralParameters, extra)`
|
|
1443
|
-
- `sendMessageDraft(chatId, text, extra)`
|
|
1444
|
-
- `sendRichMessage(chatId, richMessage, extra)`
|
|
1445
|
-
- `sendRichMessageDraft(chatId, draft, extra)`
|
|
1866
|
+
- `sendMessage(chatId, text, extra?)`
|
|
1867
|
+
- `forwardMessage(chatId, fromChatId, messageId, extra?)` / `forwardMessages(chatId, fromChatId, messageIds, extra?)`
|
|
1868
|
+
- `copyMessage(chatId, fromChatId, messageId, extra?)` / `copyMessages(chatId, fromChatId, messageIds, extra?)`
|
|
1869
|
+
- `sendPhoto(chatId, photo, extra?)`
|
|
1870
|
+
- `sendAudio(chatId, audio, extra?)`
|
|
1871
|
+
- `sendDocument(chatId, document, extra?)`
|
|
1872
|
+
- `sendVideo(chatId, video, extra?)`
|
|
1873
|
+
- `sendAnimation(chatId, animation, extra?)`
|
|
1874
|
+
- `sendVoice(chatId, voice, extra?)`
|
|
1875
|
+
- `sendVideoNote(chatId, videoNote, extra?)`
|
|
1876
|
+
- `sendPaidMedia(chatId, starCount, media, extra?)`
|
|
1877
|
+
- `sendMediaGroup(chatId, media, extra?)`
|
|
1878
|
+
- `sendLocation(chatId, latitude, longitude, extra?)`
|
|
1879
|
+
- `sendVenue(chatId, latitude, longitude, title, address, extra?)`
|
|
1880
|
+
- `sendContact(chatId, phoneNumber, firstName, extra?)`
|
|
1881
|
+
- `sendPoll(chatId, question, options, extra?)`
|
|
1882
|
+
- `sendDice(chatId, extra?)`
|
|
1883
|
+
- `sendChatAction(chatId, action, extra?)`
|
|
1884
|
+
- `setMessageReaction(chatId, messageId, reaction, extra?)`
|
|
1885
|
+
- `sendSticker(chatId, sticker, extra?)`
|
|
1886
|
+
- `sendGame(chatId, gameShortName, extra?)`
|
|
1887
|
+
- `sendInvoice(chatId, title, description, payload, currency, prices, extra?)`
|
|
1888
|
+
- `sendGift(userId, giftId, extra?)`
|
|
1889
|
+
- `sendEphemeralMessage(chatId, text, ephemeralParameters, extra?)`
|
|
1890
|
+
- `sendMessageDraft(chatId, text, extra?)`
|
|
1891
|
+
- `sendRichMessage(chatId, richMessage, extra?)`
|
|
1892
|
+
- `sendRichMessageDraft(chatId, draft, extra?)`
|
|
1893
|
+
|
|
1894
|
+
### Streaming & Real-Time Engines
|
|
1895
|
+
- `streamText(chatId, textStream, options?)` — Stream real-time tokens with adaptive edit throttling.
|
|
1896
|
+
- `streamDraft(chatId, textStream, options?)` — Stream real-time message drafts into chat preview.
|
|
1446
1897
|
|
|
1447
1898
|
### Messages Editing & Deletion
|
|
1448
|
-
- `editMessageText(chatId, messageId, inlineMessageId, text, extra)`
|
|
1449
|
-
- `editMessageCaption(chatId, messageId, inlineMessageId, caption, extra)`
|
|
1450
|
-
- `editMessageMedia(chatId, messageId, inlineMessageId, media, extra)`
|
|
1451
|
-
- `editMessageReplyMarkup(chatId, messageId, inlineMessageId, replyMarkup, extra)`
|
|
1452
|
-
- `editRichMessageText(chatId, messageId, richMessage, extra)`
|
|
1453
|
-
- `editRichMessageCaption(chatId, messageId, caption, extra)`
|
|
1899
|
+
- `editMessageText(chatId, messageId, inlineMessageId, text, extra?)`
|
|
1900
|
+
- `editMessageCaption(chatId, messageId, inlineMessageId, caption, extra?)`
|
|
1901
|
+
- `editMessageMedia(chatId, messageId, inlineMessageId, media, extra?)`
|
|
1902
|
+
- `editMessageReplyMarkup(chatId, messageId, inlineMessageId, replyMarkup, extra?)`
|
|
1903
|
+
- `editRichMessageText(chatId, messageId, richMessage, extra?)`
|
|
1904
|
+
- `editRichMessageCaption(chatId, messageId, caption, extra?)`
|
|
1454
1905
|
- `deleteMessage(chatId, messageId)`
|
|
1455
1906
|
- `deleteMessages(chatId, messageIds)`
|
|
1456
|
-
- `editMessageLiveLocation(latitude, longitude, extra)` / `stopMessageLiveLocation(extra)`
|
|
1457
|
-
- `stopPoll(chatId, messageId, extra)`
|
|
1907
|
+
- `editMessageLiveLocation(latitude, longitude, extra?)` / `stopMessageLiveLocation(extra?)`
|
|
1908
|
+
- `stopPoll(chatId, messageId, extra?)`
|
|
1909
|
+
|
|
1910
|
+
### Inline Mode & Mini Apps
|
|
1911
|
+
- `answerInlineQuery(inlineQueryId, results, extra?)`
|
|
1912
|
+
- `answerWebAppQuery(webAppQueryId, result)`
|
|
1913
|
+
- `savePreparedInlineMessage(userId, result, extra?)` — Save prepared inline message for Mini App sharing (**Bot API 8.0+**).
|
|
1914
|
+
|
|
1915
|
+
### Payments & Telegram Stars
|
|
1916
|
+
- `createInvoiceLink(title, description, payload, currency, prices, extra?)`
|
|
1917
|
+
- `answerShippingQuery(shippingQueryId, ok, extra?)`
|
|
1918
|
+
- `answerPreCheckoutQuery(preCheckoutQueryId, ok, extra?)`
|
|
1919
|
+
- `refundStarPayment(userId, telegramPaymentChargeId, extra?)`
|
|
1920
|
+
- `getStarTransactions(extra?)`
|
|
1458
1921
|
|
|
1459
1922
|
### Chat Moderation & Administration
|
|
1460
1923
|
- `getChat(chatId)`
|
|
1461
1924
|
- `getChatAdministrators(chatId)`
|
|
1462
1925
|
- `getChatMemberCount(chatId)` / `getChatMembersCount(chatId)`
|
|
1463
1926
|
- `getChatMember(chatId, userId)`
|
|
1464
|
-
- `banChatMember(chatId, userId, extra)`
|
|
1465
|
-
- `unbanChatMember(chatId, userId, extra)`
|
|
1466
|
-
- `restrictChatMember(chatId, userId, permissions, extra)`
|
|
1927
|
+
- `banChatMember(chatId, userId, extra?)`
|
|
1928
|
+
- `unbanChatMember(chatId, userId, extra?)`
|
|
1929
|
+
- `restrictChatMember(chatId, userId, permissions, extra?)`
|
|
1467
1930
|
- `promoteChatMember(chatId, userId, rights)`
|
|
1468
1931
|
- `setChatAdministratorCustomTitle(chatId, userId, customTitle)`
|
|
1469
|
-
- `setChatPermissions(chatId, permissions, extra)`
|
|
1932
|
+
- `setChatPermissions(chatId, permissions, extra?)`
|
|
1470
1933
|
- `setChatTitle(chatId, title)`
|
|
1471
1934
|
- `setChatDescription(chatId, description)`
|
|
1472
1935
|
- `setChatPhoto(chatId, photo)` / `deleteChatPhoto(chatId)`
|
|
1473
|
-
- `pinChatMessage(chatId, messageId, extra)` / `unpinChatMessage(chatId, messageId)` / `unpinAllChatMessages(chatId)`
|
|
1936
|
+
- `pinChatMessage(chatId, messageId, extra?)` / `unpinChatMessage(chatId, messageId)` / `unpinAllChatMessages(chatId)`
|
|
1474
1937
|
- `leaveChat(chatId)`
|
|
1475
1938
|
- `exportChatInviteLink(chatId)`
|
|
1476
|
-
- `createChatInviteLink(chatId, extra)`
|
|
1477
|
-
- `editChatInviteLink(chatId, inviteLink, extra)`
|
|
1939
|
+
- `createChatInviteLink(chatId, extra?)`
|
|
1940
|
+
- `editChatInviteLink(chatId, inviteLink, extra?)`
|
|
1478
1941
|
- `revokeChatInviteLink(chatId, inviteLink)`
|
|
1479
1942
|
- `approveChatJoinRequest(chatId, userId)`
|
|
1480
1943
|
- `declineChatJoinRequest(chatId, userId)`
|
|
@@ -1485,9 +1948,22 @@ The `Telegram` client exposes every official method of the Telegram Bot API:
|
|
|
1485
1948
|
- `getUserChatBoosts(chatId, userId)`
|
|
1486
1949
|
- `getBusinessConnection(businessConnectionId)`
|
|
1487
1950
|
|
|
1951
|
+
### Stickers & Custom Emojis
|
|
1952
|
+
- `getStickerSet(name)`
|
|
1953
|
+
- `getCustomEmojiStickers(customEmojiIds)`
|
|
1954
|
+
- `uploadStickerFile(userId, sticker, stickerFormat)`
|
|
1955
|
+
- `createNewStickerSet(userId, name, title, stickers, extra?)`
|
|
1956
|
+
- `addStickerToSet(userId, name, sticker)`
|
|
1957
|
+
- `setStickerPositionInSet(sticker, position)`
|
|
1958
|
+
- `deleteStickerFromSet(sticker)`
|
|
1959
|
+
- `setStickerSetThumbnail(name, userId, thumbnail, format)`
|
|
1960
|
+
- `setCustomEmojiStickerSetThumbnail(name, customEmojiId)`
|
|
1961
|
+
- `setStickerSetTitle(name, title)`
|
|
1962
|
+
- `deleteStickerSet(name)`
|
|
1963
|
+
|
|
1488
1964
|
### Forum Topics Management
|
|
1489
|
-
- `createForumTopic(chatId, name, extra)`
|
|
1490
|
-
- `editForumTopic(chatId, messageThreadId, extra)`
|
|
1965
|
+
- `createForumTopic(chatId, name, extra?)`
|
|
1966
|
+
- `editForumTopic(chatId, messageThreadId, extra?)`
|
|
1491
1967
|
- `closeForumTopic(chatId, messageThreadId)`
|
|
1492
1968
|
- `reopenForumTopic(chatId, messageThreadId)`
|
|
1493
1969
|
- `deleteForumTopic(chatId, messageThreadId)`
|
|
@@ -1499,9 +1975,9 @@ The `Telegram` client exposes every official method of the Telegram Bot API:
|
|
|
1499
1975
|
- `unhideGeneralForumTopic(chatId)`
|
|
1500
1976
|
|
|
1501
1977
|
### Managed Bot Access Settings (Bot API 10.3)
|
|
1502
|
-
- `getManagedBotAccessSettings(userId, extra)`
|
|
1503
|
-
- `setManagedBotAccessSettings(userId, settings, extra)`
|
|
1504
|
-
- `getUserPersonalChatMessages(userId, extra)`
|
|
1978
|
+
- `getManagedBotAccessSettings(userId, extra?)`
|
|
1979
|
+
- `setManagedBotAccessSettings(userId, settings, extra?)`
|
|
1980
|
+
- `getUserPersonalChatMessages(userId, extra?)`
|
|
1505
1981
|
|
|
1506
1982
|
---
|
|
1507
1983
|
|