grammy
Version:
The Telegram Bot Framework.
628 lines (627 loc) • 161 kB
TypeScript
import { type AcceptedGiftTypes, type BotCommand, type ChatPermissions, type InlineQueryResult, type InputChecklist, type InputFile, type InputMedia, type InputMediaAudio, type InputMediaDocument, type InputMediaLivePhoto, type InputMediaPhoto, type InputMediaVideo, type InputPaidMedia, type InputPollOption, type InputProfilePhoto, type InputSticker, type InputStoryContent, type KeyboardButton, type LabeledPrice, type MaskPosition, type PassportElementError, type ReactionType } from "../types.js";
import { type ApiClientOptions, type Methods, type Payload, type RawApi, type Transformer, type TransformerConsumer, type WebhookReplyEnvelope } from "./client.js";
/**
* Helper type to derive remaining properties of a given API method call M,
* given that some properties X have already been specified.
*/
export type Other<R extends RawApi, M extends Methods<R>, X extends string = never> = Omit<Payload<M, R>, X>;
/**
* This class provides access to the full Telegram Bot API. All methods of the
* API have an equivalent on this class, with the most important parameters
* pulled up into the function signature, and the other parameters captured by
* an object.
*
* In addition, this class has a property `raw` that provides raw access to the
* complete Telegram API, with the method signatures 1:1 represented as
* documented on the website (https://core.telegram.org/bots/api).
*
* Every method takes an optional `AbortSignal` object that allows you to cancel
* the request if desired.
*
* In advanced use cases, this class allows to install transformers that can
* modify the method and payload on the fly before sending it to the Telegram
* servers. Confer the `config` property for this.
*/
export declare class Api<R extends RawApi = RawApi> {
readonly token: string;
readonly options?: ApiClientOptions | undefined;
/**
* Provides access to all methods of the Telegram Bot API exactly as
* documented on the website (https://core.telegram.org/bots/api). No
* arguments are pulled up in the function signature for convenience.
*
* If you suppress compiler warnings, this also allows for raw api calls to
* undocumented methods with arbitrary parameters—use only if you know what
* you are doing.
*/
readonly raw: R;
/**
* Configuration object for the API instance, used as a namespace to
* separate those API operations that are related to grammY from methods of
* the Telegram Bot API. Contains advanced options!
*/
readonly config: {
/**
* Allows to install an API request transformer function. A transformer
* function has access to every API call before it is being performed.
* This includes the method as string, the payload as object and the
* upstream transformer function.
*
* _Note that using transformer functions is an advanced feature of
* grammY that most bots will not need to make use of._
*/
readonly use: TransformerConsumer<R>;
/**
* Provides read access to all currently installed transformers (those
* that have previously been passed to `config.use`).
*
* _Note that using transformer functions is an advanced feature of
* grammY that most bots will not need to make use of._
*/
readonly installedTransformers: () => Transformer<R>[];
};
/**
* Constructs a new instance of `Api`. It is independent from all other
* instances of this class. For example, this lets you install a custom set
* of transformers.
*
* @param token Bot API token obtained from [@BotFather](https://t.me/BotFather)
* @param options Optional API client options for the underlying client instance
* @param webhookReplyEnvelope Optional envelope to handle webhook replies
*/
constructor(token: string, options?: ApiClientOptions | undefined, webhookReplyEnvelope?: WebhookReplyEnvelope);
/**
* Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.
*
* Notes
* 1. This method will not work if an outgoing webhook is set up.
* 2. In order to avoid getting duplicate updates, recalculate offset after each server response.
*
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getupdates
*/
getUpdates(other?: Other<R, "getUpdates">, signal?: AbortSignal): Promise<import("@grammyjs/types/update.js").Update[]>;
/**
* Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
*
* If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
*
* Notes
* 1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
* 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
* 3. Ports currently supported for Webhooks: 443, 80, 88, 8443.
*
* If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.
*
* @param url HTTPS url to send updates to. Use an empty string to remove webhook integration.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#setwebhook
*/
setWebhook(url: string, other?: Other<R, "setWebhook", "url">, signal?: AbortSignal): Promise<true>;
/**
* Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.
*
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#deletewebhook
*/
deleteWebhook(other?: Other<R, "deleteWebhook">, signal?: AbortSignal): Promise<true>;
/**
* Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
*
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getwebhookinfo
*/
getWebhookInfo(signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").WebhookInfo>;
/**
* A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.
*
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getme
*/
getMe(signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserFromGetMe>;
/**
* Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.
*
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#logout
*/
logOut(signal?: AbortSignal): Promise<true>;
/**
* Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.
*
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#close
*/
close(signal?: AbortSignal): Promise<true>;
/**
* Use this method to send text messages. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param text Text of the message to be sent, 1-4096 characters after entities parsing
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendmessage
*/
sendMessage(chat_id: number | string, text: string, other?: Other<R, "sendMessage", "chat_id" | "text">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.TextMessage>;
/**
* Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param from_chat_id Unique identifier for the chat where the original message was sent (or username of the target bot, supergroup or channel in the format `@username`)
* @param message_id Message identifier in the chat specified in from_chat_id
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#forwardmessage
*/
forwardMessage(chat_id: number | string, from_chat_id: number | string, message_id: number, other?: Other<R, "forwardMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message>;
/**
* Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param from_chat_id Unique identifier for the chat where the original messages were sent (or username of the target bot, supergroup or channel in the format `@username`)
* @param message_ids A list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#forwardmessages
*/
forwardMessages(chat_id: number | string, from_chat_id: number | string, message_ids: number[], other?: Other<R, "forwardMessages", "chat_id" | "from_chat_id" | "message_ids">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId[]>;
/**
* Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param from_chat_id Unique identifier for the chat where the original message was sent (or username of the target bot, supergroup or channel in the format `@username`)
* @param message_id Message identifier in the chat specified in from_chat_id
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#copymessage
*/
copyMessage(chat_id: number | string, from_chat_id: number | string, message_id: number, other?: Other<R, "copyMessage", "chat_id" | "from_chat_id" | "message_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId>;
/**
* Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param from_chat_id Unique identifier for the chat where the original messages were sent (or username of the target bot, supergroup or channel in the format `@username`)
* @param message_ids A list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#copymessages
*/
copyMessages(chat_id: number | string, from_chat_id: number | string, message_ids: number[], other?: Other<R, "copyMessages", "chat_id" | "from_chat_id" | "message_ids">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").MessageId[]>;
/**
* Use this method to send photos. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param photo Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendphoto
*/
sendPhoto(chat_id: number | string, photo: InputFile | string, other?: Other<R, "sendPhoto", "chat_id" | "photo">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.PhotoMessage>;
/**
* Use this method to send live photos. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param live_photo Live photo video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. Sending live photos by a URL is currently unsupported.
* @param photo The static photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. Sending live photos by a URL is currently unsupported.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendlivephoto
*/
sendLivePhoto(chat_id: number | string, live_photo: InputFile | string, photo: InputFile | string, other?: Other<R, "sendLivePhoto", "chat_id" | "live_photo" | "photo">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.LivePhotoMessage>;
/**
* Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
*
* For sending voice messages, use the sendVoice method instead.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param audio Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendaudio
*/
sendAudio(chat_id: number | string, audio: InputFile | string, other?: Other<R, "sendAudio", "chat_id" | "audio">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.AudioMessage>;
/**
* Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param document File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#senddocument
*/
sendDocument(chat_id: number | string, document: InputFile | string, other?: Other<R, "sendDocument", "chat_id" | "document">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.DocumentMessage>;
/**
* Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param video Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendvideo
*/
sendVideo(chat_id: number | string, video: InputFile | string, other?: Other<R, "sendVideo", "chat_id" | "video">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.VideoMessage>;
/**
* Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param animation Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendanimation
*/
sendAnimation(chat_id: number | string, animation: InputFile | string, other?: Other<R, "sendAnimation", "chat_id" | "animation">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.AnimationMessage>;
/**
* Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param voice Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendvoice
*/
sendVoice(chat_id: number | string, voice: InputFile | string, other?: Other<R, "sendVoice", "chat_id" | "voice">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.VoiceMessage>;
/**
* Use this method to send video messages. On success, the sent Message is returned.
* As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param video_note Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending video notes by a URL is currently unsupported
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendvideonote
*/
sendVideoNote(chat_id: number | string, video_note: InputFile | string, other?: Other<R, "sendVideoNote", "chat_id" | "video_note">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.VideoNoteMessage>;
/**
* Use this method to send paid media. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param star_count The number of Telegram Stars that must be paid to buy access to the media
* @param media An array describing the media to be sent; up to 10 items
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
*/
sendPaidMedia(chat_id: number | string, star_count: number, media: InputPaidMedia[], other?: Other<R, "sendPaidMedia", "chat_id" | "star_count" | "media">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.PaidMediaMessage>;
/**
* Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param media An array describing messages to be sent, must include 2-10 items
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendmediagroup
*/
sendMediaGroup(chat_id: number | string, media: ReadonlyArray<InputMediaAudio | InputMediaDocument | InputMediaLivePhoto | InputMediaPhoto | InputMediaVideo>, other?: Other<R, "sendMediaGroup", "chat_id" | "media">, signal?: AbortSignal): Promise<(import("@grammyjs/types/message.js").Message.PhotoMessage | import("@grammyjs/types/message.js").Message.LivePhotoMessage | import("@grammyjs/types/message.js").Message.AudioMessage | import("@grammyjs/types/message.js").Message.DocumentMessage | import("@grammyjs/types/message.js").Message.VideoMessage)[]>;
/**
* Use this method to send point on the map. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param latitude Latitude of the location
* @param longitude Longitude of the location
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendlocation
*/
sendLocation(chat_id: number | string, latitude: number, longitude: number, other?: Other<R, "sendLocation", "chat_id" | "latitude" | "longitude">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.LocationMessage>;
/**
* Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param message_id Identifier of the message to edit
* @param latitude Latitude of new location
* @param longitude Longitude of new location
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
*/
editMessageLiveLocation(chat_id: number | string, message_id: number, latitude: number, longitude: number, other?: Other<R, "editMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id" | "latitude" | "longitude">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
location: import("@grammyjs/types/message.js").Location;
})>;
/**
* Use this method to edit live location inline messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
*
* @param inline_message_id Identifier of the inline message
* @param latitude Latitude of new location
* @param longitude Longitude of new location
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
*/
editMessageLiveLocationInline(inline_message_id: string, latitude: number, longitude: number, other?: Other<R, "editMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id" | "latitude" | "longitude">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
location: import("@grammyjs/types/message.js").Location;
})>;
/**
* Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param message_id Identifier of the message with live location to stop
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#stopmessagelivelocation
*/
stopMessageLiveLocation(chat_id: number | string, message_id: number, other?: Other<R, "stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
location: import("@grammyjs/types/message.js").Location;
})>;
/**
* Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
*
* @param inline_message_id Identifier of the inline message
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#stopmessagelivelocation
*/
stopMessageLiveLocationInline(inline_message_id: string, other?: Other<R, "stopMessageLiveLocation", "chat_id" | "message_id" | "inline_message_id">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
location: import("@grammyjs/types/message.js").Location;
})>;
/**
* Use this method to send information about a venue. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param latitude Latitude of the venue
* @param longitude Longitude of the venue
* @param title Name of the venue
* @param address Address of the venue
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendvenue
*/
sendVenue(chat_id: number | string, latitude: number, longitude: number, title: string, address: string, other?: Other<R, "sendVenue", "chat_id" | "latitude" | "longitude" | "title" | "address">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.VenueMessage>;
/**
* Use this method to send phone contacts. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param phone_number Contact's phone number
* @param first_name Contact's first name
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendcontact
*/
sendContact(chat_id: number | string, phone_number: string, first_name: string, other?: Other<R, "sendContact", "chat_id" | "phone_number" | "first_name">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.ContactMessage>;
/**
* Use this method to send a native poll. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param question Poll question, 1-300 characters
* @param options A list of answer options, 1-12 strings 1-100 characters each
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendpoll
*/
sendPoll(chat_id: number | string, question: string, options: (string | InputPollOption)[], other?: Other<R, "sendPoll", "chat_id" | "question" | "options">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.PollMessage>;
/**
* Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.
*
* @param business_connection_id Unique identifier of the business connection on behalf of which the message will be sent
* @param chat_id Unique identifier for the target chat or username of the target bot in the format `@username`
* @param checklist An object for the checklist to send
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendchecklist
*/
sendChecklist(business_connection_id: string, chat_id: number | string, checklist: InputChecklist, other?: Other<R, "sendChecklist", "business_connection_id" | "chat_id" | "checklist">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.ChecklistMessage>;
/**
* Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned.
*
* @param business_connection_id Unique identifier of the business connection on behalf of which the message will be sent
* @param chat_id Unique identifier for the target chat or username of the target bot in the format `@username`
* @param message_id Unique identifier for the target message
* @param checklist An object for the new checklist
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#editmessagechecklist
*/
editMessageChecklist(business_connection_id: string, chat_id: number | string, message_id: number, checklist: InputChecklist, other?: Other<R, "editMessageChecklist", "business_connection_id" | "chat_id" | "messaage_id" | "checklist">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.ChecklistMessage>;
/**
* Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
*
* @param chat_id Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username`
* @param emoji Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#senddice
*/
sendDice(chat_id: number | string, emoji: (string & Record<never, never>) | "🎲" | "🎯" | "🏀" | "⚽" | "🎳" | "🎰", other?: Other<R, "sendDice", "chat_id" | "emoji">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.DiceMessage>;
/**
* Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.
*
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param message_id Identifier of the target message
* @param reaction A list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#setmessagereaction
*/
setMessageReaction(chat_id: number | string, message_id: number, reaction: ReactionType[], other?: Other<R, "setMessageReaction", "chat_id" | "message_id" | "reaction">, signal?: AbortSignal): Promise<true>;
/**
* Use this method to stream a partial message to a user while the message is being generated. Returns True on success.
*
* @param chat_id Unique identifier for the target private chat
* @param draft_id Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated.
* @param text Text of the message to be sent, 1-4096 characters after entities parsing
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendmessagedraft
*/
sendMessageDraft(chat_id: number, draft_id: number, text: string, other?: Other<R, "sendMessageDraft", "chat_id" | "draft_id" | "text">, signal?: AbortSignal): Promise<true>;
/**
* Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
*
* Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.
*
* We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
*
* @param chat_id Unique identifier for the target chat or username of the target bot or supergroup in the format `@username`
* @param action Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#sendchataction
*/
sendChatAction(chat_id: number | string, action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note", other?: Other<R, "sendChatAction", "chat_id" | "action">, signal?: AbortSignal): Promise<true>;
/**
* Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
*
* @param user_id Unique identifier of the target user
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getuserprofilephotos
*/
getUserProfilePhotos(user_id: number, other?: Other<R, "getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfilePhotos>;
/**
* Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
*
* @param user_id Unique identifier of the target user
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getuserprofileaudios
*/
getUserProfileAudios(user_id: number, other?: Other<R, "getUserProfileAudios", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfileAudios>;
/**
* Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
*
* @param user_id Unique identifier of the target user
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#setuseremojistatus
*/
setUserEmojiStatus(user_id: number, other?: Other<R, "setUserEmojiStatus", "user_id">, signal?: AbortSignal): Promise<true>;
/**
* Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
*
* @param chat_id Unique identifier for the chat or username of the channel (in the format @channelusername)
* @param user_id Unique identifier of the target user
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getuserchatboosts
*/
getUserChatBoosts(chat_id: number | string, user_id: number, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserChatBoosts>;
/**
* Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.
*
* @param user_id Unique identifier of the user
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getusergifts
*/
getUserGifts(user_id: number, other?: Other<R, "getUserGifts", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").OwnedGifts>;
/**
* Returns the gifts owned by a chat. Returns OwnedGifts on success.
*
* @param chat_id Unique identifier for the target chat or username of the target channel in the format `@username`
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getchatgifts
*/
getChatGifts(chat_id: number, other?: Other<R, "getChatGifts", "chat_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").OwnedGifts>;
/**
* Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.
*
* @param business_connection_id Unique identifier of the business connection
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getbusinessconnection
*/
getBusinessConnection(business_connection_id: string, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").BusinessConnection>;
/**
* Use this method to get the token of a managed bot. Returns the token as String on success.
*
* @param user_id User identifier of the managed bot whose token will be returned
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getmanagedbottoken
*/
getManagedBotToken(user_id: number, signal?: AbortSignal): Promise<string>;
/**
* Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as String on success.
*
* @param user_id User identifier of the managed bot whose token will be replaced
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#replacemanagedbottoken
*/
replaceManagedBotToken(user_id: number, signal?: AbortSignal): Promise<string>;
/**
* Use this method to get the access settings of a managed bot. Returns a BotAccessSettings object on success.
*
* @param user_id User identifier of the managed bot whose access settings will be returned
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getmanagedbotaccesssettings
*/
getManagedBotAccessSettings(user_id: number, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").BotAccessSettings>;
/**
* Use this method to change the access settings of a managed bot. Returns True on success.
*
* @param user_id User identifier of the managed bot whose access settings will be changed
* @param is_access_restricted Pass True, if only selected users can access the bot
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#setmanagedbotaccesssettingsrestricted
*/
setManagedBotAccessSettings(user_id: number, is_access_restricted: boolean, other?: Other<R, "setManagedBotAccessSettings", "user_id" | "is_access_restricted">, signal?: AbortSignal): Promise<true>;
/**
* Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link `https://api.telegram.org/file/bot<token>/<file_path>`, where `<file_path>` is taken from the response. 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 again.
*
* Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
*
* @param file_id File identifier to get info about
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#getfile
*/
getFile(file_id: string, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").File>;
/** @deprecated Use `banChatMember` instead. */
kickChatMember(...args: Parameters<Api["banChatMember"]>): Promise<true>;
/**
* Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
*
* @param chat_id Unique identifier for the target group or username of the target supergroup or channel in the format `@username`
* @param user_id Unique identifier of the target user
* @param other Optional remaining parameters, confer the official reference below
* @param signal Optional `AbortSignal` to cancel the request
*
* **Official reference:** https://core.telegram.org/bots/api#banchatmember