Skip to content

Commit

Permalink
feat: Update to Bot API 6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
MKRhere committed Aug 27, 2023
1 parent 8dbdd78 commit 024a88a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Types for the Telegram Bot API [![Deno shield](https://img.shields.io/static/v1?label=Built%20for&message=Deno&style=flat-square&logo=deno&labelColor=000&color=fff)](https://deno.land/x/telegraf_types)

[![Bot API Version](https://img.shields.io/badge/Bot%20API-v6.7-f36caf.svg?style=flat-square&logo=Telegram&labelColor=white&color=blue)](https://core.telegram.org/bots/api) [![NPM version](https://img.shields.io/npm/v/@telegraf/types?style=flat-square&logo=npm&labelColor=fff&color=c53635)](https://npmjs.com/package/@telegraf/types)
[![Bot API Version](https://img.shields.io/badge/Bot%20API-v6.8-f36caf.svg?style=flat-square&logo=Telegram&labelColor=white&color=blue)](https://core.telegram.org/bots/api) [![NPM version](https://img.shields.io/npm/v/@telegraf/types?style=flat-square&logo=npm&labelColor=fff&color=c53635)](https://npmjs.com/package/@telegraf/types)

This project is a fork of [@KnorpelSenf/typegram](https://github.com/KnorpelSenf/typegram), specialised for Telegraf. Typegram is legacy, and now backported from [@grammyjs/types](https://github.com/grammyjs/types).

Expand Down
10 changes: 6 additions & 4 deletions manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export interface WebhookInfo {
/** Currently used webhook IP address */
ip_address?: string;
/** Unix time for the most recent error that happened when trying to deliver an update via webhook */
last_error_date: number;
last_error_date?: number;
/** Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */
last_error_message: string;
last_error_message?: string;
/** Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */
last_synchronization_error_date?: number;
/** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
max_connections: number;
max_connections?: number;
/** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
allowed_updates: string[];
allowed_updates?: string[];
}

/** This object represents a Telegram user or bot. */
Expand Down Expand Up @@ -144,6 +144,8 @@ export declare namespace Chat {
extends PrivateChat, NonGroupGetChat, GetChat {
/** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
emoji_status_custom_emoji_id?: string;
/** Expiration date of the emoji status of the other party in a private chat, if any. Returned only in getChat. */
emoji_status_expiration_date?: number;
/** Bio of the other party in a private chat. Returned only in getChat. */
bio?: string;
/** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. */
Expand Down
4 changes: 1 addition & 3 deletions markup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export declare namespace InlineKeyboardButton {
login_url: LoginUrl;
}
export interface SwitchInlineButton extends AbstractInlineKeyboardButton {
/** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted.
Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm... actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. */
/** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted. */
switch_inline_query: string;
}
export interface SwitchInlineCurrentChatButton
Expand Down
23 changes: 18 additions & 5 deletions message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export declare namespace Message {
/** Message is a sticker, information about the sticker */
sticker: Sticker;
}
export interface StoryMessage extends CommonMessage {
/** Message is a forwarded story. Currently holds no information */
story: Story;
}
export interface VideoMessage extends MediaMessage {
/** Message is a video, information about the video */
video: Video;
Expand Down Expand Up @@ -291,6 +295,7 @@ export type CommonMessageBundle =
| Message.PhotoMessage
| Message.PollMessage
| Message.StickerMessage
| Message.StoryMessage
| Message.TextMessage
| Message.VenueMessage
| Message.VideoMessage
Expand Down Expand Up @@ -356,11 +361,11 @@ Please note:
- Any character with code between 1 and 126 inclusively can be escaped anywhere with a preceding '\' character, in which case it is treated as an ordinary character and not a part of the markup. This implies that '\' character usually must be escaped with a preceding '\' character.
- Inside `pre` and `code` entities, all '`' and '\' characters must be escaped with a preceding '\' character.
- Inside `(...)` part of inline link definition, all ')' and '\' must be escaped with a preceding '\' character.
- A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
- Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
- Inside the `(...)` part of the inline link and custom emoji definition, all ')' and '\' must be escaped with a preceding '\' character.
- In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'.
- In case of ambiguity between `italic` and `underline` entities `__` is always greadily treated from left to right as beginning or end of `underline` entity, so instead of `___italic underline___` use `___italic underline_\r__`, where `\r` is a character with code 13, which will be ignored.
- A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
- Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
#### HTML style
To use this mode, pass *HTML* in the *parse_mode* field. The following tags are currently supported:
Expand Down Expand Up @@ -629,8 +634,13 @@ export interface PollOption {
export interface PollAnswer {
/** Unique poll identifier */
poll_id: string;
/** The user, who changed the answer to the poll */
user: User;
/** The chat that changed the answer to the poll, if the voter is anonymous */
voter_chat?: Chat;
/** The user, who changed the answer to the poll, if the voter isn't anonymous
*
* For backward compatibility, the field user will contain the user 136817688 (@Channel_Bot) if the voter was a chat
*/
user?: User;
/** 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */
option_ids: number[];
}
Expand Down Expand Up @@ -705,6 +715,9 @@ export interface Venue {
google_place_type?: string;
}

/** This object represents a message about a forwarded story in the chat. Currently holds no information. */
export interface Story {}

/** This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. */
export interface ProximityAlertTriggered {
/** User that triggered the alert */
Expand Down
8 changes: 7 additions & 1 deletion methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,12 @@ export type ApiMethods<F> = {
chat_id: number | string;
}): true;

/** Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. */
unpinAllGeneralForumTopicMessages(
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
chat_id: number | string,
): true;

/** Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */
Expand Down Expand Up @@ -1464,7 +1470,7 @@ export type ApiMethods<F> = {
results: readonly InlineQueryResult[];
/** The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. */
cache_time?: number;
/** Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query */
/** Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. */
is_personal?: boolean;
/** Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. */
next_offset?: string;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@telegraf/types",
"private": false,
"version": "6.7.0",
"version": "6.8.0",
"description": "Type declarations for the Telegram API",
"main": "mod.js",
"repository": {
Expand Down

0 comments on commit 024a88a

Please sign in to comment.