Skip to content

Commit

Permalink
merge: #1 from telegraf/feat/api-7.0
Browse files Browse the repository at this point in the history
API 7.0
  • Loading branch information
MKRhere authored Feb 8, 2024
2 parents 5dabe7d + 4fb8ca2 commit 4e700ab
Show file tree
Hide file tree
Showing 9 changed files with 772 additions and 224 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.fixAll": true },
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"deno.enable": true,
"deno.config": "./deno.jsonc",
"deno.lint": true,
Expand Down
2 changes: 1 addition & 1 deletion api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type ApiResponse<T> = ApiError | ApiSuccess<T>;

/** Describes why a request was unsuccessful. */
export interface ResponseParameters {
/** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
/** The group has been migrated to a supergroup with the specified identifier. */
migrate_to_chat_id?: number;
/** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */
retry_after?: number;
Expand Down
11 changes: 8 additions & 3 deletions inline.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import type { Chat, User } from "./manage.ts";
import type { InlineKeyboardMarkup, WebAppInfo } from "./markup.ts";
import type { Location, MessageEntity, ParseMode } from "./message.ts";
import type {
LinkPreviewOptions,
Location,
MessageEntity,
ParseMode,
} from "./message.ts";
import type { LabeledPrice } from "./payment.ts";

/** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */
Expand Down Expand Up @@ -622,8 +627,8 @@ export interface InputTextMessageContent {
parse_mode?: ParseMode;
/** List of special entities that appear in message text, which can be specified instead of parse_mode */
entities?: MessageEntity[];
/** Disables link previews for links in the sent message */
disable_web_page_preview?: boolean;
/** Options used for link preview generation for the original message, if it is a text message */
link_preview_options?: LinkPreviewOptions;
}

/** Represents the content of a location message to be sent as the result of an inline query. */
Expand Down
250 changes: 204 additions & 46 deletions manage.ts

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions markup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ChatAdministratorRights, User } from "./manage.ts";
import type { Message } from "./message.ts";
import type { MaybeInaccessibleMessage } from "./message.ts";

/** This object represents an inline keyboard that appears right next to the message it belongs to. */
export interface InlineKeyboardMarkup {
Expand Down Expand Up @@ -108,8 +108,8 @@ export declare namespace CallbackQuery {
id: string;
/** Sender */
from: User;
/** Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old */
message?: Message;
/** Message sent by the bot with the callback button that originated the query */
message?: MaybeInaccessibleMessage;
/** Identifier of the message sent via the bot in inline mode, that originated the query. */
inline_message_id?: string;
/** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */
Expand Down Expand Up @@ -157,9 +157,9 @@ export declare namespace KeyboardButton {
/** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
text: string;
}
export interface RequestUserButton extends CommonButton {
/** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
request_user: KeyboardButtonRequestUser;
export interface RequestUsersButton extends CommonButton {
/** If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */
request_users: KeyboardButtonRequestUsers;
}
export interface RequestChatButton extends CommonButton {
/** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
Expand All @@ -186,7 +186,7 @@ export declare namespace KeyboardButton {
/** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
export type KeyboardButton =
| KeyboardButton.CommonButton
| KeyboardButton.RequestUserButton
| KeyboardButton.RequestUsersButton
| KeyboardButton.RequestChatButton
| KeyboardButton.RequestContactButton
| KeyboardButton.RequestLocationButton
Expand Down Expand Up @@ -234,14 +234,16 @@ export interface WebAppInfo {
url: string;
}

/** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. */
export interface KeyboardButtonRequestUser {
/** Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message */
/** This object defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed. */
export interface KeyboardButtonRequestUsers {
/** Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message. */
request_id: number;
/** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
/** Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied. */
user_is_bot?: boolean;
/** Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
/** Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied. */
user_is_premium?: boolean;
/** The maximum number of users to be selected; 1-10. Defaults to 1. */
max_quantity?: number;
}

/** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */
Expand Down
Loading

0 comments on commit 4e700ab

Please sign in to comment.