GramIO API Reference / @gramio/contexts/dist / ChosenInlineResultContext
Class: ChosenInlineResultContext<Bot>
Defined in: contexts/index.d.ts:5603
The result of an inline query that was chosen by a user and sent to their chat partner
Extends
Context<Bot>.Constructor<ChosenInlineResultContext<Bot>>.ChosenInlineResult.SendMixin<Bot>.ChatActionMixin<Bot>.CloneMixin<Bot,ChosenInlineResultContext<Bot>,ChosenInlineResultContextOptions<Bot>>
Type Parameters
| Type Parameter |
|---|
Bot extends BotLike |
Constructors
Constructor
new ChosenInlineResultContext<
Bot>(options):ChosenInlineResultContext<Bot>
Defined in: contexts/index.d.ts:5606
Parameters
| Parameter | Type |
|---|---|
options | ChosenInlineResultContextOptions<Bot> |
Returns
ChosenInlineResultContext<Bot>
Overrides
Constructor
new ChosenInlineResultContext(...
args):ChosenInlineResultContext
Defined in: contexts/index.d.ts:5603
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
ChosenInlineResultContext
Overrides
Context<Bot>.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
bot | public | Bot | - | Context.bot | contexts/index.d.ts:4726 |
isTopicMessage | public | () => boolean | - | SendMixin.isTopicMessage | contexts/index.d.ts:4863 |
payload | public | TelegramChosenInlineResult | The raw data that is used for this Context | ChosenInlineResult.payload | contexts/index.d.ts:5605 |
update? | public | TelegramUpdate | - | Context.update | contexts/index.d.ts:4728 |
updateId? | public | number | - | Context.updateId | contexts/index.d.ts:4727 |
updateType | protected | UpdateName | - | Context.updateType | contexts/index.d.ts:4729 |
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: contexts/index.d.ts:4732
Returns
string
Inherited from
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
from
Get Signature
get from():
User
Defined in: contexts/index.d.ts:3984
The user that chose the result
Returns
Inherited from
inlineMessageId
Get Signature
get inlineMessageId():
string
Defined in: contexts/index.d.ts:3994
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.
Returns
string
Inherited from
ChosenInlineResult.inlineMessageId
location
Get Signature
get location():
Location
Defined in: contexts/index.d.ts:3988
Sender location, only for bots that require user location
Returns
Inherited from
query
Get Signature
get query():
string
Defined in: contexts/index.d.ts:3996
The query that was used to obtain the result
Returns
string
Inherited from
resultId
Get Signature
get resultId():
string
Defined in: contexts/index.d.ts:3982
The unique identifier for the result that was chosen
Returns
string
Inherited from
senderId
Get Signature
get senderId():
number
Defined in: contexts/index.d.ts:3986
Sender ID
Returns
number
Inherited from
threadId
Get Signature
get threadId():
number
Defined in: contexts/index.d.ts:4862
Returns
number
Inherited from
Methods
clone()
clone(
options?):ChosenInlineResultContext
Defined in: contexts/index.d.ts:5273
Parameters
| Parameter | Type |
|---|---|
options? | ChosenInlineResultContextOptions |
Returns
ChosenInlineResultContext
Inherited from
createActionController()
createActionController(
action,params?):ChatActionController<Bot>
Defined in: contexts/index.d.ts:5262
Parameters
| Parameter | Type |
|---|---|
action | SendChatActionAction |
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
editCaption()
editCaption(
caption,params?):Promise<true|TelegramMessage>
Defined in: contexts/index.d.ts:5614
Edits a callback query messages caption
Parameters
| Parameter | Type |
|---|---|
caption | NonNullable<string | { toString: string; }> |
params? | Partial<EditMessageCaptionParams> |
Returns
Promise<true | TelegramMessage>
editLiveLocation()
editLiveLocation(
params):Promise<true|TelegramMessage>
Defined in: contexts/index.d.ts:5618
Edits a callback query messages live location
Parameters
| Parameter | Type |
|---|---|
params | EditMessageLiveLocationParams |
Returns
Promise<true | TelegramMessage>
editMedia()
editMedia(
media,params?):Promise<true|TelegramMessage>
Defined in: contexts/index.d.ts:5616
Edits a callback query messages media
Parameters
| Parameter | Type |
|---|---|
media | TelegramInputMedia |
params? | Partial<EditMessageMediaParams> |
Returns
Promise<true | TelegramMessage>
editReplyMarkup()
editReplyMarkup(
replyMarkup,params?):Promise<true|TelegramMessage>
Defined in: contexts/index.d.ts:5622
Edits a callback query messages reply markup
Parameters
| Parameter | Type |
|---|---|
replyMarkup | TelegramInlineKeyboardMarkup | { toJSON: TelegramInlineKeyboardMarkup; } |
params? | Partial<EditMessageReplyMarkupParams> |
Returns
Promise<true | TelegramMessage>
editText()
editText(
text,params?):Promise<true|TelegramMessage>
Defined in: contexts/index.d.ts:5612
Edits a callback query messages text
Parameters
| Parameter | Type |
|---|---|
text | string | { toString: string; } |
params? | Partial<EditMessageTextParams> |
Returns
Promise<true | TelegramMessage>
getChatBoosts()
getChatBoosts(
userId):Promise<TelegramUserChatBoosts>
Defined in: contexts/index.d.ts:4938
Returns chat boosts by the user
Parameters
| Parameter | Type |
|---|---|
userId | number |
Returns
Promise<TelegramUserChatBoosts>
Inherited from
hasInlineMessageId()
hasInlineMessageId():
this is Require<ChosenInlineResultContext<Bot>, "inlineMessageId">
Defined in: contexts/index.d.ts:5610
Checks if the query has inlineMessageId property
Returns
this is Require<ChosenInlineResultContext<Bot>, "inlineMessageId">
hasLocation()
hasLocation():
this is Require<ChosenInlineResultContext<Bot>, "location">
Defined in: contexts/index.d.ts:5608
Checks if the result has location property
Returns
this is Require<ChosenInlineResultContext<Bot>, "location">
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
| Parameter | Type |
|---|---|
rawTypes | MaybeArray<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
send()
send(
text,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4868
Sends message to current chat
Parameters
| Parameter | Type |
|---|---|
text | string | { toString: string; } |
params? | Optional<SendMessageParams, "text" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendAnimation()
sendAnimation(
animation,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4878
Sends animation to current chat
Parameters
| Parameter | Type |
|---|---|
animation | string | Blob |
params? | Optional<SendAnimationParams, "animation" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendAudio()
sendAudio(
audio,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4874
Sends audio to current chat
Parameters
| Parameter | Type |
|---|---|
audio | string | Blob |
params? | Optional<SendAudioParams, "audio" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendChatAction()
sendChatAction(
action,params?):Promise<true>
Defined in: contexts/index.d.ts:4902
Sends chat action to current chat
Parameters
| Parameter | Type |
|---|---|
action | SendChatActionAction |
params? | Optional<SendChatActionParams, "chat_id" | "action"> |
Returns
Promise<true>
Inherited from
sendChecklist()
sendChecklist(
params):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4894
Sends checklist to current chat
Parameters
| Parameter | Type |
|---|---|
params | Optional<SendChecklistParams, "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendContact()
sendContact(
params):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4890
Sends contact to current chat
Parameters
| Parameter | Type |
|---|---|
params | Optional<SendContactParams, "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendDice()
sendDice(
emoji,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4904
Sends dice
Parameters
| Parameter | Type |
|---|---|
emoji | SendDiceEmoji |
params? | Partial<SendDiceParams> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendDocument()
sendDocument(
document,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4872
Sends document to current chat
Parameters
| Parameter | Type |
|---|---|
document | string | Blob |
params? | Optional<SendDocumentParams, "document" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendInvoice()
sendInvoice(
params):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4886
Sends invoice to current user
Parameters
| Parameter | Type |
|---|---|
params | Optional<SendInvoiceParams, "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendLocation()
sendLocation(
latitude,longitude,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4884
Sends location to current chat
Parameters
| Parameter | Type |
|---|---|
latitude | number |
longitude | number |
params? | Optional<SendLocationParams, "chat_id" | "latitude" | "longitude"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendMedia()
sendMedia<
T>(query):ReturnType<Textends"animation"? (animation,params?) =>Promise<MessageContext<Bot>> :Textends"audio"? (audio,params?) =>Promise<MessageContext<Bot>> :Textends"document"? (document,params?) =>Promise<MessageContext<Bot>> :Textends"photo"? (photo,params?) =>Promise<MessageContext<Bot>> :Textends"sticker"? (sticker,params?) =>Promise<MessageContext<Bot>> :Textends"video_note"? (videoNote,params?) =>Promise<MessageContext<Bot>> :Textends"video"? (video,params?) =>Promise<MessageContext<...>> :Textends"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
| Parameter | Type |
|---|---|
query | object & 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
context.sendMedia({
type: 'photo',
photo: MediaUpload.path('./image.png'),
caption: 'good image yes yes'
})Inherited from
sendMediaGroup()
sendMediaGroup(
mediaGroup,params?):Promise<MessageContext<Bot>[]>
Defined in: contexts/index.d.ts:4908
Sends media group to current chat
Parameters
| Parameter | Type |
|---|---|
mediaGroup | (TelegramInputMediaAudio | TelegramInputMediaDocument | TelegramInputMediaPhoto | TelegramInputMediaVideo)[] |
params? | Optional<SendMediaGroupParams, "chat_id" | "media"> |
Returns
Promise<MessageContext<Bot>[]>
Inherited from
sendMessageDraft()
sendMessageDraft(
params):Promise<true>
Defined in: contexts/index.d.ts:4900
Sends a message draft to the current private chat
Parameters
| Parameter | Type |
|---|---|
params | Optional<SendMessageDraftParams, "chat_id"> |
Returns
Promise<true>
Inherited from
sendPaidMedia()
sendPaidMedia(
paidMedia,starCount,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4906
Sends paid media to current chat
Parameters
| Parameter | Type |
|---|---|
paidMedia | TelegramInputPaidMedia[] |
starCount | number |
params? | Optional<SendPaidMediaParams, "chat_id" | "media" | "star_count"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendPhoto()
sendPhoto(
photo,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4870
Sends photo to current chat
Parameters
| Parameter | Type |
|---|---|
photo | string | Blob |
params? | Optional<SendPhotoParams, "photo" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendPoll()
sendPoll(
params):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4892
Sends poll to current chat
Parameters
| Parameter | Type |
|---|---|
params | Optional<SendPollParams, "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendSticker()
sendSticker(
sticker,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4896
Sends sticker
Parameters
| Parameter | Type |
|---|---|
sticker | string | Blob |
params? | Optional<SendStickerParams, "sticker" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendVenue()
sendVenue(
params):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4888
Sends venue to current chat
Parameters
| Parameter | Type |
|---|---|
params | Optional<SendVenueParams, "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendVideo()
sendVideo(
video,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4876
Sends video to current chat
Parameters
| Parameter | Type |
|---|---|
video | string | Blob |
params? | Optional<SendVideoParams, "video" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendVideoNote()
sendVideoNote(
videoNote,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4880
Sends video note to current chat
Parameters
| Parameter | Type |
|---|---|
videoNote | string | Blob |
params? | Optional<SendVideoNoteParams, "video_note" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
sendVoice()
sendVoice(
voice,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4882
Sends voice to current chat
Parameters
| Parameter | Type |
|---|---|
voice | string | Blob |
params? | Optional<SendVoiceParams, "voice" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
stopLiveLocation()
stopLiveLocation(
params?):Promise<true|TelegramMessage>
Defined in: contexts/index.d.ts:5620
Stops a callback query messages live location
Parameters
| Parameter | Type |
|---|---|
params? | StopMessageLiveLocationParams |
Returns
Promise<true | TelegramMessage>
stopPoll()
stopPoll(
messageId,params?):Promise<Poll>
Defined in: contexts/index.d.ts:4898
Stops poll in current chat
Parameters
| Parameter | Type |
|---|---|
messageId | number |
params? | Partial<StopPollParams> |
Returns
Promise<Poll>
Inherited from
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
| Parameter | Type |
|---|---|
stream | Iterable<MessageDraftPiece, any, any> | AsyncIterable<MessageDraftPiece, any, any> |
options? | StreamMessageOptions |
Returns
Promise<MessageContext<Bot>[]>
Example
// Stream from an async generator (e.g., LLM output)
const messages = await context.streamMessage(llmStream);