Skip to content

GramIO API Reference / @gramio/contexts/dist / PreCheckoutQueryContext

Class: PreCheckoutQueryContext<Bot>

Defined in: contexts/index.d.ts:6290

This object contains information about an incoming pre-checkout query.

Documentation

Extends

Type Parameters

Type Parameter
Bot extends BotLike

Constructors

Constructor

new PreCheckoutQueryContext<Bot>(options): PreCheckoutQueryContext<Bot>

Defined in: contexts/index.d.ts:6293

Parameters

ParameterType
optionsPreCheckoutQueryContextOptions<Bot>

Returns

PreCheckoutQueryContext<Bot>

Overrides

Context.constructor


Constructor

new PreCheckoutQueryContext(...args): PreCheckoutQueryContext

Defined in: contexts/index.d.ts:6290

Parameters

ParameterType
...argsany[]

Returns

PreCheckoutQueryContext

Overrides

Context<Bot>.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
botpublicBot-Context.botcontexts/index.d.ts:4726
isTopicMessagepublic() => boolean-SendMixin.isTopicMessagecontexts/index.d.ts:4863
payloadpublicTelegramPreCheckoutQueryThe raw data that is used for this ContextPreCheckoutQuery.payloadcontexts/index.d.ts:6292
update?publicTelegramUpdate-Context.updatecontexts/index.d.ts:4728
updateId?publicnumber-Context.updateIdcontexts/index.d.ts:4727
updateTypeprotectedUpdateName-Context.updateTypecontexts/index.d.ts:4729

Accessors

[toStringTag]

Get Signature

get [toStringTag](): string

Defined in: contexts/index.d.ts:4732

MDN

Returns

string

Inherited from

Context.[toStringTag]


businessConnectionId

Get Signature

get businessConnectionId(): string

Defined in: contexts/index.d.ts:4860

Returns

string

Inherited from

SendMixin.businessConnectionId


chatId

Get Signature

get chatId(): number

Defined in: contexts/index.d.ts:4859

Returns

number

Inherited from

SendMixin.chatId


currency

Get Signature

get currency(): TelegramCurrencies

Defined in: contexts/index.d.ts:4394

Three-letter ISO 4217 currency code

Returns

TelegramCurrencies

Inherited from

PreCheckoutQuery.currency


from

Get Signature

get from(): User

Defined in: contexts/index.d.ts:4390

User who sent the query

Returns

User

Inherited from

PreCheckoutQuery.from


id

Get Signature

get id(): string

Defined in: contexts/index.d.ts:4388

Unique query identifier

Returns

string

Inherited from

PreCheckoutQuery.id


invoicePayload

Get Signature

get invoicePayload(): string

Defined in: contexts/index.d.ts:4405

Bot specified invoice payload

Returns

string

Inherited from

PreCheckoutQuery.invoicePayload


orderInfo

Get Signature

get orderInfo(): OrderInfo

Defined in: contexts/index.d.ts:4409

Order info provided by the user

Returns

OrderInfo

Inherited from

PreCheckoutQuery.orderInfo


senderId

Get Signature

get senderId(): number

Defined in: contexts/index.d.ts:4392

Sender ID

Returns

number

Inherited from

PreCheckoutQuery.senderId


shippingOptionId

Get Signature

get shippingOptionId(): string

Defined in: contexts/index.d.ts:4407

Identifier of the shipping option chosen by the user

Returns

string

Inherited from

PreCheckoutQuery.shippingOptionId


threadId

Get Signature

get threadId(): number

Defined in: contexts/index.d.ts:4862

Returns

number

Inherited from

SendMixin.threadId


totalAmount

Get Signature

get totalAmount(): number

Defined in: contexts/index.d.ts:4403

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).

Returns

number

Inherited from

PreCheckoutQuery.totalAmount

Methods

answer()

answer(params): Promise<true>

Defined in: contexts/index.d.ts:6301

Answers to the pending pre-checkout query. An alias for answerPreCheckoutQuery

Parameters

ParameterType
paramsOptional<AnswerPreCheckoutQueryParams, "pre_checkout_query_id">

Returns

Promise<true>


answerPreCheckoutQuery()

answerPreCheckoutQuery(params): Promise<true>

Defined in: contexts/index.d.ts:6299

Answers to the pending pre-checkout query

Parameters

ParameterType
paramsOptional<AnswerPreCheckoutQueryParams, "pre_checkout_query_id">

Returns

Promise<true>


clone()

clone(options?): PreCheckoutQueryContext

Defined in: contexts/index.d.ts:5273

Parameters

ParameterType
options?PreCheckoutQueryContextOptions

Returns

PreCheckoutQueryContext

Inherited from

CloneMixin.clone


