commit
This commit is contained in:
parent
be4fd23bcf
commit
0bd53741af
728 changed files with 86573 additions and 0 deletions
8
node_modules/typegram/.editorconfig
generated
vendored
Normal file
8
node_modules/typegram/.editorconfig
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
max_line_length = 80
|
13
node_modules/typegram/.github/FUNDING.yml
generated
vendored
Normal file
13
node_modules/typegram/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [KnorpelSenf]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
21
node_modules/typegram/LICENSE
generated
vendored
Normal file
21
node_modules/typegram/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 KnorpelSenf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
172
node_modules/typegram/README.md
generated
vendored
Normal file
172
node_modules/typegram/README.md
generated
vendored
Normal file
|
@ -0,0 +1,172 @@
|
|||
# Types for the Telegram Bot API
|
||||
|
||||
> Please consider contributing to [@grammyjs/types](https://github.com/grammyjs/types) instead.
|
||||
> `typegram` is legacy and will not be updated directly anymore.
|
||||
> Instead, [@grammyjs/types](https://github.com/grammyjs/types) is maintained and kept in sync with the Bot API specification.
|
||||
> Changes are backported to `typegram` periodically to keep older projects running.
|
||||
|
||||
This project provides TypeScript types for the entire [Telegram Bot API](https://core.telegram.org/bots/api) in version 5.6.
|
||||
|
||||
It contains zero bytes of executable code.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install --save-dev typegram
|
||||
```
|
||||
|
||||
## Available Types
|
||||
|
||||
Generally this package just exposes a huge load of `interface`s that correspond to the **types** used throughout the Telegram Bot API.
|
||||
|
||||
Note that the API specification sometimes only has one name for multiple variants of a type, e.g. there is a number of different `Update`s you can receive, but they're all just called `Update`.
|
||||
This package represents such types as large unions of all possible options of what an `Update` could be, such that type narrowing can work as expected on your side.
|
||||
If you need to access the individual variants of an `Update`, refer to `Update.MessageUpdate` and its siblings.
|
||||
|
||||
In fact, this pattern is used for various types, namely:
|
||||
|
||||
- `CallbackQuery`
|
||||
- `Chat`
|
||||
- `ChatFromGetChat`
|
||||
- `InlineKeyboardButton`
|
||||
- `KeyboardButton`
|
||||
- `Message`
|
||||
- `MessageEntity`
|
||||
- `Location`
|
||||
- `Update`
|
||||
|
||||
(Naturally, when the API specification is actually modelling types to be unions (e.g. `InlineQueryResult`), this is reflected here as a union type, too.)
|
||||
|
||||
## Available Methods
|
||||
|
||||
In addition to the types, this package provides you with another type `Telegram` which contains all available **methods** of the API.
|
||||
There is no further structure applied to this, but if you can come up with something reasonable, please suggest it in an issue or directly open a PR.
|
||||
|
||||
Each method takes just a single argument with a structure that corresponds to the object expected by Telegram.
|
||||
If you need to directly access that type, consider using `Opts<M>` where `M` is the method name (e.g. `Opts<'getMe'>`).
|
||||
|
||||
Note that `Opts<M>` will give you an empty object type (i.e. `{}`) for methods that do not take any parameters.
|
||||
That is to say, it will not give you a type error or `undefined` (as opposed to something like `Parameters<Telegram['getMe']>[0]`).
|
||||
|
||||
## Caveat with JSON-Serialized Objects
|
||||
|
||||
Some methods of the Telegram Bot API are expected to be called with JSON-serialized objects contained in a property of the payload, rather than an actual JSON payload.
|
||||
In other words, the objects are serialized twice—the first time in order to conform with the docs, and the second time when the payload is actually sent in the POST body to the API server.
|
||||
|
||||
The most prominent example is the `reply_markup` property that appears in a number of different methods, but more than a dozen other properties like this can be found throughout the API.
|
||||
|
||||
Strictly speaking, the `typegram` types do not reflect this accurately.
|
||||
Instead of using `string` (representing a serialized object) as the type, `typegram` uses the type of the object itself, thus ignoring the serialization step.
|
||||
For instance, instead of declaring `reply_markup: string`, it declares the property as `reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply` because that is what is supposed to be serialized to `string` before calling the respective method.
|
||||
|
||||
This makes sense for two reasons.
|
||||
|
||||
1. The goal of this library is to provide type safety.
|
||||
However, the contents of a string cannot be typechecked for being valid JSON of the correct object.
|
||||
As a result, we would be missing type safety if we would only model the properties as `string`.
|
||||
2. A common use case for this library is to pull the types into some wrapper code around the Telegram Bot API.
|
||||
This wrapper code often does the necessary JSON serialization automatically for the required properties.
|
||||
The consumer then does not need to care about which properties to serialize and which not.
|
||||
Given that `typegram` refers to the objects themselves instead of their serialized strings, the wrapper code can now simply expose the `typegram` types to its consumers without having to transform them before.
|
||||
|
||||
## Using Promises
|
||||
|
||||
All of the methods are specified with the actual return type of the Telegram Bot API.
|
||||
If you need them to return `Promise`s instead, consider using `TelegramP`.
|
||||
This type maps all methods of `Telegram` to a promisified version.
|
||||
|
||||
## Using API Response Objects
|
||||
|
||||
The Telegram Bot API does not return just the requested data in the body of the response objects.
|
||||
Instead, they are wrapped inside an object that has an `ok: boolean` status flag, indicating success or failure of the preceding API request.
|
||||
This outer object is modelled in `typegram` by the `ApiResponse` type.
|
||||
|
||||
If you need the methods of `Telegram` to return `ApiResponse` objects instead of the raw data, consider using `TelegramR`.
|
||||
This works analogously to `TelegramP`.
|
||||
The type maps all methods of `Telegram` to a version where they return `ApiResponse` objects of the data, instead of the data themselves.
|
||||
|
||||
## Using Both Promises and API Response Objects
|
||||
|
||||
Yes.
|
||||
`TelegramPR`.
|
||||
|
||||
## Customizing `InputFile`
|
||||
|
||||
The Telegram Bot API lets bots send files in [three different ways](https://core.telegram.org/bots/api#sending-files).
|
||||
Two of those ways are by specifying a `string`—either a `file_id` or a URL.
|
||||
The third option, however, is by uploading files to the server using multipart/form-data.
|
||||
|
||||
The first two means to send a file are already covered by the type annotations across the library.
|
||||
In all places where a `file_id` or a URL is permitted, the corresponding property allows a `string`.
|
||||
|
||||
We will now look at the type declarations that are relevant for uploading files directly.
|
||||
Depending on the code you're using the `typegram` types for, you may want to support different ways to specify the file to be uploaded.
|
||||
As an example, you may want to be able to make calls to `sendDocument` with an object that conforms to `{ path: string }` in order to specify the location of a local file.
|
||||
(Your code is then assumed to able to translate calls to `sendDocument` and the like to multipart/form-data uploads when supplied with an object alike `{ path: '/tmp/file.txt' }` in the `document` property of the argument object.)
|
||||
|
||||
`typegram` cannot possibly know what objects you want to support as `InputFile`s.
|
||||
Consequently, the exposed type `InputFile` is merely an alias for `never`.
|
||||
|
||||
However, you can specify your own version of what an `InputFile` is, hence effectively creating a completely new version of `typegram` with your custom `InputFile` type used throughout all affected methods and interfaces.
|
||||
This is possible by what we call a _proxy type_.
|
||||
|
||||
For instance, let's stick with our example and say that you want to support `InputFile`s of the following type.
|
||||
|
||||
```ts
|
||||
interface MyInputFile {
|
||||
path: string;
|
||||
}
|
||||
```
|
||||
|
||||
You can then customize `typegram` to fit your needs by
|
||||
|
||||
1. importing the magical `Typegram` proxy type and
|
||||
2. setting this alias:
|
||||
|
||||
```ts
|
||||
import { Typegram } from "typegram";
|
||||
|
||||
type MyTypegram = Typegram<MyInputFile>;
|
||||
```
|
||||
|
||||
You can now access all types that must respect `MyInputFile` through the `MyTypegram` type:
|
||||
|
||||
```ts
|
||||
// The `Telegram` type that contains all API methods:
|
||||
type Telegram = MyTypegram["Telegram"]; // analogous for `TelegramP`, `TelegramR`, and `TelegramPR`
|
||||
|
||||
// The utility type `Opts`:
|
||||
type Opts<M extends keyof Telegram> = MyTypegram["Opts"][M];
|
||||
|
||||
// The adjusted `InputMedia*` types:
|
||||
type InputMedia = MyTypegram["InputMedia"];
|
||||
type InputMediaPhoto = MyTypegram["InputMediaPhoto"];
|
||||
type InputMediaVideo = MyTypegram["InputMediaVideo"];
|
||||
type InputMediaAnimation = MyTypegram["InputMediaAnimation"];
|
||||
type InputMediaAudio = MyTypegram["InputMediaAudio"];
|
||||
type InputMediaDocument = MyTypegram["InputMediaDocument"];
|
||||
```
|
||||
|
||||
In fact, if you are using the type annotations of `typegram` without relying on the `Typegram` proxy type, you are actually still using a default proxy type under the hood.
|
||||
The declaration of this default proxy type may help you to define your own version.
|
||||
Check out [the default.d.ts file](https://github.com/KnorpelSenf/typegram/blob/master/default.d.ts).
|
||||
|
||||
Note that interfaces other than the ones mentioned above are unaffected by the customization through `MyInputFile`.
|
||||
They can simply continue to be imported directly from `typegram`.
|
||||
|
||||
## Where Do the Types Come from
|
||||
|
||||
They're handwritten.
|
||||
|
||||
That is, they're of course not entirely handwritten.
|
||||
The initial version of them were produced in one afternoon by a combination of copying and pasting from the website, VIM magic, regular expressions, and VSCode auto-formatting the rest.
|
||||
|
||||
After that, some more work and a few community contributions did the polishing.
|
||||
|
||||
Subsequent updates to the API were integrated manually in a similar fashion.
|
||||
|
||||
Other people's previous attempts to harvest the types directly from the website using a script failed due to the required effort of handling special cases about the layout of the website.
|
||||
|
||||
The [grammY](https://github.com/grammyjs/grammY) bot framework was orginally based on `typegram` which served as the starting point for [the grammY types package](https://github.com/grammyjs/types).
|
||||
Starting after the upgrade to Bot API 5.0, most changes and updates to `typegram` were simply `git cherry-pick`ed from this repository.
|
||||
If you want to contribute to `typegram`, it may makes sense to add them to grammY first and then can easily be backported to `typegram`.
|
25
node_modules/typegram/api.d.ts
generated
vendored
Normal file
25
node_modules/typegram/api.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
export interface ApiError {
|
||||
ok: false;
|
||||
error_code: number;
|
||||
description: string;
|
||||
parameters?: ResponseParameters;
|
||||
}
|
||||
|
||||
export interface ApiSuccess<T> {
|
||||
ok: true;
|
||||
result: T;
|
||||
}
|
||||
|
||||
/** The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals true, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.
|
||||
|
||||
All methods in the Bot API are case-insensitive.
|
||||
All queries must be made using UTF-8. */
|
||||
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. */
|
||||
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;
|
||||
}
|
39
node_modules/typegram/default.d.ts
generated
vendored
Normal file
39
node_modules/typegram/default.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { Typegram } from "./proxied";
|
||||
|
||||
/** This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser. */
|
||||
export type InputFile = never;
|
||||
|
||||
type DefaultTypegram = Typegram<InputFile>;
|
||||
|
||||
/** Wrapper type to bundle all methods of the Telegram API */
|
||||
export type Telegram = DefaultTypegram["Telegram"];
|
||||
|
||||
/** Utility type providing the argument type for the given method name or `{}` if the method does not take any parameters */
|
||||
export type Opts<
|
||||
M extends keyof DefaultTypegram["Telegram"],
|
||||
> = DefaultTypegram["Opts"][M];
|
||||
|
||||
/** Utility type providing a promisified version of Telegram */
|
||||
export type TelegramP = DefaultTypegram["TelegramP"];
|
||||
/** Utility type providing a version Telegram where all methods return ApiResponse objects instead of raw data */
|
||||
export type TelegramR = DefaultTypegram["TelegramR"];
|
||||
/** Utility type providing a version Telegram where all methods return Promises of ApiResponse objects, combination of TelegramP and TelegramR */
|
||||
export type TelegramPR = DefaultTypegram["TelegramPR"];
|
||||
|
||||
/** This object represents the content of a media message to be sent. It should be one of
|
||||
- InputMediaAnimation
|
||||
- InputMediaDocument
|
||||
- InputMediaAudio
|
||||
- InputMediaPhoto
|
||||
- InputMediaVideo */
|
||||
export type InputMedia = DefaultTypegram["InputMedia"];
|
||||
/** Represents a photo to be sent. */
|
||||
export type InputMediaPhoto = DefaultTypegram["InputMediaPhoto"];
|
||||
/** Represents a video to be sent. */
|
||||
export type InputMediaVideo = DefaultTypegram["InputMediaVideo"];
|
||||
/** Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. */
|
||||
export type InputMediaAnimation = DefaultTypegram["InputMediaAnimation"];
|
||||
/** Represents an audio file to be treated as music to be sent. */
|
||||
export type InputMediaAudio = DefaultTypegram["InputMediaAudio"];
|
||||
/** Represents a general file to be sent. */
|
||||
export type InputMediaDocument = DefaultTypegram["InputMediaDocument"];
|
11
node_modules/typegram/index.d.ts
generated
vendored
Normal file
11
node_modules/typegram/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
export * from "./api";
|
||||
export * from "./default";
|
||||
export * from "./inline";
|
||||
export * from "./manage";
|
||||
export * from "./markup";
|
||||
export * from "./menu-button";
|
||||
export * from "./message";
|
||||
export * from "./passport";
|
||||
export * from "./payment";
|
||||
export * from "./proxied";
|
||||
export * from "./update";
|
0
node_modules/typegram/index.js
generated
vendored
Normal file
0
node_modules/typegram/index.js
generated
vendored
Normal file
724
node_modules/typegram/inline.d.ts
generated
vendored
Normal file
724
node_modules/typegram/inline.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,724 @@
|
|||
import { Chat, User } from "./manage";
|
||||
import { InlineKeyboardMarkup } from "./markup";
|
||||
import { Location, MessageEntity, ParseMode } from "./message";
|
||||
import { LabeledPrice } from "./payment";
|
||||
|
||||
/** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */
|
||||
export interface InlineQuery {
|
||||
/** Unique identifier for this query */
|
||||
id: string;
|
||||
/** Sender */
|
||||
from: User;
|
||||
/** Text of the query (up to 256 characters) */
|
||||
query: string;
|
||||
/** Offset of the results to be returned, can be controlled by the bot */
|
||||
offset: string;
|
||||
/** Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */
|
||||
chat_type?: "sender" | Chat["type"];
|
||||
/** Sender location, only for bots that request user location */
|
||||
location?: Location;
|
||||
}
|
||||
|
||||
/** This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
|
||||
- InlineQueryResultCachedAudio
|
||||
- InlineQueryResultCachedDocument
|
||||
- InlineQueryResultCachedGif
|
||||
- InlineQueryResultCachedMpeg4Gif
|
||||
- InlineQueryResultCachedPhoto
|
||||
- InlineQueryResultCachedSticker
|
||||
- InlineQueryResultCachedVideo
|
||||
- InlineQueryResultCachedVoice
|
||||
- InlineQueryResultArticle
|
||||
- InlineQueryResultAudio
|
||||
- InlineQueryResultContact
|
||||
- InlineQueryResultGame
|
||||
- InlineQueryResultDocument
|
||||
- InlineQueryResultGif
|
||||
- InlineQueryResultLocation
|
||||
- InlineQueryResultMpeg4Gif
|
||||
- InlineQueryResultPhoto
|
||||
- InlineQueryResultVenue
|
||||
- InlineQueryResultVideo
|
||||
- InlineQueryResultVoice
|
||||
|
||||
Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public. */
|
||||
export type InlineQueryResult =
|
||||
| InlineQueryResultCachedAudio
|
||||
| InlineQueryResultCachedDocument
|
||||
| InlineQueryResultCachedGif
|
||||
| InlineQueryResultCachedMpeg4Gif
|
||||
| InlineQueryResultCachedPhoto
|
||||
| InlineQueryResultCachedSticker
|
||||
| InlineQueryResultCachedVideo
|
||||
| InlineQueryResultCachedVoice
|
||||
| InlineQueryResultArticle
|
||||
| InlineQueryResultAudio
|
||||
| InlineQueryResultContact
|
||||
| InlineQueryResultGame
|
||||
| InlineQueryResultDocument
|
||||
| InlineQueryResultGif
|
||||
| InlineQueryResultLocation
|
||||
| InlineQueryResultMpeg4Gif
|
||||
| InlineQueryResultPhoto
|
||||
| InlineQueryResultVenue
|
||||
| InlineQueryResultVideo
|
||||
| InlineQueryResultVoice;
|
||||
|
||||
/** Represents a link to an article or web page. */
|
||||
export interface InlineQueryResultArticle {
|
||||
/** Type of the result, must be article */
|
||||
type: "article";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Title of the result */
|
||||
title: string;
|
||||
/** Content of the message to be sent */
|
||||
input_message_content: InputMessageContent;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** URL of the result */
|
||||
url?: string;
|
||||
/** Pass True if you don't want the URL to be shown in the message */
|
||||
hide_url?: boolean;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumb_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumb_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumb_height?: number;
|
||||
}
|
||||
|
||||
/** Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */
|
||||
export interface InlineQueryResultPhoto {
|
||||
/** Type of the result, must be photo */
|
||||
type: "photo";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB */
|
||||
photo_url: string;
|
||||
/** URL of the thumbnail for the photo */
|
||||
thumb_url: string;
|
||||
/** Width of the photo */
|
||||
photo_width?: number;
|
||||
/** Height of the photo */
|
||||
photo_height?: number;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the photo to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the photo caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the photo */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
|
||||
export interface InlineQueryResultGif {
|
||||
/** Type of the result, must be gif */
|
||||
type: "gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the GIF file. File size must not exceed 1MB */
|
||||
gif_url: string;
|
||||
/** Width of the GIF */
|
||||
gif_width?: number;
|
||||
/** Height of the GIF */
|
||||
gif_height?: number;
|
||||
/** Duration of the GIF in seconds */
|
||||
gif_duration?: number;
|
||||
/** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
|
||||
thumb_url: string;
|
||||
/** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */
|
||||
thumb_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the GIF animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
|
||||
export interface InlineQueryResultMpeg4Gif {
|
||||
/** Type of the result, must be mpeg4_gif */
|
||||
type: "mpeg4_gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the MPEG4 file. File size must not exceed 1MB */
|
||||
mpeg4_url: string;
|
||||
/** Video width */
|
||||
mpeg4_width?: number;
|
||||
/** Video height */
|
||||
mpeg4_height?: number;
|
||||
/** Video duration in seconds */
|
||||
mpeg4_duration?: number;
|
||||
/** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
|
||||
thumb_url: string;
|
||||
/** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */
|
||||
thumb_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
|
||||
|
||||
If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. */
|
||||
export interface InlineQueryResultVideo {
|
||||
/** Type of the result, must be video */
|
||||
type: "video";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the embedded video player or video file */
|
||||
video_url: string;
|
||||
/** MIME type of the content of the video URL, “text/html” or “video/mp4” */
|
||||
mime_type: "text/html" | "video/mp4";
|
||||
/** URL of the thumbnail (JPEG only) for the video */
|
||||
thumb_url: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** Caption of the video to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the video caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Video width */
|
||||
video_width?: number;
|
||||
/** Video height */
|
||||
video_height?: number;
|
||||
/** Video duration in seconds */
|
||||
video_duration?: number;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultAudio {
|
||||
/** Type of the result, must be audio */
|
||||
type: "audio";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the audio file */
|
||||
audio_url: string;
|
||||
/** Title */
|
||||
title: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the audio caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Performer */
|
||||
performer?: string;
|
||||
/** Audio duration in seconds */
|
||||
audio_duration?: number;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the audio */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultVoice {
|
||||
/** Type of the result, must be voice */
|
||||
type: "voice";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the voice recording */
|
||||
voice_url: string;
|
||||
/** Recording title */
|
||||
title: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the voice message caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Recording duration in seconds */
|
||||
voice_duration?: number;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the voice recording */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultDocument {
|
||||
/** Type of the result, must be document */
|
||||
type: "document";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** Caption of the document to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the document caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** A valid URL for the file */
|
||||
document_url: string;
|
||||
/** MIME type of the content of the file, either “application/pdf” or “application/zip” */
|
||||
mime_type: "application/pdf" | "application/zip";
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the file */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** URL of the thumbnail (JPEG only) for the file */
|
||||
thumb_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumb_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumb_height?: number;
|
||||
}
|
||||
|
||||
/** Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultLocation {
|
||||
/** Type of the result, must be location */
|
||||
type: "location";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Location latitude in degrees */
|
||||
latitude: number;
|
||||
/** Location longitude in degrees */
|
||||
longitude: number;
|
||||
/** Location title */
|
||||
title: string;
|
||||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */
|
||||
horizontal_accuracy?: number;
|
||||
/** Period in seconds for which the location can be updated, should be between 60 and 86400. */
|
||||
live_period?: number;
|
||||
/** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
|
||||
heading?: number;
|
||||
/** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
|
||||
proximity_alert_radius?: number;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the location */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumb_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumb_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumb_height?: number;
|
||||
}
|
||||
|
||||
/** Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultVenue {
|
||||
/** Type of the result, must be venue */
|
||||
type: "venue";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Latitude of the venue location in degrees */
|
||||
latitude: number;
|
||||
/** Longitude of the venue location in degrees */
|
||||
longitude: number;
|
||||
/** Title of the venue */
|
||||
title: string;
|
||||
/** Address of the venue */
|
||||
address: string;
|
||||
/** Foursquare identifier of the venue if known */
|
||||
foursquare_id?: string;
|
||||
/** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
|
||||
foursquare_type?: string;
|
||||
/** Google Places identifier of the venue */
|
||||
google_place_id?: string;
|
||||
/** Google Places type of the venue. (See supported types.) */
|
||||
google_place_type?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the venue */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumb_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumb_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumb_height?: number;
|
||||
}
|
||||
|
||||
/** Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultContact {
|
||||
/** Type of the result, must be contact */
|
||||
type: "contact";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Contact's phone number */
|
||||
phone_number: string;
|
||||
/** Contact's first name */
|
||||
first_name: string;
|
||||
/** Contact's last name */
|
||||
last_name?: string;
|
||||
/** Additional data about the contact in the form of a vCard, 0-2048 bytes */
|
||||
vcard?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the contact */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumb_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumb_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumb_height?: number;
|
||||
}
|
||||
|
||||
/** Represents a Game.
|
||||
|
||||
Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them. */
|
||||
export interface InlineQueryResultGame {
|
||||
/** Type of the result, must be game */
|
||||
type: "game";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** Short name of the game */
|
||||
game_short_name: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
}
|
||||
|
||||
/** Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */
|
||||
export interface InlineQueryResultCachedPhoto {
|
||||
/** Type of the result, must be photo */
|
||||
type: "photo";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier of the photo */
|
||||
photo_file_id: string;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the photo to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the photo caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the photo */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. */
|
||||
export interface InlineQueryResultCachedGif {
|
||||
/** Type of the result, must be gif */
|
||||
type: "gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the GIF file */
|
||||
gif_file_id: string;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the GIF animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
|
||||
export interface InlineQueryResultCachedMpeg4Gif {
|
||||
/** Type of the result, must be mpeg4_gif */
|
||||
type: "mpeg4_gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the MPEG4 file */
|
||||
mpeg4_file_id: string;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them.
|
||||
*/
|
||||
export interface InlineQueryResultCachedSticker {
|
||||
/** Type of the result, must be sticker */
|
||||
type: "sticker";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier of the sticker */
|
||||
sticker_file_id: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the sticker */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultCachedDocument {
|
||||
/** Type of the result, must be document */
|
||||
type: "document";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** A valid file identifier for the file */
|
||||
document_file_id: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the document to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the document caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the file */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. */
|
||||
export interface InlineQueryResultCachedVideo {
|
||||
/** Type of the result, must be video */
|
||||
type: "video";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the video file */
|
||||
video_file_id: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the video to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the video caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultCachedVoice {
|
||||
/** Type of the result, must be voice */
|
||||
type: "voice";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the voice message */
|
||||
voice_file_id: string;
|
||||
/** Voice message title */
|
||||
title: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the voice message caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the voice message */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultCachedAudio {
|
||||
/** Type of the result, must be audio */
|
||||
type: "audio";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the audio file */
|
||||
audio_file_id: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the audio caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the audio */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
|
||||
/** This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
|
||||
|
||||
- InputTextMessageContent
|
||||
- InputLocationMessageContent
|
||||
- InputVenueMessageContent
|
||||
- InputContactMessageContent
|
||||
- InputInvoiceMessageContent */
|
||||
export type InputMessageContent =
|
||||
| InputTextMessageContent
|
||||
| InputLocationMessageContent
|
||||
| InputVenueMessageContent
|
||||
| InputContactMessageContent
|
||||
| InputInvoiceMessageContent;
|
||||
|
||||
/** Represents the content of a text message to be sent as the result of an inline query. */
|
||||
export interface InputTextMessageContent {
|
||||
/** Text of the message to be sent, 1-4096 characters */
|
||||
message_text: string;
|
||||
/** Mode for parsing entities in the message text. See formatting options for more details. */
|
||||
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;
|
||||
}
|
||||
|
||||
/** Represents the content of a location message to be sent as the result of an inline query. */
|
||||
export interface InputLocationMessageContent {
|
||||
/** Latitude of the location in degrees */
|
||||
latitude: number;
|
||||
/** Longitude of the location in degrees */
|
||||
longitude: number;
|
||||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */
|
||||
horizontal_accuracy?: number;
|
||||
/** Period in seconds for which the location can be updated, should be between 60 and 86400. */
|
||||
live_period?: number;
|
||||
/** For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */
|
||||
heading?: number;
|
||||
/** For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */
|
||||
proximity_alert_radius?: number;
|
||||
}
|
||||
|
||||
/** Represents the content of a venue message to be sent as the result of an inline query. */
|
||||
export interface InputVenueMessageContent {
|
||||
/** Latitude of the venue in degrees */
|
||||
latitude: number;
|
||||
/** Longitude of the venue in degrees */
|
||||
longitude: number;
|
||||
/** Name of the venue */
|
||||
title: string;
|
||||
/** Address of the venue */
|
||||
address: string;
|
||||
/** Foursquare identifier of the venue, if known */
|
||||
foursquare_id?: string;
|
||||
/** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
|
||||
foursquare_type?: string;
|
||||
/** Google Places identifier of the venue */
|
||||
google_place_id?: string;
|
||||
/** Google Places type of the venue. (See supported types.) */
|
||||
google_place_type?: string;
|
||||
}
|
||||
|
||||
/** Represents the content of a contact message to be sent as the result of an inline query. */
|
||||
export interface InputContactMessageContent {
|
||||
/** Contact's phone number */
|
||||
phone_number: string;
|
||||
/** Contact's first name */
|
||||
first_name: string;
|
||||
/** Contact's last name */
|
||||
last_name?: string;
|
||||
/** Additional data about the contact in the form of a vCard, 0-2048 bytes */
|
||||
vcard?: string;
|
||||
}
|
||||
|
||||
/** Represents the content of an invoice message to be sent as the result of an inline query. */
|
||||
export interface InputInvoiceMessageContent {
|
||||
/** Product name, 1-32 characters */
|
||||
title: string;
|
||||
/** Product description, 1-255 characters */
|
||||
description: string;
|
||||
/** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
|
||||
payload: string;
|
||||
/** Payment provider token, obtained via BotFather */
|
||||
provider_token: string;
|
||||
/** Three-letter ISO 4217 currency code, see more on currencies */
|
||||
currency: string;
|
||||
/** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
|
||||
prices: LabeledPrice[];
|
||||
/** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */
|
||||
max_tip_amount?: number;
|
||||
/** An array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */
|
||||
suggested_tip_amounts?: number[];
|
||||
/** Data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */
|
||||
provider_data?: string;
|
||||
/** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */
|
||||
photo_url?: string;
|
||||
/** Photo size in bytes */
|
||||
photo_size?: number;
|
||||
/** Photo width */
|
||||
photo_width?: number;
|
||||
/** Photo height */
|
||||
photo_height?: number;
|
||||
/** Pass True if you require the user's full name to complete the order */
|
||||
need_name?: boolean;
|
||||
/** Pass True if you require the user's phone number to complete the order */
|
||||
need_phone_number?: boolean;
|
||||
/** Pass True if you require the user's email address to complete the order */
|
||||
need_email?: boolean;
|
||||
/** Pass True if you require the user's shipping address to complete the order */
|
||||
need_shipping_address?: boolean;
|
||||
/** Pass True if the user's phone number should be sent to provider */
|
||||
send_phone_number_to_provider?: boolean;
|
||||
/** Pass True if the user's email address should be sent to provider */
|
||||
send_email_to_provider?: boolean;
|
||||
/** Pass True if the final price depends on the shipping method */
|
||||
is_flexible?: boolean;
|
||||
}
|
||||
|
||||
/** Represents a result of an inline query that was chosen by the user and sent to their chat partner.
|
||||
|
||||
Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. */
|
||||
export interface ChosenInlineResult {
|
||||
/** The unique identifier for the result that was chosen */
|
||||
result_id: string;
|
||||
/** The user that chose the result */
|
||||
from: User;
|
||||
/** Sender location, only for bots that require user location */
|
||||
location?: Location;
|
||||
/** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. */
|
||||
inline_message_id?: string;
|
||||
/** The query that was used to obtain the result */
|
||||
query: string;
|
||||
}
|
437
node_modules/typegram/manage.d.ts
generated
vendored
Normal file
437
node_modules/typegram/manage.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,437 @@
|
|||
import { Location, Message, PhotoSize } from "./message";
|
||||
|
||||
/** Describes the current status of a webhook. */
|
||||
export interface WebhookInfo {
|
||||
/** Webhook URL, may be empty if webhook is not set up */
|
||||
url?: string;
|
||||
/** True, if a custom certificate was provided for webhook certificate checks */
|
||||
has_custom_certificate: boolean;
|
||||
/** Number of updates awaiting delivery */
|
||||
pending_update_count: number;
|
||||
/** 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;
|
||||
/** 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;
|
||||
/** 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;
|
||||
/** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
|
||||
allowed_updates: string[];
|
||||
}
|
||||
|
||||
/** This object represents a Telegram user or bot. */
|
||||
export interface User {
|
||||
/** Unique identifier for this user or bot. 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 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
id: number;
|
||||
/** True, if this user is a bot */
|
||||
is_bot: boolean;
|
||||
/** User's or bot's first name */
|
||||
first_name: string;
|
||||
/** User's or bot's last name */
|
||||
last_name?: string;
|
||||
/** User's or bot's username */
|
||||
username?: string;
|
||||
/** IETF language tag of the user's language */
|
||||
language_code?: string;
|
||||
/** True, if this user is a Telegram Premium user */
|
||||
is_premium?: true;
|
||||
/** True, if this user added the bot to the attachment menu */
|
||||
added_to_attachment_menu?: true;
|
||||
}
|
||||
|
||||
/** This object represents a Telegram user or bot that was returned by `getMe`. */
|
||||
export interface UserFromGetMe extends User {
|
||||
is_bot: true;
|
||||
username: string;
|
||||
/** True, if the bot can be invited to groups. Returned only in getMe. */
|
||||
can_join_groups: boolean;
|
||||
/** True, if privacy mode is disabled for the bot. Returned only in getMe. */
|
||||
can_read_all_group_messages: boolean;
|
||||
/** True, if the bot supports inline queries. Returned only in getMe. */
|
||||
supports_inline_queries: boolean;
|
||||
}
|
||||
|
||||
export namespace Chat {
|
||||
// ABSTRACT
|
||||
/** Internal type holding properties that all kinds of chats share. */
|
||||
interface AbstractChat {
|
||||
/** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
|
||||
type: string;
|
||||
/** Unique identifier for this chat. 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. */
|
||||
id: number;
|
||||
}
|
||||
|
||||
// HELPERS
|
||||
/** Internal type holding properties that those chats with user names share. */
|
||||
interface UserNameChat {
|
||||
/** Username, for private chats, supergroups and channels if available */
|
||||
username?: string;
|
||||
}
|
||||
/** Internal type holding properties that those chats with titles share. */
|
||||
interface TitleChat {
|
||||
/** Title, for supergroups, channels and group chats */
|
||||
title: string;
|
||||
}
|
||||
|
||||
// ==> CHATS
|
||||
/** Internal type representing private chats. */
|
||||
export interface PrivateChat extends AbstractChat, UserNameChat {
|
||||
type: "private";
|
||||
/** First name of the other party in a private chat */
|
||||
first_name: string;
|
||||
/** Last name of the other party in a private chat */
|
||||
last_name?: string;
|
||||
}
|
||||
/** Internal type representing group chats. */
|
||||
export interface GroupChat extends AbstractChat, TitleChat {
|
||||
type: "group";
|
||||
}
|
||||
/** Internal type representing super group chats. */
|
||||
export interface SupergroupChat
|
||||
extends AbstractChat, UserNameChat, TitleChat {
|
||||
type: "supergroup";
|
||||
}
|
||||
/** Internal type representing channel chats. */
|
||||
export interface ChannelChat extends AbstractChat, UserNameChat, TitleChat {
|
||||
type: "channel";
|
||||
}
|
||||
|
||||
// GET CHAT HELPERS
|
||||
/** Internal type holding properties that those chats returned from `getChat` share. */
|
||||
interface GetChat {
|
||||
/** Chat photo. Returned only in getChat. */
|
||||
photo?: ChatPhoto;
|
||||
/** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
|
||||
join_to_send_messages?: true;
|
||||
/** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */
|
||||
join_by_request?: true;
|
||||
/** The most recent pinned message (by sending date). Returned only in getChat. */
|
||||
pinned_message?: Message;
|
||||
/** The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */
|
||||
message_auto_delete_time?: number;
|
||||
/** True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */
|
||||
has_protected_content?: true;
|
||||
}
|
||||
/** Internal type holding properties that those group, supergroup, and channel chats returned from `getChat` share. */
|
||||
interface NonPrivateGetChat extends GetChat {
|
||||
/** Description, for groups, supergroups and channel chats. Returned only in getChat. */
|
||||
description?: string;
|
||||
/** Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */
|
||||
invite_link?: string;
|
||||
}
|
||||
/** Internal type holding properties that those group and supergroup chats returned from `getChat` share. */
|
||||
interface MultiUserGetChat extends NonPrivateGetChat {
|
||||
/** Default chat member permissions, for groups and supergroups. Returned only in getChat. */
|
||||
permissions?: ChatPermissions;
|
||||
/** True, if the bot can change the group sticker set. Returned only in getChat. */
|
||||
can_set_sticker_set?: true;
|
||||
}
|
||||
/** Internal type holding properties that those supergroup and channel chats returned from `getChat` share. */
|
||||
interface LargeGetChat extends NonPrivateGetChat {
|
||||
/** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. */
|
||||
linked_chat_id?: number;
|
||||
}
|
||||
|
||||
// ==> GET CHATS
|
||||
/** Internal type representing private chats returned from `getChat`. */
|
||||
export interface PrivateGetChat extends PrivateChat, GetChat {
|
||||
/** 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. */
|
||||
has_private_forwards?: true;
|
||||
/** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. */
|
||||
has_restricted_voice_and_video_messages?: true;
|
||||
}
|
||||
/** Internal type representing group chats returned from `getChat`. */
|
||||
export interface GroupGetChat extends GroupChat, MultiUserGetChat {}
|
||||
/** Internal type representing supergroup chats returned from `getChat`. */
|
||||
export interface SupergroupGetChat
|
||||
extends SupergroupChat, MultiUserGetChat, LargeGetChat {
|
||||
/** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
|
||||
slow_mode_delay?: number;
|
||||
/** For supergroups, name of group sticker set. Returned only in getChat. */
|
||||
sticker_set_name?: string;
|
||||
/** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
|
||||
location?: ChatLocation;
|
||||
}
|
||||
/** Internal type representing channel chats returned from `getChat`. */
|
||||
export interface ChannelGetChat extends ChannelChat, LargeGetChat {}
|
||||
}
|
||||
|
||||
/** This object represents a chat. */
|
||||
export type Chat =
|
||||
| Chat.PrivateChat
|
||||
| Chat.GroupChat
|
||||
| Chat.SupergroupChat
|
||||
| Chat.ChannelChat;
|
||||
|
||||
/** This object represents a Telegram user or bot that was returned by `getChat`. */
|
||||
export type ChatFromGetChat =
|
||||
| Chat.PrivateGetChat
|
||||
| Chat.GroupGetChat
|
||||
| Chat.SupergroupGetChat
|
||||
| Chat.ChannelGetChat;
|
||||
|
||||
/** This object represent a user's profile pictures. */
|
||||
export interface UserProfilePhotos {
|
||||
/** Total number of profile pictures the target user has */
|
||||
total_count: number;
|
||||
/** Requested profile pictures (in up to 4 sizes each) */
|
||||
photos: PhotoSize[][];
|
||||
}
|
||||
|
||||
/** This object represents a chat photo. */
|
||||
export interface ChatPhoto {
|
||||
/** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
|
||||
small_file_id: string;
|
||||
/** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
small_file_unique_id: string;
|
||||
/** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
|
||||
big_file_id: string;
|
||||
/** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
big_file_unique_id: string;
|
||||
}
|
||||
|
||||
/** Represents an invite link for a chat. */
|
||||
export interface ChatInviteLink {
|
||||
/** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. */
|
||||
invite_link: string;
|
||||
/** Creator of the link */
|
||||
creator: User;
|
||||
/** True, if users joining the chat via the link need to be approved by chat administrators */
|
||||
creates_join_request: boolean;
|
||||
/** True, if the link is primary */
|
||||
is_primary: boolean;
|
||||
/** True, if the link is revoked */
|
||||
is_revoked: boolean;
|
||||
/** Invite link name */
|
||||
name?: string;
|
||||
/** Point in time (Unix timestamp) when the link will expire or has been expired */
|
||||
expire_date?: number;
|
||||
/** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
|
||||
member_limit?: number;
|
||||
/** Number of pending join requests created using this link */
|
||||
pending_join_request_count?: number;
|
||||
}
|
||||
|
||||
/** Represents the rights of an administrator in a chat. */
|
||||
export interface ChatAdministratorRights {
|
||||
/** True, if the user's presence in the chat is hidden */
|
||||
is_anonymous: boolean;
|
||||
/** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
|
||||
can_manage_chat: boolean;
|
||||
/** True, if the administrator can delete messages of other users */
|
||||
can_delete_messages: boolean;
|
||||
/** True, if the administrator can manage video chats */
|
||||
can_manage_video_chats: boolean;
|
||||
/** True, if the administrator can restrict, ban or unban chat members */
|
||||
can_restrict_members: boolean;
|
||||
/** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
|
||||
can_promote_members: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings */
|
||||
can_change_info: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users: boolean;
|
||||
/** True, if the administrator can post in the channel; channels only */
|
||||
can_post_messages?: boolean;
|
||||
/** True, if the administrator can edit messages of other users and can pin messages; channels only */
|
||||
can_edit_messages?: boolean;
|
||||
/** True, if the user is allowed to pin messages; groups and supergroups only */
|
||||
can_pin_messages?: boolean;
|
||||
}
|
||||
|
||||
/** This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
|
||||
- ChatMemberOwner
|
||||
- ChatMemberAdministrator
|
||||
- ChatMemberMember
|
||||
- ChatMemberRestricted
|
||||
- ChatMemberLeft
|
||||
- ChatMemberBanned */
|
||||
export type ChatMember =
|
||||
| ChatMemberOwner
|
||||
| ChatMemberAdministrator
|
||||
| ChatMemberMember
|
||||
| ChatMemberRestricted
|
||||
| ChatMemberLeft
|
||||
| ChatMemberBanned;
|
||||
|
||||
/** Represents a chat member that owns the chat and has all administrator privileges. */
|
||||
export interface ChatMemberOwner {
|
||||
/** The member's status in the chat, always “creator” */
|
||||
status: "creator";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** True, if the user's presence in the chat is hidden */
|
||||
is_anonymous: boolean;
|
||||
/** Custom title for this user */
|
||||
custom_title?: string;
|
||||
}
|
||||
|
||||
/** Represents a chat member that has some additional privileges. */
|
||||
export interface ChatMemberAdministrator {
|
||||
/** The member's status in the chat, always “administrator” */
|
||||
status: "administrator";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** True, if the bot is allowed to edit administrator privileges of that user */
|
||||
can_be_edited: boolean;
|
||||
/** True, if the user's presence in the chat is hidden */
|
||||
is_anonymous: boolean;
|
||||
/** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
|
||||
can_manage_chat: boolean;
|
||||
/** True, if the administrator can delete messages of other users */
|
||||
can_delete_messages: boolean;
|
||||
/** True, if the administrator can manage video chats */
|
||||
can_manage_video_chats: boolean;
|
||||
/** True, if the administrator can restrict, ban or unban chat members */
|
||||
can_restrict_members: boolean;
|
||||
/** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
|
||||
can_promote_members: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings */
|
||||
can_change_info: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users: boolean;
|
||||
/** True, if the administrator can post in the channel; channels only */
|
||||
can_post_messages?: boolean;
|
||||
/** True, if the administrator can edit messages of other users and can pin messages; channels only */
|
||||
can_edit_messages?: boolean;
|
||||
/** True, if the user is allowed to pin messages; groups and supergroups only */
|
||||
can_pin_messages?: boolean;
|
||||
/** Custom title for this user */
|
||||
custom_title?: string;
|
||||
}
|
||||
|
||||
/** Represents a chat member that has no additional privileges or restrictions. */
|
||||
export interface ChatMemberMember {
|
||||
/** The member's status in the chat, always “member” */
|
||||
status: "member";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
}
|
||||
|
||||
/** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
|
||||
export interface ChatMemberRestricted {
|
||||
/** The member's status in the chat, always “restricted” */
|
||||
status: "restricted";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** True, if the user is a member of the chat at the moment of the request */
|
||||
is_member: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings */
|
||||
can_change_info: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users: boolean;
|
||||
/** True, if the user is allowed to pin messages */
|
||||
can_pin_messages: boolean;
|
||||
/** True, if the user is allowed to send text messages, contacts, locations and venues */
|
||||
can_send_messages: boolean;
|
||||
/** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes */
|
||||
can_send_media_messages: boolean;
|
||||
/** True, if the user is allowed to send polls */
|
||||
can_send_polls: boolean;
|
||||
/** True, if the user is allowed to send animations, games, stickers and use inline bots */
|
||||
can_send_other_messages: boolean;
|
||||
/** True, if the user is allowed to add web page previews to their messages */
|
||||
can_add_web_page_previews: boolean;
|
||||
/** Date when restrictions will be lifted for this user; unix time */
|
||||
until_date: number;
|
||||
}
|
||||
|
||||
/** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */
|
||||
export interface ChatMemberLeft {
|
||||
/** The member's status in the chat, always “left” */
|
||||
status: "left";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
}
|
||||
|
||||
/** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */
|
||||
export interface ChatMemberBanned {
|
||||
/** The member's status in the chat, always “kicked” */
|
||||
status: "kicked";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** Date when restrictions will be lifted for this user; unix time */
|
||||
until_date: number;
|
||||
}
|
||||
|
||||
/** This object represents changes in the status of a chat member. */
|
||||
export interface ChatMemberUpdated {
|
||||
/** Chat the user belongs to */
|
||||
chat: Chat;
|
||||
/** Performer of the action, which resulted in the change */
|
||||
from: User;
|
||||
/** Date the change was done in Unix time */
|
||||
date: number;
|
||||
/** Previous information about the chat member */
|
||||
old_chat_member: ChatMember;
|
||||
/** New information about the chat member */
|
||||
new_chat_member: ChatMember;
|
||||
/** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
|
||||
invite_link?: ChatInviteLink;
|
||||
}
|
||||
|
||||
/** Represents a join request sent to a chat. */
|
||||
export interface ChatJoinRequest {
|
||||
/** Chat to which the request was sent */
|
||||
chat: Chat.SupergroupChat | Chat.ChannelChat;
|
||||
/** User that sent the join request */
|
||||
from: User;
|
||||
/** Date the request was sent in Unix time */
|
||||
date: number;
|
||||
/** Bio of the user. */
|
||||
bio?: string;
|
||||
/** Chat invite link that was used by the user to send the join request */
|
||||
invite_link?: ChatInviteLink;
|
||||
}
|
||||
|
||||
/** Describes actions that a non-administrator user is allowed to take in a chat. */
|
||||
export interface ChatPermissions {
|
||||
/** True, if the user is allowed to send text messages, contacts, locations and venues */
|
||||
can_send_messages?: boolean;
|
||||
/** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages */
|
||||
can_send_media_messages?: boolean;
|
||||
/** True, if the user is allowed to send polls, implies can_send_messages */
|
||||
can_send_polls?: boolean;
|
||||
/** True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages */
|
||||
can_send_other_messages?: boolean;
|
||||
/** True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages */
|
||||
can_add_web_page_previews?: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */
|
||||
can_change_info?: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users?: boolean;
|
||||
/** True, if the user is allowed to pin messages. Ignored in public supergroups */
|
||||
can_pin_messages?: boolean;
|
||||
}
|
||||
|
||||
/** Represents a location to which a chat is connected. */
|
||||
export interface ChatLocation {
|
||||
/** The location to which the supergroup is connected. Can't be a live location. */
|
||||
location: Location;
|
||||
/** Location address; 1-64 characters, as defined by the chat owner */
|
||||
address: string;
|
||||
}
|
||||
|
||||
/** This object represents a bot command. */
|
||||
export interface BotCommand {
|
||||
/** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */
|
||||
command: string;
|
||||
/** Description of the command; 1-256 characters. */
|
||||
description: string;
|
||||
}
|
||||
|
||||
/** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. */
|
||||
export interface File {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
/** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
|
||||
file_path?: string;
|
||||
}
|
193
node_modules/typegram/markup.d.ts
generated
vendored
Normal file
193
node_modules/typegram/markup.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
import { User } from "./manage";
|
||||
import { Message } from "./message";
|
||||
|
||||
/** This object represents an inline keyboard that appears right next to the message it belongs to. */
|
||||
export interface InlineKeyboardMarkup {
|
||||
/** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
|
||||
inline_keyboard: InlineKeyboardButton[][];
|
||||
}
|
||||
|
||||
export namespace InlineKeyboardButton {
|
||||
interface AbstractInlineKeyboardButton {
|
||||
/** Label text on the button */
|
||||
text: string;
|
||||
}
|
||||
export interface UrlButton extends AbstractInlineKeyboardButton {
|
||||
/** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
|
||||
url: string;
|
||||
}
|
||||
export interface CallbackButton extends AbstractInlineKeyboardButton {
|
||||
/** Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
|
||||
callback_data: string;
|
||||
}
|
||||
export interface WebAppButton extends AbstractInlineKeyboardButton {
|
||||
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */
|
||||
web_app: WebAppInfo;
|
||||
}
|
||||
export interface LoginButton extends AbstractInlineKeyboardButton {
|
||||
/** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
|
||||
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. */
|
||||
switch_inline_query: string;
|
||||
}
|
||||
export interface SwitchInlineCurrentChatButton
|
||||
extends AbstractInlineKeyboardButton {
|
||||
/** If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.
|
||||
|
||||
This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. */
|
||||
switch_inline_query_current_chat: string;
|
||||
}
|
||||
export interface GameButton extends AbstractInlineKeyboardButton {
|
||||
/** Description of the game that will be launched when the user presses the button.
|
||||
|
||||
NOTE: This type of button must always be the first button in the first row. */
|
||||
callback_game: CallbackGame;
|
||||
}
|
||||
export interface PayButton extends AbstractInlineKeyboardButton {
|
||||
/** Specify True, to send a Pay button.
|
||||
|
||||
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */
|
||||
pay: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
|
||||
export type InlineKeyboardButton =
|
||||
| InlineKeyboardButton.CallbackButton
|
||||
| InlineKeyboardButton.GameButton
|
||||
| InlineKeyboardButton.LoginButton
|
||||
| InlineKeyboardButton.PayButton
|
||||
| InlineKeyboardButton.SwitchInlineButton
|
||||
| InlineKeyboardButton.SwitchInlineCurrentChatButton
|
||||
| InlineKeyboardButton.UrlButton
|
||||
| InlineKeyboardButton.WebAppButton;
|
||||
|
||||
/** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
|
||||
Telegram apps support these buttons as of version 5.7. */
|
||||
export interface LoginUrl {
|
||||
/** An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.
|
||||
|
||||
NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. */
|
||||
url: string;
|
||||
/** New text of the button in forwarded messages. */
|
||||
forward_text?: string;
|
||||
/** Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. */
|
||||
bot_username?: string;
|
||||
/** Pass True to request the permission for your bot to send messages to the user. */
|
||||
request_write_access?: boolean;
|
||||
}
|
||||
|
||||
/** A placeholder, currently holds no information. Use BotFather to set up your game. */
|
||||
export interface CallbackGame {}
|
||||
|
||||
/** This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
|
||||
|
||||
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). */
|
||||
export interface CallbackQuery {
|
||||
/** Unique identifier for this query */
|
||||
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;
|
||||
/** 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. */
|
||||
chat_instance: string;
|
||||
/** Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data. */
|
||||
data?: string;
|
||||
/** Short name of a Game to be returned, serves as the unique identifier for the game */
|
||||
game_short_name?: string;
|
||||
}
|
||||
|
||||
/** This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). */
|
||||
export interface ReplyKeyboardMarkup {
|
||||
/** Array of button rows, each represented by an Array of KeyboardButton objects */
|
||||
keyboard: KeyboardButton[][];
|
||||
/** Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
|
||||
resize_keyboard?: boolean;
|
||||
/** Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */
|
||||
one_time_keyboard?: boolean;
|
||||
/** The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
|
||||
input_field_placeholder?: string;
|
||||
/** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
||||
|
||||
Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */
|
||||
selective?: boolean;
|
||||
}
|
||||
|
||||
export namespace KeyboardButton {
|
||||
export interface CommonButton {
|
||||
/** 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 RequestContactButton extends CommonButton {
|
||||
/** If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
|
||||
request_contact: boolean;
|
||||
}
|
||||
export interface RequestLocationButton extends CommonButton {
|
||||
/** If True, the user's current location will be sent when the button is pressed. Available in private chats only. */
|
||||
request_location: boolean;
|
||||
}
|
||||
export interface RequestPollButton extends CommonButton {
|
||||
/** If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */
|
||||
request_poll: KeyboardButtonPollType;
|
||||
}
|
||||
export interface WebAppButton extends CommonButton {
|
||||
/** If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */
|
||||
web_app: WebAppInfo;
|
||||
}
|
||||
}
|
||||
|
||||
/** This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive. */
|
||||
export type KeyboardButton =
|
||||
| KeyboardButton.CommonButton
|
||||
| KeyboardButton.RequestContactButton
|
||||
| KeyboardButton.RequestLocationButton
|
||||
| KeyboardButton.RequestPollButton
|
||||
| KeyboardButton.WebAppButton
|
||||
| string;
|
||||
|
||||
/** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
|
||||
export interface KeyboardButtonPollType {
|
||||
/** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
|
||||
type?: "quiz" | "regular";
|
||||
}
|
||||
|
||||
/** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). */
|
||||
export interface ReplyKeyboardRemove {
|
||||
/** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */
|
||||
remove_keyboard: true;
|
||||
/** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
||||
|
||||
Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */
|
||||
selective?: boolean;
|
||||
}
|
||||
|
||||
/** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
|
||||
|
||||
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
|
||||
|
||||
Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
|
||||
|
||||
Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
|
||||
|
||||
The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user. */
|
||||
export interface ForceReply {
|
||||
/** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
|
||||
force_reply: true;
|
||||
/** The placeholder to be shown in the input field when the reply is active; 1-64 characters */
|
||||
input_field_placeholder?: string;
|
||||
/** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */
|
||||
selective?: boolean;
|
||||
}
|
||||
|
||||
/** Describes a Web App. */
|
||||
export interface WebAppInfo {
|
||||
/** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
|
||||
url: string;
|
||||
}
|
127
node_modules/typegram/menu-button.d.ts
generated
vendored
Normal file
127
node_modules/typegram/menu-button.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,127 @@
|
|||
import { WebAppInfo } from "./markup";
|
||||
|
||||
/** This object describes the bot's menu button in a private chat. It should be one of
|
||||
- MenuButtonCommands
|
||||
- MenuButtonWebApp
|
||||
- MenuButtonDefault
|
||||
|
||||
If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. */
|
||||
export type MenuButton =
|
||||
| MenuButtonCommands
|
||||
| MenuButtonWebApp
|
||||
| MenuButtonDefault;
|
||||
|
||||
/** Represents a menu button, which opens the bot's list of commands. */
|
||||
export interface MenuButtonCommands {
|
||||
/** Type of the button, must be commands */
|
||||
type: "commands";
|
||||
}
|
||||
|
||||
/** Represents a menu button, which launches a Web App. */
|
||||
export interface MenuButtonWebApp {
|
||||
/** Button type, must be web_app */
|
||||
type: "web_app";
|
||||
/** Text on the button */
|
||||
text: string;
|
||||
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. */
|
||||
web_app: WebAppInfo;
|
||||
}
|
||||
|
||||
/** Describes that no specific value for the menu button was set. */
|
||||
export interface MenuButtonDefault {
|
||||
/** Type of the button, must be default */
|
||||
type: "default";
|
||||
}
|
||||
|
||||
/** This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
|
||||
- BotCommandScopeDefault
|
||||
- BotCommandScopeAllPrivateChats
|
||||
- BotCommandScopeAllGroupChats
|
||||
- BotCommandScopeAllChatAdministrators
|
||||
- BotCommandScopeChat
|
||||
- BotCommandScopeChatAdministrators
|
||||
- BotCommandScopeChatMember
|
||||
|
||||
## Determining list of commands
|
||||
|
||||
The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned:
|
||||
|
||||
### Commands in the chat with the bot
|
||||
- botCommandScopeChat + language_code
|
||||
- botCommandScopeChat
|
||||
- botCommandScopeAllPrivateChats + language_code
|
||||
- botCommandScopeAllPrivateChats
|
||||
- botCommandScopeDefault + language_code
|
||||
- botCommandScopeDefault
|
||||
|
||||
### Commands in group and supergroup chats
|
||||
- botCommandScopeChatMember + language_code
|
||||
- botCommandScopeChatMember
|
||||
- botCommandScopeChatAdministrators + language_code (administrators only)
|
||||
- botCommandScopeChatAdministrators (administrators only)
|
||||
- botCommandScopeChat + language_code
|
||||
- botCommandScopeChat
|
||||
- botCommandScopeAllChatAdministrators + language_code (administrators only)
|
||||
- botCommandScopeAllChatAdministrators (administrators only)
|
||||
- botCommandScopeAllGroupChats + language_code
|
||||
- botCommandScopeAllGroupChats
|
||||
- botCommandScopeDefault + language_code
|
||||
- botCommandScopeDefault */
|
||||
export type BotCommandScope =
|
||||
| BotCommandScopeDefault
|
||||
| BotCommandScopeAllPrivateChats
|
||||
| BotCommandScopeAllGroupChats
|
||||
| BotCommandScopeAllChatAdministrators
|
||||
| BotCommandScopeChat
|
||||
| BotCommandScopeChatAdministrators
|
||||
| BotCommandScopeChatMember;
|
||||
|
||||
/** Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. */
|
||||
export interface BotCommandScopeDefault {
|
||||
/** Scope type, must be default */
|
||||
type: "default";
|
||||
}
|
||||
|
||||
/** Represents the scope of bot commands, covering all private chats. */
|
||||
export interface BotCommandScopeAllPrivateChats {
|
||||
/** Scope type, must be all_private_chats */
|
||||
type: "all_private_chats";
|
||||
}
|
||||
|
||||
/** Represents the scope of bot commands, covering all group and supergroup chats. */
|
||||
export interface BotCommandScopeAllGroupChats {
|
||||
/** Scope type, must be all_group_chats */
|
||||
type: "all_group_chats";
|
||||
}
|
||||
|
||||
/** Represents the scope of bot commands, covering all group and supergroup chat administrators. */
|
||||
export interface BotCommandScopeAllChatAdministrators {
|
||||
/** Scope type, must be all_chat_administrators */
|
||||
type: "all_chat_administrators";
|
||||
}
|
||||
|
||||
/** Represents the scope of bot commands, covering a specific chat. */
|
||||
export interface BotCommandScopeChat {
|
||||
/** Scope type, must be chat */
|
||||
type: "chat";
|
||||
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
||||
chat_id: number | string;
|
||||
}
|
||||
|
||||
/** Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. */
|
||||
export interface BotCommandScopeChatAdministrators {
|
||||
/** Scope type, must be chat_administrators */
|
||||
type: "chat_administrators";
|
||||
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
||||
chat_id: number | string;
|
||||
}
|
||||
|
||||
/** Represents the scope of bot commands, covering a specific member of a group or supergroup chat. */
|
||||
export interface BotCommandScopeChatMember {
|
||||
/** Scope type, must be chat_member */
|
||||
type: "chat_member";
|
||||
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
||||
chat_id: number | string;
|
||||
/** Unique identifier of the target user */
|
||||
user_id: number;
|
||||
}
|
785
node_modules/typegram/message.d.ts
generated
vendored
Normal file
785
node_modules/typegram/message.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,785 @@
|
|||
import { InlineKeyboardMarkup } from "./markup";
|
||||
import { Chat, File, User } from "./manage";
|
||||
import { PassportData } from "./passport";
|
||||
import { Invoice, SuccessfulPayment } from "./payment";
|
||||
|
||||
export namespace Message {
|
||||
interface ServiceMessage {
|
||||
/** Unique message identifier inside this chat */
|
||||
message_id: number;
|
||||
/** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
|
||||
from?: User;
|
||||
/** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
|
||||
sender_chat?: Chat;
|
||||
/** Date the message was sent in Unix time */
|
||||
date: number;
|
||||
/** Conversation the message belongs to */
|
||||
chat: Chat;
|
||||
}
|
||||
interface CommonMessage extends ServiceMessage {
|
||||
/** For forwarded messages, sender of the original message */
|
||||
forward_from?: User;
|
||||
/** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
|
||||
forward_from_chat?: Chat;
|
||||
/** For messages forwarded from channels, identifier of the original message in the channel */
|
||||
forward_from_message_id?: number;
|
||||
/** For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
|
||||
forward_signature?: string;
|
||||
/** Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
|
||||
forward_sender_name?: string;
|
||||
/** For forwarded messages, date the original message was sent in Unix time */
|
||||
forward_date?: number;
|
||||
/** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
|
||||
is_automatic_forward?: true;
|
||||
/** For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
|
||||
reply_to_message?: ReplyMessage;
|
||||
/** Bot through which the message was sent */
|
||||
via_bot?: User;
|
||||
/** Date the message was last edited in Unix time */
|
||||
edit_date?: number;
|
||||
/** True, if the message can't be forwarded */
|
||||
has_protected_content?: true;
|
||||
/** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
|
||||
author_signature?: string;
|
||||
/** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
}
|
||||
export interface TextMessage extends CommonMessage {
|
||||
/** For text messages, the actual UTF-8 text of the message */
|
||||
text: string;
|
||||
/** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
|
||||
entities?: MessageEntity[];
|
||||
}
|
||||
interface CaptionableMessage extends CommonMessage {
|
||||
/** Caption for the animation, audio, document, photo, video or voice */
|
||||
caption?: string;
|
||||
/** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
|
||||
caption_entities?: MessageEntity[];
|
||||
}
|
||||
interface MediaMessage extends CaptionableMessage {
|
||||
/** The unique identifier of a media message group this message belongs to */
|
||||
media_group_id?: string;
|
||||
}
|
||||
export interface AudioMessage extends MediaMessage {
|
||||
/** Message is an audio file, information about the file */
|
||||
audio: Audio;
|
||||
}
|
||||
export interface DocumentMessage extends MediaMessage {
|
||||
/** Message is a general file, information about the file */
|
||||
document: Document;
|
||||
}
|
||||
export interface AnimationMessage extends DocumentMessage {
|
||||
/** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */
|
||||
animation: Animation;
|
||||
}
|
||||
export interface PhotoMessage extends MediaMessage {
|
||||
/** Message is a photo, available sizes of the photo */
|
||||
photo: PhotoSize[];
|
||||
}
|
||||
export interface StickerMessage extends CommonMessage {
|
||||
/** Message is a sticker, information about the sticker */
|
||||
sticker: Sticker;
|
||||
}
|
||||
export interface VideoMessage extends MediaMessage {
|
||||
/** Message is a video, information about the video */
|
||||
video: Video;
|
||||
}
|
||||
export interface VideoNoteMessage extends CommonMessage {
|
||||
/** Message is a video note, information about the video message */
|
||||
video_note: VideoNote;
|
||||
}
|
||||
export interface VoiceMessage extends CaptionableMessage {
|
||||
/** Message is a voice message, information about the file */
|
||||
voice: Voice;
|
||||
}
|
||||
export interface ContactMessage extends CommonMessage {
|
||||
/** Message is a shared contact, information about the contact */
|
||||
contact: Contact;
|
||||
}
|
||||
export interface DiceMessage extends CommonMessage {
|
||||
/** Message is a dice with random value */
|
||||
dice: Dice;
|
||||
}
|
||||
export interface GameMessage extends CommonMessage {
|
||||
/** Message is a game, information about the game. More about games » */
|
||||
game: Game;
|
||||
}
|
||||
export interface PollMessage extends CommonMessage {
|
||||
/** Message is a native poll, information about the poll */
|
||||
poll: Poll;
|
||||
}
|
||||
export interface LocationMessage extends CommonMessage {
|
||||
/** Message is a shared location, information about the location */
|
||||
location: Location;
|
||||
}
|
||||
export interface VenueMessage extends LocationMessage {
|
||||
/** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */
|
||||
venue: Venue;
|
||||
}
|
||||
export interface NewChatMembersMessage extends ServiceMessage {
|
||||
/** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
|
||||
new_chat_members: User[];
|
||||
}
|
||||
export interface LeftChatMemberMessage extends ServiceMessage {
|
||||
/** A member was removed from the group, information about them (this member may be the bot itself) */
|
||||
left_chat_member: User;
|
||||
}
|
||||
export interface NewChatTitleMessage extends ServiceMessage {
|
||||
/** A chat title was changed to this value */
|
||||
new_chat_title: string;
|
||||
}
|
||||
export interface NewChatPhotoMessage extends ServiceMessage {
|
||||
/** A chat photo was change to this value */
|
||||
new_chat_photo: PhotoSize[];
|
||||
}
|
||||
export interface DeleteChatPhotoMessage extends ServiceMessage {
|
||||
/** Service message: the chat photo was deleted */
|
||||
delete_chat_photo: true;
|
||||
}
|
||||
export interface GroupChatCreatedMessage extends ServiceMessage {
|
||||
/** Service message: the group has been created */
|
||||
group_chat_created: true;
|
||||
}
|
||||
export interface SupergroupChatCreated extends ServiceMessage {
|
||||
/** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */
|
||||
supergroup_chat_created: true;
|
||||
}
|
||||
export interface ChannelChatCreatedMessage extends ServiceMessage {
|
||||
/** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
|
||||
channel_chat_created: true;
|
||||
}
|
||||
export interface MessageAutoDeleteTimerChangedMessage extends ServiceMessage {
|
||||
/** Service message: auto-delete timer settings changed in the chat */
|
||||
message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged;
|
||||
}
|
||||
export interface MigrateToChatIdMessage extends ServiceMessage {
|
||||
/** 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. */
|
||||
migrate_to_chat_id: number;
|
||||
}
|
||||
export interface MigrateFromChatIdMessage extends ServiceMessage {
|
||||
/** The supergroup has been migrated from a group 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. */
|
||||
migrate_from_chat_id: number;
|
||||
}
|
||||
export interface PinnedMessageMessage extends ServiceMessage {
|
||||
/** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
|
||||
pinned_message: ReplyMessage;
|
||||
}
|
||||
export interface InvoiceMessage extends ServiceMessage {
|
||||
/** Message is an invoice for a payment, information about the invoice. More about payments » */
|
||||
invoice: Invoice;
|
||||
}
|
||||
export interface SuccessfulPaymentMessage extends ServiceMessage {
|
||||
/** Message is a service message about a successful payment, information about the payment. More about payments » */
|
||||
successful_payment: SuccessfulPayment;
|
||||
}
|
||||
export interface ConnectedWebsiteMessage extends ServiceMessage {
|
||||
/** The domain name of the website on which the user has logged in. More about Telegram Login » */
|
||||
connected_website: string;
|
||||
}
|
||||
export interface PassportDataMessage extends ServiceMessage {
|
||||
/** Telegram Passport data */
|
||||
passport_data: PassportData;
|
||||
}
|
||||
export interface ProximityAlertTriggeredMessage extends ServiceMessage {
|
||||
/** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */
|
||||
proximity_alert_triggered: ProximityAlertTriggered;
|
||||
}
|
||||
/** Service message: video chat scheduled */
|
||||
export interface VideoChatScheduledMessage extends ServiceMessage {
|
||||
video_chat_scheduled: VideoChatScheduled;
|
||||
}
|
||||
export interface VideoChatStartedMessage extends ServiceMessage {
|
||||
/** Service message: video chat started */
|
||||
video_chat_started: VideoChatStarted;
|
||||
}
|
||||
export interface VideoChatEndedMessage extends ServiceMessage {
|
||||
/** Service message: video chat ended */
|
||||
video_chat_ended: VideoChatEnded;
|
||||
}
|
||||
export interface VideoChatParticipantsInvitedMessage extends ServiceMessage {
|
||||
/** Service message: new participants invited to a video chat */
|
||||
video_chat_participants_invited: VideoChatParticipantsInvited;
|
||||
}
|
||||
export interface WebAppDataMessage extends ServiceMessage {
|
||||
/** Service message: data sent by a Web App */
|
||||
web_app_data: WebAppData;
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper type that bundles all possible `Message.ServiceMessage`s. More specifically, bundles all messages that do not have a `reply_to_message` field, i.e. are not a `Message.CommonMessage`. */
|
||||
export type ServiceMessageBundle =
|
||||
| Message.ChannelChatCreatedMessage
|
||||
| Message.ConnectedWebsiteMessage
|
||||
| Message.DeleteChatPhotoMessage
|
||||
| Message.GroupChatCreatedMessage
|
||||
| Message.InvoiceMessage
|
||||
| Message.LeftChatMemberMessage
|
||||
| Message.MessageAutoDeleteTimerChangedMessage
|
||||
| Message.MigrateFromChatIdMessage
|
||||
| Message.MigrateToChatIdMessage
|
||||
| Message.NewChatMembersMessage
|
||||
| Message.NewChatPhotoMessage
|
||||
| Message.NewChatTitleMessage
|
||||
| Message.PassportDataMessage
|
||||
| Message.ProximityAlertTriggeredMessage
|
||||
| Message.PinnedMessageMessage
|
||||
| Message.SuccessfulPaymentMessage
|
||||
| Message.SupergroupChatCreated
|
||||
| Message.VideoChatScheduledMessage
|
||||
| Message.VideoChatStartedMessage
|
||||
| Message.VideoChatEndedMessage
|
||||
| Message.VideoChatParticipantsInvitedMessage
|
||||
| Message.WebAppDataMessage;
|
||||
|
||||
/** Helper type that bundles all possible `Message.CommonMessage`s. More specifically, bundles all messages that do have a `reply_to_message` field, i.e. are a `Message.CommonMessage`. */
|
||||
export type CommonMessageBundle =
|
||||
| Message.AnimationMessage
|
||||
| Message.AudioMessage
|
||||
| Message.ContactMessage
|
||||
| Message.DiceMessage
|
||||
| Message.DocumentMessage
|
||||
| Message.GameMessage
|
||||
| Message.LocationMessage
|
||||
| Message.PhotoMessage
|
||||
| Message.PollMessage
|
||||
| Message.StickerMessage
|
||||
| Message.TextMessage
|
||||
| Message.VenueMessage
|
||||
| Message.VideoMessage
|
||||
| Message.VideoNoteMessage
|
||||
| Message.VoiceMessage;
|
||||
|
||||
/** Helper type that represents a message which occurs in a `reply_to_message` field. */
|
||||
type ReplyMessage =
|
||||
| ServiceMessageBundle
|
||||
| (CommonMessageBundle & { reply_to_message: undefined });
|
||||
|
||||
/** This object represents a message. */
|
||||
export type Message = ServiceMessageBundle | CommonMessageBundle;
|
||||
|
||||
/** This object represents a unique message identifier. */
|
||||
export interface MessageId {
|
||||
/** Unique message identifier */
|
||||
message_id: number;
|
||||
}
|
||||
|
||||
/** Describes an inline message sent by a Web App on behalf of a user. */
|
||||
export interface SentWebAppMessage {
|
||||
/** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */
|
||||
inline_message_id: string;
|
||||
}
|
||||
|
||||
/** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, and spoiler text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
|
||||
|
||||
Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL).
|
||||
|
||||
Message entities can be nested, providing following restrictions are met:
|
||||
- If two entities have common characters, then one of them is fully contained inside another.
|
||||
- bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
|
||||
- All other entities can't contain each other.
|
||||
|
||||
Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username. Please note:
|
||||
|
||||
- These links will work only if they are used inside an inline link or in an inline keyboard button. For example, they will not work, when used in a message text.
|
||||
- These mentions are only guaranteed to work if the user has contacted the bot in the past, has sent a callback query to the bot via an inline button or is a member in the group where he was mentioned.
|
||||
|
||||
#### MarkdownV2 style
|
||||
To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:
|
||||
|
||||
```
|
||||
*bold \*text*
|
||||
_italic \*text_
|
||||
__underline__
|
||||
~strikethrough~
|
||||
||spoiler||
|
||||
*bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*
|
||||
[inline URL](http://www.example.com/)
|
||||
[inline mention of a user](tg://user?id=123456789)
|
||||
`inline fixed-width code`
|
||||
```
|
||||
pre-formatted fixed-width code block
|
||||
```
|
||||
```python
|
||||
pre-formatted fixed-width code block written in the Python programming language
|
||||
```
|
||||
```
|
||||
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.
|
||||
- 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.
|
||||
|
||||
#### HTML style
|
||||
To use this mode, pass *HTML* in the *parse_mode* field. The following tags are currently supported:
|
||||
|
||||
```html
|
||||
<b>bold</b>, <strong>bold</strong>
|
||||
<i>italic</i>, <em>italic</em>
|
||||
<u>underline</u>, <ins>underline</ins>
|
||||
<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
|
||||
<span class="tg-spoiler">spoiler</span>, <tg-spoiler>spoiler</tg-spoiler>
|
||||
<b>bold <i>italic bold <s>italic bold strikethrough <span class="tg-spoiler">italic bold strikethrough spoiler</span></s> <u>underline italic bold</u></i> bold</b>
|
||||
<a href="http://www.example.com/">inline URL</a>
|
||||
<a href="tg://user?id=123456789">inline mention of a user</a>
|
||||
<code>inline fixed-width code</code>
|
||||
<pre>pre-formatted fixed-width code block</pre>
|
||||
<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
|
||||
```
|
||||
Please note:
|
||||
|
||||
- Only the tags mentioned above are currently supported.
|
||||
- All `<`, `>` and `&` symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (`<` with `<`, `>` with `>` and `&` with `&`).
|
||||
- All numerical HTML entities are supported.
|
||||
- The API currently supports only the following named HTML entities: `<`, `>`, `&` and `"`.
|
||||
- Use nested `pre` and `code` tags, to define programming language for pre entity.
|
||||
- Programming language can't be specified for standalone `code` tags.
|
||||
|
||||
#### Markdown style
|
||||
This is a legacy mode, retained for backward compatibility. To use this mode, pass *Markdown* in the *parse_mode* field. Use the following syntax in your message:
|
||||
|
||||
```
|
||||
*bold text*
|
||||
_italic text_
|
||||
[inline URL](http://www.example.com/)
|
||||
[inline mention of a user](tg://user?id=123456789)
|
||||
`inline fixed-width code`
|
||||
```
|
||||
pre-formatted fixed-width code block
|
||||
```
|
||||
```python
|
||||
pre-formatted fixed-width code block written in the Python programming language
|
||||
```
|
||||
```
|
||||
Please note:
|
||||
|
||||
- Entities must not be nested, use parse mode MarkdownV2 instead.
|
||||
- There is no way to specify underline and strikethrough entities, use parse mode MarkdownV2 instead.
|
||||
- To escape characters '_', '*', '`', '[' outside of an entity, prepend the characters '\' before them.
|
||||
- Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */
|
||||
export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
|
||||
|
||||
export namespace MessageEntity {
|
||||
interface AbstractMessageEntity {
|
||||
/** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
|
||||
type: string;
|
||||
/** Offset in UTF-16 code units to the start of the entity */
|
||||
offset: number;
|
||||
/** Length of the entity in UTF-16 code units */
|
||||
length: number;
|
||||
}
|
||||
export interface CommonMessageEntity extends AbstractMessageEntity {
|
||||
type:
|
||||
| "mention"
|
||||
| "hashtag"
|
||||
| "cashtag"
|
||||
| "bot_command"
|
||||
| "url"
|
||||
| "email"
|
||||
| "phone_number"
|
||||
| "bold"
|
||||
| "italic"
|
||||
| "underline"
|
||||
| "strikethrough"
|
||||
| "spoiler"
|
||||
| "code";
|
||||
}
|
||||
export interface PreMessageEntity extends AbstractMessageEntity {
|
||||
type: "pre";
|
||||
/** For “pre” only, the programming language of the entity text */
|
||||
language?: string;
|
||||
}
|
||||
export interface TextLinkMessageEntity extends AbstractMessageEntity {
|
||||
type: "text_link";
|
||||
/** For “text_link” only, URL that will be opened after user taps on the text */
|
||||
url: string;
|
||||
}
|
||||
export interface TextMentionMessageEntity extends AbstractMessageEntity {
|
||||
type: "text_mention";
|
||||
/** For “text_mention” only, the mentioned user */
|
||||
user: User;
|
||||
}
|
||||
export interface CustomEmojiMessageEntity extends AbstractMessageEntity {
|
||||
type: "custom_emoji";
|
||||
/** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */
|
||||
custom_emoji_id: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
|
||||
export type MessageEntity =
|
||||
| MessageEntity.CommonMessageEntity
|
||||
| MessageEntity.CustomEmojiMessageEntity
|
||||
| MessageEntity.PreMessageEntity
|
||||
| MessageEntity.TextLinkMessageEntity
|
||||
| MessageEntity.TextMentionMessageEntity;
|
||||
|
||||
/** This object represents one size of a photo or a file / sticker thumbnail. */
|
||||
export interface PhotoSize {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Photo width */
|
||||
width: number;
|
||||
/** Photo height */
|
||||
height: number;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */
|
||||
export interface Animation {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Video width as defined by sender */
|
||||
width: number;
|
||||
/** Video height as defined by sender */
|
||||
height: number;
|
||||
/** Duration of the video in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Animation thumbnail as defined by sender */
|
||||
thumb?: PhotoSize;
|
||||
/** Original animation filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents an audio file to be treated as music by the Telegram clients. */
|
||||
export interface Audio {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Duration of the audio in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Performer of the audio as defined by sender or by audio tags */
|
||||
performer?: string;
|
||||
/** Title of the audio as defined by sender or by audio tags */
|
||||
title?: string;
|
||||
/** Original filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
/** Thumbnail of the album cover to which the music file belongs */
|
||||
thumb?: PhotoSize;
|
||||
}
|
||||
|
||||
/** This object represents a general file (as opposed to photos, voice messages and audio files). */
|
||||
export interface Document {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Document thumbnail as defined by sender */
|
||||
thumb?: PhotoSize;
|
||||
/** Original filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents a video file. */
|
||||
export interface Video {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Video width as defined by sender */
|
||||
width: number;
|
||||
/** Video height as defined by sender */
|
||||
height: number;
|
||||
/** Duration of the video in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Video thumbnail */
|
||||
thumb?: PhotoSize;
|
||||
/** Original filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents a video message (available in Telegram apps as of v.4.0). */
|
||||
export interface VideoNote {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Video width and height (diameter of the video message) as defined by sender */
|
||||
length: number;
|
||||
/** Duration of the video in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Video thumbnail */
|
||||
thumb?: PhotoSize;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents a voice note. */
|
||||
export interface Voice {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Duration of the audio in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents a phone contact. */
|
||||
export interface Contact {
|
||||
/** Contact's phone number */
|
||||
phone_number: string;
|
||||
/** Contact's first name */
|
||||
first_name: string;
|
||||
/** Contact's last name */
|
||||
last_name?: string;
|
||||
/** Contact's user identifier in Telegram. 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 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
user_id?: number;
|
||||
/** Additional data about the contact in the form of a vCard */
|
||||
vcard?: string;
|
||||
}
|
||||
|
||||
/** This object represents an animated emoji that displays a random value. */
|
||||
export interface Dice {
|
||||
/** Emoji on which the dice throw animation is based */
|
||||
emoji: string;
|
||||
/** Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** This object contains information about one answer option in a poll. */
|
||||
export interface PollOption {
|
||||
/** Option text, 1-100 characters */
|
||||
text: string;
|
||||
/** Number of users that voted for this option */
|
||||
voter_count: number;
|
||||
}
|
||||
|
||||
/** This object represents an answer of a user in a non-anonymous poll. */
|
||||
export interface PollAnswer {
|
||||
/** Unique poll identifier */
|
||||
poll_id: string;
|
||||
/** The user, who changed the answer to the poll */
|
||||
user: User;
|
||||
/** 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */
|
||||
option_ids: number[];
|
||||
}
|
||||
|
||||
/** This object contains information about a poll. */
|
||||
export interface Poll {
|
||||
/** Unique poll identifier */
|
||||
id: string;
|
||||
/** Poll question, 1-300 characters */
|
||||
question: string;
|
||||
/** List of poll options */
|
||||
options: PollOption[];
|
||||
/** Total number of users that voted in the poll */
|
||||
total_voter_count: number;
|
||||
/** True, if the poll is closed */
|
||||
is_closed: boolean;
|
||||
/** True, if the poll is anonymous */
|
||||
is_anonymous: boolean;
|
||||
/** Poll type, currently can be “regular” or “quiz” */
|
||||
type: "regular" | "quiz";
|
||||
/** True, if the poll allows multiple answers */
|
||||
allows_multiple_answers: boolean;
|
||||
/** 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */
|
||||
correct_option_id?: number;
|
||||
/** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */
|
||||
explanation?: string;
|
||||
/** Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */
|
||||
explanation_entities?: MessageEntity[];
|
||||
/** Amount of time in seconds the poll will be active after creation */
|
||||
open_period?: number;
|
||||
/** Point in time (Unix timestamp) when the poll will be automatically closed */
|
||||
close_date?: number;
|
||||
}
|
||||
|
||||
export namespace Location {
|
||||
export interface CommonLocation {
|
||||
/** Longitude as defined by sender */
|
||||
longitude: number;
|
||||
/** Latitude as defined by sender */
|
||||
latitude: number;
|
||||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */
|
||||
horizontal_accuracy?: number;
|
||||
}
|
||||
export interface LiveLocation extends CommonLocation {
|
||||
/** Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only. */
|
||||
live_period: number;
|
||||
/** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
|
||||
heading: number;
|
||||
/** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
|
||||
proximity_alert_radius?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** This object represents a point on the map. */
|
||||
export type Location = Location.CommonLocation | Location.LiveLocation;
|
||||
|
||||
/** This object represents a venue. */
|
||||
export interface Venue {
|
||||
/** Venue location. Can't be a live location */
|
||||
location: Location;
|
||||
/** Name of the venue */
|
||||
title: string;
|
||||
/** Address of the venue */
|
||||
address: string;
|
||||
/** Foursquare identifier of the venue */
|
||||
foursquare_id?: string;
|
||||
/** Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
|
||||
foursquare_type?: string;
|
||||
/** Google Places identifier of the venue */
|
||||
google_place_id?: string;
|
||||
/** Google Places type of the venue. (See supported types.) */
|
||||
google_place_type?: string;
|
||||
}
|
||||
|
||||
/** 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 */
|
||||
traveler: User;
|
||||
/** User that set the alert */
|
||||
watcher: User;
|
||||
/** The distance between the users */
|
||||
distance: number;
|
||||
}
|
||||
|
||||
/** This object represents a service message about a change in auto-delete timer settings. */
|
||||
export interface MessageAutoDeleteTimerChanged {
|
||||
/** New auto-delete time for messages in the chat; in seconds */
|
||||
message_auto_delete_time: number;
|
||||
}
|
||||
|
||||
/** This object represents a service message about a video chat scheduled in the chat. */
|
||||
export interface VideoChatScheduled {
|
||||
/** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */
|
||||
start_date: number;
|
||||
}
|
||||
|
||||
/** This object represents a service message about a video chat started in the chat. Currently holds no information. */
|
||||
export interface VideoChatStarted {}
|
||||
|
||||
/** This object represents a service message about a video chat ended in the chat. */
|
||||
export interface VideoChatEnded {
|
||||
/** Video chat duration in seconds */
|
||||
duration: number;
|
||||
}
|
||||
|
||||
/** This object represents a service message about new members invited to a video chat. */
|
||||
export interface VideoChatParticipantsInvited {
|
||||
/** New members that were invited to the video chat */
|
||||
users: User[];
|
||||
}
|
||||
|
||||
/** Describes data sent from a Web App to the bot. */
|
||||
export interface WebAppData {
|
||||
/** The data. Be aware that a bad client can send arbitrary data in this field. */
|
||||
data: string;
|
||||
/** Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */
|
||||
button_text: string;
|
||||
}
|
||||
|
||||
/** This object represents a sticker. */
|
||||
export interface Sticker {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */
|
||||
type: "regular" | "mask" | "custom_emoji";
|
||||
/** Sticker width */
|
||||
width: number;
|
||||
/** Sticker height */
|
||||
height: number;
|
||||
/** True, if the sticker is animated */
|
||||
is_animated: boolean;
|
||||
/** True, if the sticker is a video sticker */
|
||||
is_video: boolean;
|
||||
/** Sticker thumbnail in the .WEBP or .JPG format */
|
||||
thumb?: PhotoSize;
|
||||
/** Emoji associated with the sticker */
|
||||
emoji?: string;
|
||||
/** Name of the sticker set to which the sticker belongs */
|
||||
set_name?: string;
|
||||
/** For premium regular stickers, premium animation for the sticker */
|
||||
premium_animation?: File;
|
||||
/** For mask stickers, the position where the mask should be placed */
|
||||
mask_position?: MaskPosition;
|
||||
/** For custom emoji stickers, unique identifier of the custom emoji */
|
||||
custom_emoji_id?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
|
||||
/** This object represents a sticker set. */
|
||||
export interface StickerSet {
|
||||
/** Sticker set name */
|
||||
name: string;
|
||||
/** Sticker set title */
|
||||
title: string;
|
||||
/** Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” */
|
||||
sticker_type: "regular" | "mask" | "custom_emoji";
|
||||
/** True, if the sticker set contains animated stickers */
|
||||
is_animated: boolean;
|
||||
/** True, if the sticker set contains video stickers */
|
||||
is_video: boolean;
|
||||
/** List of all set stickers */
|
||||
stickers: Sticker[];
|
||||
/** Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */
|
||||
thumb?: PhotoSize;
|
||||
}
|
||||
|
||||
/** This object describes the position on faces where a mask should be placed by default. */
|
||||
export interface MaskPosition {
|
||||
/** The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. */
|
||||
point: "forehead" | "eyes" | "mouth" | "chin";
|
||||
/** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */
|
||||
x_shift: number;
|
||||
/** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */
|
||||
y_shift: number;
|
||||
/** Mask scaling coefficient. For example, 2.0 means double size. */
|
||||
scale: number;
|
||||
}
|
||||
|
||||
/** This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. */
|
||||
export interface Game {
|
||||
/** Title of the game */
|
||||
title: string;
|
||||
/** Description of the game */
|
||||
description: string;
|
||||
/** Photo that will be displayed in the game message in chats. */
|
||||
photo: PhotoSize[];
|
||||
/** Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */
|
||||
text: string;
|
||||
/** Special entities that appear in text, such as usernames, URLs, bot commands, etc. */
|
||||
text_entities: MessageEntity[];
|
||||
/** Animation that will be displayed in the game message in chats. Upload via BotFather */
|
||||
animation: Animation;
|
||||
}
|
||||
|
||||
/** This object represents one row of the high scores table for a game. */
|
||||
export interface GameHighScore {
|
||||
/** Position in high score table for the game */
|
||||
position: number;
|
||||
/** User */
|
||||
user: User;
|
||||
/** Score */
|
||||
score: number;
|
||||
}
|
41
node_modules/typegram/package.json
generated
vendored
Normal file
41
node_modules/typegram/package.json
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "typegram",
|
||||
"version": "3.12.0",
|
||||
"description": "Type declarations for the Telegram API",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./api": "./index.js",
|
||||
"./bot-command-scope": "./index.js",
|
||||
"./callback": "./index.js",
|
||||
"./default": "./index.js",
|
||||
"./inline": "./index.js",
|
||||
"./manage": "./index.js",
|
||||
"./markup": "./markup.js",
|
||||
"./menu-button": "./menu-button.js",
|
||||
"./message": "./index.js",
|
||||
"./passport": "./index.js",
|
||||
"./payment": "./index.js",
|
||||
"./proxied": "./index.js",
|
||||
"./update": "./index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/KnorpelSenf/typegram.git"
|
||||
},
|
||||
"keywords": [
|
||||
"telegram",
|
||||
"telegraf",
|
||||
"bot",
|
||||
"api",
|
||||
"types",
|
||||
"typings"
|
||||
],
|
||||
"author": "KnorpelSenf",
|
||||
"types": "index.d.ts",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/KnorpelSenf/typegram/issues"
|
||||
},
|
||||
"homepage": "https://github.com/KnorpelSenf/typegram#readme"
|
||||
}
|
232
node_modules/typegram/passport.d.ts
generated
vendored
Normal file
232
node_modules/typegram/passport.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,232 @@
|
|||
/** Describes Telegram Passport data shared with the bot by the user. */
|
||||
export interface PassportData {
|
||||
/** Array with information about documents and other Telegram Passport elements that was shared with the bot */
|
||||
data: EncryptedPassportElement[];
|
||||
/** Encrypted credentials required to decrypt the data */
|
||||
credentials: EncryptedCredentials;
|
||||
}
|
||||
|
||||
/** This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. */
|
||||
export interface PassportFile {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** File size in bytes */
|
||||
file_size: number;
|
||||
/** Unix time when the file was uploaded */
|
||||
file_date: number;
|
||||
}
|
||||
|
||||
/** Describes documents or other Telegram Passport elements shared with the bot by the user. */
|
||||
export interface EncryptedPassportElement {
|
||||
/** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */
|
||||
type:
|
||||
| "personal_details"
|
||||
| "passport"
|
||||
| "driver_license"
|
||||
| "identity_card"
|
||||
| "internal_passport"
|
||||
| "address"
|
||||
| "utility_bill"
|
||||
| "bank_statement"
|
||||
| "rental_agreement"
|
||||
| "passport_registration"
|
||||
| "temporary_registration"
|
||||
| "phone_number"
|
||||
| "email";
|
||||
/** Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
data?: string;
|
||||
/** User's verified phone number, available only for “phone_number” type */
|
||||
phone_number?: string;
|
||||
/** User's verified email address, available only for “email” type */
|
||||
email?: string;
|
||||
/** Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
files?: PassportFile[];
|
||||
/** Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
front_side?: PassportFile;
|
||||
/** Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
reverse_side?: PassportFile;
|
||||
/** Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
selfie?: PassportFile;
|
||||
/** Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
translation?: PassportFile[];
|
||||
/** Base64-encoded element hash for using in PassportElementErrorUnspecified */
|
||||
hash: string;
|
||||
}
|
||||
|
||||
/** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
|
||||
export interface EncryptedCredentials {
|
||||
/** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */
|
||||
data: string;
|
||||
/** Base64-encoded data hash for data authentication */
|
||||
hash: string;
|
||||
/** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */
|
||||
secret: string;
|
||||
}
|
||||
|
||||
/** This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
|
||||
- PassportElementErrorDataField
|
||||
- PassportElementErrorFrontSide
|
||||
- PassportElementErrorReverseSide
|
||||
- PassportElementErrorSelfie
|
||||
- PassportElementErrorFile
|
||||
- PassportElementErrorFiles
|
||||
- PassportElementErrorTranslationFile
|
||||
- PassportElementErrorTranslationFiles
|
||||
- PassportElementErrorUnspecified
|
||||
*/
|
||||
export type PassportElementError =
|
||||
| PassportElementErrorDataField
|
||||
| PassportElementErrorFrontSide
|
||||
| PassportElementErrorReverseSide
|
||||
| PassportElementErrorSelfie
|
||||
| PassportElementErrorFile
|
||||
| PassportElementErrorFiles
|
||||
| PassportElementErrorTranslationFile
|
||||
| PassportElementErrorTranslationFiles
|
||||
| PassportElementErrorUnspecified;
|
||||
|
||||
/** Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. */
|
||||
export interface PassportElementErrorDataField {
|
||||
/** Error source, must be data */
|
||||
source: "data";
|
||||
/** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */
|
||||
type:
|
||||
| "personal_details"
|
||||
| "passport"
|
||||
| "driver_license"
|
||||
| "identity_card"
|
||||
| "internal_passport"
|
||||
| "address";
|
||||
/** Name of the data field which has the error */
|
||||
field_name: string;
|
||||
/** Base64-encoded data hash */
|
||||
data_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. */
|
||||
export interface PassportElementErrorFrontSide {
|
||||
/** Error source, must be front_side */
|
||||
source: "front_side";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
|
||||
type: "passport" | "driver_license" | "identity_card" | "internal_passport";
|
||||
/** Base64-encoded hash of the file with the front side of the document */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. */
|
||||
export interface PassportElementErrorReverseSide {
|
||||
/** Error source, must be reverse_side */
|
||||
source: "reverse_side";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” */
|
||||
type: "driver_license" | "identity_card";
|
||||
/** Base64-encoded hash of the file with the reverse side of the document */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. */
|
||||
export interface PassportElementErrorSelfie {
|
||||
/** Error source, must be selfie */
|
||||
source: "selfie";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
|
||||
type: "passport" | "driver_license" | "identity_card" | "internal_passport";
|
||||
/** Base64-encoded hash of the file with the selfie */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. */
|
||||
export interface PassportElementErrorFile {
|
||||
/** Error source, must be file */
|
||||
source: "file";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type:
|
||||
| "utility_bill"
|
||||
| "bank_statement"
|
||||
| "rental_agreement"
|
||||
| "passport_registration"
|
||||
| "temporary_registration";
|
||||
/** Base64-encoded file hash */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. */
|
||||
export interface PassportElementErrorFiles {
|
||||
/** Error source, must be files */
|
||||
source: "files";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type:
|
||||
| "utility_bill"
|
||||
| "bank_statement"
|
||||
| "rental_agreement"
|
||||
| "passport_registration"
|
||||
| "temporary_registration";
|
||||
/** List of base64-encoded file hashes */
|
||||
file_hashes: string[];
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. */
|
||||
export interface PassportElementErrorTranslationFile {
|
||||
/** Error source, must be translation_file */
|
||||
source: "translation_file";
|
||||
/** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type:
|
||||
| "passport"
|
||||
| "driver_license"
|
||||
| "identity_card"
|
||||
| "internal_passport"
|
||||
| "utility_bill"
|
||||
| "bank_statement"
|
||||
| "rental_agreement"
|
||||
| "passport_registration"
|
||||
| "temporary_registration";
|
||||
/** Base64-encoded file hash */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. */
|
||||
export interface PassportElementErrorTranslationFiles {
|
||||
/** Error source, must be translation_files */
|
||||
source: "translation_files";
|
||||
/** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type:
|
||||
| "passport"
|
||||
| "driver_license"
|
||||
| "identity_card"
|
||||
| "internal_passport"
|
||||
| "utility_bill"
|
||||
| "bank_statement"
|
||||
| "rental_agreement"
|
||||
| "passport_registration"
|
||||
| "temporary_registration";
|
||||
/** List of base64-encoded file hashes */
|
||||
file_hashes: string[];
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents an issue in an unspecified place. The error is considered resolved when new data is added. */
|
||||
export interface PassportElementErrorUnspecified {
|
||||
/** Error source, must be unspecified */
|
||||
source: "unspecified";
|
||||
/** Type of element of the user's Telegram Passport which has the issue */
|
||||
type: string;
|
||||
/** Base64-encoded element hash */
|
||||
element_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
109
node_modules/typegram/payment.d.ts
generated
vendored
Normal file
109
node_modules/typegram/payment.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
import { User } from "./manage";
|
||||
|
||||
/** This object represents a portion of the price for goods or services. */
|
||||
export interface LabeledPrice {
|
||||
/** Portion label */
|
||||
label: string;
|
||||
/** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
amount: number;
|
||||
}
|
||||
|
||||
/** This object contains basic information about an invoice. */
|
||||
export interface Invoice {
|
||||
/** Product name */
|
||||
title: string;
|
||||
/** Product description */
|
||||
description: string;
|
||||
/** Unique bot deep-linking parameter that can be used to generate this invoice */
|
||||
start_parameter: string;
|
||||
/** Three-letter ISO 4217 currency code */
|
||||
currency: string;
|
||||
/** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
total_amount: number;
|
||||
}
|
||||
|
||||
/** This object represents a shipping address. */
|
||||
export interface ShippingAddress {
|
||||
/** Two-letter ISO 3166-1 alpha-2 country code */
|
||||
country_code: string;
|
||||
/** State, if applicable */
|
||||
state: string;
|
||||
/** City */
|
||||
city: string;
|
||||
/** First line for the address */
|
||||
street_line1: string;
|
||||
/** Second line for the address */
|
||||
street_line2: string;
|
||||
/** Address post code */
|
||||
post_code: string;
|
||||
}
|
||||
|
||||
/** This object represents information about an order. */
|
||||
export interface OrderInfo {
|
||||
/** User name */
|
||||
name?: string;
|
||||
/** User's phone number */
|
||||
phone_number?: string;
|
||||
/** User email */
|
||||
email?: string;
|
||||
/** User shipping address */
|
||||
shipping_address?: ShippingAddress;
|
||||
}
|
||||
|
||||
/** This object represents one shipping option. */
|
||||
export interface ShippingOption {
|
||||
/** Shipping option identifier */
|
||||
id: string;
|
||||
/** Option title */
|
||||
title: string;
|
||||
/** List of price portions */
|
||||
prices: LabeledPrice[];
|
||||
}
|
||||
|
||||
/** This object contains basic information about a successful payment. */
|
||||
export interface SuccessfulPayment {
|
||||
/** Three-letter ISO 4217 currency code */
|
||||
currency: string;
|
||||
/** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
total_amount: number;
|
||||
/** Bot specified invoice payload */
|
||||
invoice_payload: string;
|
||||
/** Identifier of the shipping option chosen by the user */
|
||||
shipping_option_id?: string;
|
||||
/** Order information provided by the user */
|
||||
order_info?: OrderInfo;
|
||||
/** Telegram payment identifier */
|
||||
telegram_payment_charge_id: string;
|
||||
/** Provider payment identifier */
|
||||
provider_payment_charge_id: string;
|
||||
}
|
||||
|
||||
/** This object contains information about an incoming shipping query. */
|
||||
export interface ShippingQuery {
|
||||
/** Unique query identifier */
|
||||
id: string;
|
||||
/** User who sent the query */
|
||||
from: User;
|
||||
/** Bot specified invoice payload */
|
||||
invoice_payload: string;
|
||||
/** User specified shipping address */
|
||||
shipping_address: ShippingAddress;
|
||||
}
|
||||
|
||||
/** This object contains information about an incoming pre-checkout query. */
|
||||
export interface PreCheckoutQuery {
|
||||
/** Unique query identifier */
|
||||
id: string;
|
||||
/** User who sent the query */
|
||||
from: User;
|
||||
/** Three-letter ISO 4217 currency code */
|
||||
currency: string;
|
||||
/** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
total_amount: number;
|
||||
/** Bot specified invoice payload */
|
||||
invoice_payload: string;
|
||||
/** Identifier of the shipping option chosen by the user */
|
||||
shipping_option_id?: string;
|
||||
/** Order information provided by the user */
|
||||
order_info?: OrderInfo;
|
||||
}
|
1589
node_modules/typegram/proxied.d.ts
generated
vendored
Normal file
1589
node_modules/typegram/proxied.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
120
node_modules/typegram/update.d.ts
generated
vendored
Normal file
120
node_modules/typegram/update.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
import { CallbackQuery } from "./markup";
|
||||
import { ChosenInlineResult, InlineQuery } from "./inline";
|
||||
import { Chat, ChatJoinRequest, ChatMemberUpdated, User } from "./manage";
|
||||
import { CommonMessageBundle, Message, Poll, PollAnswer } from "./message";
|
||||
import { PreCheckoutQuery, ShippingQuery } from "./payment";
|
||||
|
||||
export namespace Update {
|
||||
/** Internal type holding properties that updates in channels share. */
|
||||
interface Channel {
|
||||
chat: Chat.ChannelChat;
|
||||
author_signature?: string;
|
||||
from?: never;
|
||||
}
|
||||
/** Internal type holding properties that updates outside of channels share. */
|
||||
interface NonChannel {
|
||||
chat: Exclude<Chat, Chat.ChannelChat>;
|
||||
author_signature?: never;
|
||||
from: User;
|
||||
}
|
||||
/** Internal type holding properties that updates about new messages share. */
|
||||
interface New {
|
||||
edit_date?: never;
|
||||
}
|
||||
/** Internal type holding properties that updates about edited messages share. */
|
||||
interface Edited {
|
||||
/** Date the message was last edited in Unix time */
|
||||
edit_date: number;
|
||||
forward_from?: never;
|
||||
forward_from_chat?: never;
|
||||
forward_from_message_id?: never;
|
||||
forward_signature?: never;
|
||||
forward_sender_name?: never;
|
||||
forward_date?: never;
|
||||
}
|
||||
|
||||
export interface AbstractUpdate {
|
||||
/** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */
|
||||
update_id: number;
|
||||
}
|
||||
export interface MessageUpdate<M extends Message = Message>
|
||||
extends AbstractUpdate {
|
||||
/** New incoming message of any kind - text, photo, sticker, etc. */
|
||||
message: New & NonChannel & M;
|
||||
}
|
||||
export interface EditedMessageUpdate<
|
||||
M extends CommonMessageBundle = CommonMessageBundle,
|
||||
> extends AbstractUpdate {
|
||||
/** New version of a message that is known to the bot and was edited */
|
||||
edited_message: Edited & NonChannel & M;
|
||||
}
|
||||
export interface ChannelPostUpdate<M extends Message = Message>
|
||||
extends AbstractUpdate {
|
||||
/** New incoming channel post of any kind - text, photo, sticker, etc. */
|
||||
channel_post: New & Channel & M;
|
||||
}
|
||||
export interface EditedChannelPostUpdate<
|
||||
M extends CommonMessageBundle = CommonMessageBundle,
|
||||
> extends AbstractUpdate {
|
||||
/** New version of a channel post that is known to the bot and was edited */
|
||||
edited_channel_post: Edited & Channel & M;
|
||||
}
|
||||
export interface InlineQueryUpdate extends AbstractUpdate {
|
||||
/** New incoming inline query */
|
||||
inline_query: InlineQuery;
|
||||
}
|
||||
export interface ChosenInlineResultUpdate extends AbstractUpdate {
|
||||
/** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */
|
||||
chosen_inline_result: ChosenInlineResult;
|
||||
}
|
||||
export interface CallbackQueryUpdate extends AbstractUpdate {
|
||||
/** New incoming callback query */
|
||||
callback_query: CallbackQuery;
|
||||
}
|
||||
export interface ShippingQueryUpdate extends AbstractUpdate {
|
||||
/** New incoming shipping query. Only for invoices with flexible price */
|
||||
shipping_query: ShippingQuery;
|
||||
}
|
||||
export interface PreCheckoutQueryUpdate extends AbstractUpdate {
|
||||
/** New incoming pre-checkout query. Contains full information about checkout */
|
||||
pre_checkout_query: PreCheckoutQuery;
|
||||
}
|
||||
export interface PollUpdate extends AbstractUpdate {
|
||||
/** New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */
|
||||
poll: Poll;
|
||||
}
|
||||
export interface PollAnswerUpdate extends AbstractUpdate {
|
||||
/** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */
|
||||
poll_answer: PollAnswer;
|
||||
}
|
||||
export interface MyChatMemberUpdate extends AbstractUpdate {
|
||||
/** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */
|
||||
my_chat_member: ChatMemberUpdated;
|
||||
}
|
||||
export interface ChatMemberUpdate extends AbstractUpdate {
|
||||
/** A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */
|
||||
chat_member: ChatMemberUpdated;
|
||||
}
|
||||
export interface ChatJoinRequestUpdate extends AbstractUpdate {
|
||||
/** A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */
|
||||
chat_join_request?: ChatJoinRequest;
|
||||
}
|
||||
}
|
||||
|
||||
/** This object represents an incoming update.
|
||||
At most one of the optional parameters can be present in any given update. */
|
||||
export type Update =
|
||||
| Update.CallbackQueryUpdate
|
||||
| Update.ChannelPostUpdate
|
||||
| Update.ChatMemberUpdate
|
||||
| Update.ChosenInlineResultUpdate
|
||||
| Update.EditedChannelPostUpdate
|
||||
| Update.EditedMessageUpdate
|
||||
| Update.InlineQueryUpdate
|
||||
| Update.MessageUpdate
|
||||
| Update.MyChatMemberUpdate
|
||||
| Update.PreCheckoutQueryUpdate
|
||||
| Update.PollAnswerUpdate
|
||||
| Update.PollUpdate
|
||||
| Update.ShippingQueryUpdate
|
||||
| Update.ChatJoinRequestUpdate;
|
Loading…
Add table
Add a link
Reference in a new issue