Skip to content

Commit

Permalink
Bot API 7.8 (#21)
Browse files Browse the repository at this point in the history
- Added the option for bots to set a Main Mini App, which can be previewed and launched directly from a button in the bot's profile or a link.
- Added the method shareToStory to the class WebApp.
  • Loading branch information
DavisDmitry authored Aug 2, 2024
1 parent 0d79268 commit 69da206
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="https://npmjs.com/package/telegram-webapps"><img alt="npm" src="https://img.shields.io/npm/dt/telegram-webapps"/></a>
</p>
<p align="center">
<a href="https://core.telegram.org/bots/webapps"><img alt="Telegram Bot API Version 7.7" src="https://img.shields.io/badge/Telegram%20Bot%20API-7.7-blue.svg?logo=telegram"/></a>
<a href="https://core.telegram.org/bots/webapps"><img alt="Telegram Bot API Version 7.8" src="https://img.shields.io/badge/Telegram%20Bot%20API-7.8-blue.svg?logo=telegram"/></a>
</p>
<p align="center">
<a href="https://github.com/DavisDmitry/telegram-webapps/actions/workflows/lint.yml"><img alt="CI Lint" src="https://github.com/DavisDmitry/telegram-webapps/actions/workflows/lint.yml/badge.svg"/></a>
Expand Down Expand Up @@ -47,7 +47,7 @@ Include the types file inside your [ `tsconfig.json` ](https://www.typescriptlan
```diff
{
"compilerOptions": {
"typeRoots": [
"types": [
+ "./node_modules/telegram-webapps"
]
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "telegram-webapps",
"version": "7.7.0",
"version": "7.8.0",
"description": "Typings for Telegram Mini Apps",
"keywords": [
"telegram",
Expand Down
37 changes: 37 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@ export declare namespace TelegramWebApps {
* invoice status will be passed as the first argument.
*/
openInvoice(url: string, callback?: InvoiceClosedEventHandler): void
/**
* `Bot API 7.8+` A method that opens the native story editor with the media specified
* in the *media_url* parameter as an HTTPS URL. An optional *params* argument of the
* type StoryShareParams describes additional sharing settings.
*/
shareToStory(media_url: string, params?: StoryShareParams): void
/**
* `Bot API 6.2+` A method that shows a native popup described by the *params*
* argument of the type PopupParams. The Web App will receive the event *popupClosed*
Expand Down Expand Up @@ -642,6 +648,37 @@ export declare namespace TelegramWebApps {
destructive_text_color?: string
}

/**
* This object describes additional sharing settings for the native story editor.
*/
interface StoryShareParams {
/**
* The caption to be added to the media, 0-200 characters for regular users and 0-2048
* characters for premium subscribers.
*/
text?: string
/**
* An object that describes a widget link to be included in the story. Note that only
* premium subscribers can post stories with links.
*/
widget_link?: StoryWidgetLink
}

/**
* This object describes a widget link to be included in the story.
*/

interface StoryWidgetLink {
/**
* The URL to be included in the story.
*/
url: string
/**
* The name to be displayed for the widget link, 0-48 characters.
*/
name?: string
}

/**
* This object describes the native popup.
*/
Expand Down

0 comments on commit 69da206

Please sign in to comment.