createActionController()

createActionController(action, params?): ChatActionController<Bot>

Defined in: contexts/index.d.ts:5262

Parameters

ParameterType
actionSendChatActionAction
params?Pick<SendChatActionParams, "business_connection_id" | "message_thread_id"> & object & CreateActionControllerParams

Returns

ChatActionController<Bot>

Deprecated

Creates a controller that when start()ed executes sendChatAction(action) every interval milliseconds until stop()ped

Inherited from

ChatActionMixin.createActionController


getChatBoosts()

getChatBoosts(userId): Promise<TelegramUserChatBoosts>

Defined in: contexts/index.d.ts:4938

Returns chat boosts by the user

Parameters

ParameterType
userIdnumber

Returns

Promise<TelegramUserChatBoosts>

Inherited from

SendMixin.getChatBoosts


hasOrderInfo()

hasOrderInfo(): this is Require<PreCheckoutQueryContext<Bot>, "orderInfo">

Defined in: contexts/index.d.ts:6297

Checks if the query has orderInfo property

Returns

this is Require<PreCheckoutQueryContext<Bot>, "orderInfo">


hasShippingOptionId()

hasShippingOptionId(): this is Require<PreCheckoutQueryContext<Bot>, "shippingOptionId">

Defined in: contexts/index.d.ts:6295

Checks if the query has shippingOptionId property

Returns

this is Require<PreCheckoutQueryContext<Bot>, "shippingOptionId">


is()

is<T>(rawTypes): this is InstanceType<ContextsMapping<Bot>[T]> & Bot["__Derives"]["global"] & Bot["__Derives"][T] & (Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})

Defined in: contexts/index.d.ts:4735

Type Parameters

Type Parameter
T extends UpdateName

Parameters

ParameterType
rawTypesMaybeArray<SoftString<T>>

Returns

this is InstanceType<ContextsMapping<Bot>[T]> & Bot["__Derives"]["global"] & Bot["__Derives"][T] & (Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})

Inherited from

Context.is


send()

