Skip to content

Commit 6f22714

Browse files
🤖 Merge PR DefinitelyTyped#74896 [telegram-web-app] add support for Bot API 9.6 by @SecondThundeR
1 parent a17ae8f commit 6f22714

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎types/telegram-web-app/index.d.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,18 @@ export interface WebApp {
616616
*/
617617
requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void;
618618

619+
/**
620+
* A method that opens a dialog allowing the user to select an existing chat
621+
* or create a new one. If an optional _callback_ parameter is provided,
622+
* the _callback_ function will be called with a boolean as the first argument,
623+
* indicating whether the message was successfully sent.
624+
* The request id passed to this method must belong to a {@link https://core.telegram.org/bots/api#preparedkeyboardbutton | PreparedKeyboardButton}
625+
* previously obtained via the Bot API method {@link https://core.telegram.org/bots/api#savepreparedkeyboardbutton | savePreparedKeyboardButton}.
626+
*
627+
* @since Bot API 9.6+
628+
*/
629+
requestChat(req_id: string, callback?: (success: boolean) => void): void;
630+
619631
/**
620632
* A method that informs the Telegram app that the Mini App is ready to be displayed.
621633
* It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded.

‎types/telegram-web-app/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/telegram-web-app",
4-
"version": "9.5.9999",
4+
"version": "9.6.9999",
55
"nonNpm": "conflict",
66
"nonNpmDescription": "telegram-web-app",
77
"projects": ["https://telegram.org/js/telegram-web-app.js"],

‎types/telegram-web-app/telegram-web-app-tests.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,7 @@ app.SecondaryButton.iconCustomEmojiId; // $ExpectType string
138138
app.SecondaryButton.setParams({
139139
icon_custom_emoji_id: "", // $ExpectType string
140140
});
141+
142+
app.requestChat("req_id", (success) => {
143+
success; // $ExpectType boolean
144+
});

0 commit comments

Comments
 (0)