send(text, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4868

Sends message to current chat

Parameters

ParameterType
textstring | { toString: string; }
params?Optional<SendMessageParams, "text" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.send


sendAnimation()

sendAnimation(animation, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4878

Sends animation to current chat

Parameters

ParameterType
animationstring | Blob
params?Optional<SendAnimationParams, "animation" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendAnimation


sendAudio()

sendAudio(audio, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4874

Sends audio to current chat

Parameters

ParameterType
audiostring | Blob
params?Optional<SendAudioParams, "audio" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendAudio


sendChatAction()

sendChatAction(action, params?): Promise<true>

Defined in: contexts/index.d.ts:4902

Sends chat action to current chat

Parameters

ParameterType
actionSendChatActionAction
params?Optional<SendChatActionParams, "chat_id" | "action">

Returns

Promise<true>

Inherited from

SendMixin.sendChatAction


sendChecklist()

sendChecklist(params): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4894

Sends checklist to current chat

Parameters

ParameterType
paramsOptional<SendChecklistParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendChecklist


sendContact()

sendContact(params): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4890

Sends contact to current chat

Parameters

ParameterType
paramsOptional<SendContactParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendContact


sendDice()

sendDice(emoji, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4904

Sends dice

Parameters

ParameterType
emojiSendDiceEmoji
params?Partial<SendDiceParams>

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendDice


sendDocument()

sendDocument(document, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4872

Sends document to current chat

Parameters

ParameterType
documentstring | Blob
params?Optional<SendDocumentParams, "document" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendDocument


sendInvoice()

sendInvoice(params): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4886

Sends invoice to current user

Parameters

ParameterType
paramsOptional<SendInvoiceParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendInvoice


sendLocation()

sendLocation(latitude, longitude, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4884

Sends location to current chat

Parameters

ParameterType
latitudenumber
longitudenumber
params?Optional<SendLocationParams, "chat_id" | "latitude" | "longitude">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendLocation


sendMedia()

sendMedia<T>(query): ReturnType<T extends "animation" ? (animation, params?) => Promise<MessageContext<Bot>> : T extends "audio" ? (audio, params?) => Promise<MessageContext<Bot>> : T extends "document" ? (document, params?) => Promise<MessageContext<Bot>> : T extends "photo" ? (photo, params?) => Promise<MessageContext<Bot>> : T extends "sticker" ? (sticker, params?) => Promise<MessageContext<Bot>> : T extends "video_note" ? (videoNote, params?) => Promise<MessageContext<Bot>> : T extends "video" ? (video, params?) => Promise<MessageContext<...>> : T extends "voice" ? (voice, params?) => Promise<...> : () => never>

Defined in: contexts/index.d.ts:4921

Automatically uses correct media method to send media

Type Parameters

Type Parameter
T extends string

Parameters

ParameterType
queryobject & tSendMethods

Returns

ReturnType<T extends "animation" ? (animation, params?) => Promise<MessageContext<Bot>> : T extends "audio" ? (audio, params?) => Promise<MessageContext<Bot>> : T extends "document" ? (document, params?) => Promise<MessageContext<Bot>> : T extends "photo" ? (photo, params?) => Promise<MessageContext<Bot>> : T extends "sticker" ? (sticker, params?) => Promise<MessageContext<Bot>> : T extends "video_note" ? (videoNote, params?) => Promise<MessageContext<Bot>> : T extends "video" ? (video, params?) => Promise<MessageContext<...>> : T extends "voice" ? (voice, params?) => Promise<...> : () => never>

Example

js
context.sendMedia({
  type: 'photo',
  photo: MediaUpload.path('./image.png'),
  caption: 'good image yes yes'
})

Inherited from

SendMixin.sendMedia


sendMediaGroup()

sendMediaGroup(mediaGroup, params?): Promise<MessageContext<Bot>[]>

Defined in: contexts/index.d.ts:4908

Sends media group to current chat

Parameters

ParameterType
mediaGroup(TelegramInputMediaAudio | TelegramInputMediaDocument | TelegramInputMediaPhoto | TelegramInputMediaVideo)[]
params?Optional<SendMediaGroupParams, "chat_id" | "media">

Returns

Promise<MessageContext<Bot>[]>

Inherited from

SendMixin.sendMediaGroup


sendMessageDraft()

sendMessageDraft(params): Promise<true>

Defined in: contexts/index.d.ts:4900

Sends a message draft to the current private chat

Parameters

ParameterType
paramsOptional<SendMessageDraftParams, "chat_id">

Returns

Promise<true>

Inherited from

SendMixin.sendMessageDraft


sendPaidMedia()

sendPaidMedia(paidMedia, starCount, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4906

Sends paid media to current chat

Parameters

ParameterType
paidMediaTelegramInputPaidMedia[]
starCountnumber
params?Optional<SendPaidMediaParams, "chat_id" | "media" | "star_count">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendPaidMedia


sendPhoto()

sendPhoto(photo, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4870

Sends photo to current chat

Parameters

ParameterType
photostring | Blob
params?Optional<SendPhotoParams, "photo" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendPhoto


sendPoll()

sendPoll(params): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4892

Sends poll to current chat

Parameters

ParameterType
paramsOptional<SendPollParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendPoll


sendSticker()

sendSticker(sticker, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4896

Sends sticker

Parameters

ParameterType
stickerstring | Blob
params?Optional<SendStickerParams, "sticker" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendSticker


sendVenue()

sendVenue(params): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4888

Sends venue to current chat

Parameters

ParameterType
paramsOptional<SendVenueParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendVenue


sendVideo()

sendVideo(video, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4876

Sends video to current chat

Parameters

ParameterType
videostring | Blob
params?Optional<SendVideoParams, "video" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendVideo


sendVideoNote()

sendVideoNote(videoNote, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4880

Sends video note to current chat

Parameters

ParameterType
videoNotestring | Blob
params?Optional<SendVideoNoteParams, "video_note" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendVideoNote


sendVoice()

sendVoice(voice, params?): Promise<MessageContext<Bot>>

Defined in: contexts/index.d.ts:4882

Sends voice to current chat

Parameters

ParameterType
voicestring | Blob
params?Optional<SendVoiceParams, "voice" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendVoice


stopPoll()

stopPoll(messageId, params?): Promise<Poll>

Defined in: contexts/index.d.ts:4898

Stops poll in current chat

Parameters

ParameterType
messageIdnumber
params?Partial<StopPollParams>

Returns

Promise<Poll>

Inherited from

SendMixin.stopPoll


streamMessage()

streamMessage(stream, options?): Promise<MessageContext<Bot>[]>

Defined in: contexts/index.d.ts:4936

Streams message drafts to the current chat, finalizing each completed draft as a sent message.

Accepts an Iterable or AsyncIterable of MessageDraftPiece (strings or objects with text+entities). Uses sendMessageDraft for live typing previews and sendMessage to finalize each 4096-char segment. Returns an array of sent MessageContext objects.

Parameters

ParameterType
streamIterable<MessageDraftPiece, any, any> | AsyncIterable<MessageDraftPiece, any, any>
options?StreamMessageOptions

Returns

Promise<MessageContext<Bot>[]>

Example

ts
// Stream from an async generator (e.g., LLM output)
const messages = await context.streamMessage(llmStream);

Inherited from

SendMixin.streamMessage