Skip to content

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

Class: NodeMixin<Bot>

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

This object represents a mixin which has id field and can invoke id-dependent methods

Extends

Extended by

Type Parameters

Type Parameter
Bot extends BotLike

Constructors

Constructor

new NodeMixin<Bot>(): NodeMixin<Bot>

Returns

NodeMixin<Bot>

Inherited from

Context.constructor

Properties

PropertyModifierTypeInherited fromDefined in
botpublicBotContext.botcontexts/index.d.ts:5240
isTopicMessagepublic() => booleanSendMixin.isTopicMessagecontexts/index.d.ts:5458
update?publicTelegramUpdateContext.updatecontexts/index.d.ts:5242
updateId?publicnumberContext.updateIdcontexts/index.d.ts:5241
updateTypeprotectedUpdateNameContext.updateTypecontexts/index.d.ts:5243

Accessors

[toStringTag]

Get Signature

get [toStringTag](): string

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

MDN

Returns

string

Inherited from

Context.[toStringTag]


businessConnectionId

Get Signature

get businessConnectionId(): string

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

Returns

string

Inherited from

SendMixin.businessConnectionId


chatId

Get Signature

get chatId(): number

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

Returns

number

Inherited from

SendMixin.chatId


id

Get Signature

get id(): number

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

Returns

number


senderId

Get Signature

get senderId(): number

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

Returns

number

Inherited from

SendMixin.senderId


threadId

Get Signature

get threadId(): number

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

Returns

number

Inherited from

SendMixin.threadId

Methods

clearReactions()

clearReactions(params?): Promise<true>

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

Clears reactions from the message

Parameters

ParameterType
params?Optional<SetMessageReactionParams, "chat_id" | "message_id">

Returns

Promise<true>


copy()

copy(params?): Promise<MessageId>

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

Copies current message [into other chat if chatId is provided]

Parameters

ParameterType
params?Optional<CopyMessageParams, "chat_id" | "message_id" | "from_chat_id">

Returns

Promise<MessageId>


copyMessages()

copyMessages(chatId, ids, params?): Promise<MessageId[]>

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

Copies messages from current chat and sends to another

Parameters

ParameterType
chatIdstring | number
idsnumber[]
params?Optional<CopyMessagesParams, "chat_id" | "message_ids" | "from_chat_id">

Returns

Promise<MessageId[]>


delete()

delete(params?): Promise<true>

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

Deletes current message

Parameters

ParameterType
params?Optional<DeleteMessageParams, "chat_id" | "message_id">

Returns

Promise<true>


deleteAllReactions()

deleteAllReactions(params?): Promise<true>

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

Removes up to 10000 recent reactions in current chat added by a given user or chat

Parameters

ParameterType
params?Optional<DeleteAllMessageReactionsParams, "chat_id">

Returns

Promise<true>


deleteMessages()

deleteMessages(ids): Promise<true>

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

Deletes messages in current chat

Parameters

ParameterType
idsnumber[]

Returns

Promise<true>


deleteReaction()

deleteReaction(params?): Promise<true>

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

Removes a reaction from current message

Parameters

ParameterType
params?Optional<DeleteMessageReactionParams, "chat_id" | "message_id">

Returns

Promise<true>


editCaption()

editCaption(caption, params?): Promise<true | MessageContext<Bot>>

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

Edits current message caption. An alias for editMessageCaption

Parameters

ParameterType
captionNonNullable<string | { toString: string; }>
params?Partial<EditMessageCaptionParams>

Returns

Promise<true | MessageContext<Bot>>


editChecklist()

editChecklist(checklist, params?): Promise<MessageContext<Bot>>

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

Parameters

ParameterType
checklistTelegramInputChecklist
params?Partial<EditMessageChecklistParams>

Returns

Promise<MessageContext<Bot>>


editLiveLocation()

editLiveLocation(params): Promise<true | MessageContext<Bot>>

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

Edits current message live location. An alias for editMessageLiveLocation

Parameters

ParameterType
paramsEditMessageLiveLocationParams

Returns

Promise<true | MessageContext<Bot>>


editMedia()

editMedia(media, params?): Promise<true | MessageContext<Bot>>

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

Edits current message media. An alias for editMessageMedia

Parameters

ParameterType
mediaTelegramInputMedia
params?Partial<EditMessageMediaParams>

Returns

Promise<true | MessageContext<Bot>>


editMessageCaption()

editMessageCaption(caption, params?): Promise<true | MessageContext<Bot>>

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

Edits current message caption

Parameters

ParameterType
captionNonNullable<string | { toString: string; }>
params?Partial<EditMessageCaptionParams>

Returns

Promise<true | MessageContext<Bot>>


editMessageLiveLocation()

editMessageLiveLocation(params): Promise<true | MessageContext<Bot>>

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

Edits current message live location

Parameters

ParameterType
paramsEditMessageLiveLocationParams

Returns

Promise<true | MessageContext<Bot>>


editMessageMedia()

editMessageMedia(media, params?): Promise<true | MessageContext<Bot>>

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

Edits current message media

Parameters

ParameterType
mediaTelegramInputMedia
params?Partial<EditMessageMediaParams>

Returns

Promise<true | MessageContext<Bot>>


editMessageReplyMarkup()

editMessageReplyMarkup(replyMarkup, params?): Promise<true | MessageContext<Bot>>

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

Edits current message reply markup

Parameters

ParameterType
replyMarkupTelegramInlineKeyboardMarkup | { toJSON: TelegramInlineKeyboardMarkup; }
params?Partial<EditMessageReplyMarkupParams>

Returns

Promise<true | MessageContext<Bot>>


editMessageText()

editMessageText(text, params?): Promise<true | MessageContext<Bot>>

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

Edits current message text

Parameters

ParameterType
textstring | { toString: string; } | RichStringLike
params?Partial<EditMessageTextParams>

Returns

Promise<true | MessageContext<Bot>>


editReplyMarkup()

editReplyMarkup(replyMarkup, params?): Promise<true | MessageContext<Bot>>

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

Edits current message reply markup. An alias for editMessageReplyMarkup

Parameters

ParameterType
replyMarkupTelegramInlineKeyboardMarkup | { toJSON: TelegramInlineKeyboardMarkup; }
params?Partial<EditMessageReplyMarkupParams>

Returns

Promise<true | MessageContext<Bot>>


editText()

editText(text, params?): Promise<true | MessageContext<Bot>>

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

Edits current message text. An alias for editMessageText

Parameters

ParameterType
textstring | { toString: string; } | RichStringLike
params?Partial<EditMessageTextParams>

Returns

Promise<true | MessageContext<Bot>>


forward()

forward(params?): Promise<MessageContext<Bot>>

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

Forwards current message [into other chat if chatId is provided]

Parameters

ParameterType
params?Optional<ForwardMessageParams, "chat_id" | "message_id" | "from_chat_id">

Returns

Promise<MessageContext<Bot>>


forwardMessages()

forwardMessages(chatId, ids, params?): Promise<MessageId[]>

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

Forwards messages from current chat to another

Parameters

ParameterType
chatIdstring | number
idsnumber[]
params?Optional<ForwardMessagesParams, "chat_id" | "message_ids" | "from_chat_id">

Returns

Promise<MessageId[]>


getChatBoosts()

getChatBoosts(userId): Promise<TelegramUserChatBoosts>

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

Returns chat boosts by the user

Parameters

ParameterType
userIdnumber

Returns

Promise<TelegramUserChatBoosts>

Inherited from

SendMixin.getChatBoosts


is()

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

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

Type Parameters

Type Parameter
T extends UpdateName

Parameters

ParameterType
rawTypesMaybeArray<SoftString<T>>

Returns

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

Inherited from

Context.is


quoteWithAnimation()

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

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

Replies to current message with a quote and an animation

Parameters

ParameterType
paramsobject & object & Pick<SendAnimationParams, "caption" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "caption_entities" | "show_caption_above_media" | "has_spoiler" | "thumbnail" | "duration" | "width" | "height"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithAudio()

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

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

Replies to current message with a quote and an audio

Parameters

ParameterType
paramsobject & object & Pick<SendAudioParams, "caption" | "title" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "caption_entities" | "thumbnail" | "duration" | "performer"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithContact()

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

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

Replies to current message with a quote and a contact

Parameters

ParameterType
paramsobject & Pick<SendContactParams, "phone_number" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "first_name" | "last_name" | "vcard"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithDice()

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

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

Replies to current message with a quote and a dice

Parameters

ParameterType
paramsobject & object & Partial<SendDiceParams> & object

Returns

Promise<MessageContext<Bot>>


quoteWithDocument()

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

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

Replies to current message with a quote and a document

Parameters

ParameterType
paramsobject & object & Pick<SendDocumentParams, "caption" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "caption_entities" | "thumbnail" | "disable_content_type_detection"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithInvoice()

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

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

Replies to current message with a quote and an invoice

Parameters

ParameterType
paramsobject & Pick<SendInvoiceParams, "payload" | "currency" | "description" | "title" | "message_thread_id" | "direct_messages_topic_id" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "provider_token" | "prices" | "max_tip_amount" | "suggested_tip_amounts" | "start_parameter" | "provider_data" | "photo_url" | "photo_size" | "photo_width" | "photo_height" | "need_name" | "need_phone_number" | "need_email" | "need_shipping_address" | "send_phone_number_to_provider" | "send_email_to_provider" | "is_flexible"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithLocation()

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

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

Replies to current message with a quote and a location

Parameters

ParameterType
paramsobject & object & Pick<SendLocationParams, "heading" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "horizontal_accuracy" | "live_period" | "proximity_alert_radius"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithMediaGroup()

quoteWithMediaGroup(params): Promise<MessageContext<Bot>[]>

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

Replies to current message with a quote and a media group

Parameters

ParameterType
paramsobject & object & Pick<SendMediaGroupParams, "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "reply_parameters"> & object & object

Returns

Promise<MessageContext<Bot>[]>


quoteWithPhoto()

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

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

Replies to current message with a quote and a photo

Parameters

ParameterType
paramsobject & object & Pick<SendPhotoParams, "caption" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "caption_entities" | "show_caption_above_media" | "has_spoiler"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithPoll()

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

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

Replies to current message with a quote and a poll

Parameters

ParameterType
paramsobject & Pick<SendPollParams, "question" | "options" | "type" | "explanation" | "description" | "media" | "business_connection_id" | "message_thread_id" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "reply_parameters" | "reply_markup" | "question_parse_mode" | "question_entities" | "is_anonymous" | "allows_multiple_answers" | "allows_revoting" | "shuffle_options" | "allow_adding_options" | "hide_results_until_closes" | "members_only" | "country_codes" | "correct_option_ids" | "explanation_parse_mode" | "explanation_entities" | "explanation_media" | "open_period" | "close_date" | "is_closed" | "description_parse_mode" | "description_entities"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithSticker()

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

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

Replies to current message with a quote and a sticker

Parameters

ParameterType
paramsobject & object & Pick<SendStickerParams, "emoji" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithVenue()

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

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

Replies to current message with a quote and a venue

Parameters

ParameterType
paramsobject & Pick<SendVenueParams, "title" | "address" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "latitude" | "longitude" | "foursquare_id" | "foursquare_type" | "google_place_id" | "google_place_type"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithVideo()

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

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

Replies to current message with a quote and a video

Parameters

ParameterType
paramsobject & object & Pick<SendVideoParams, "caption" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "caption_entities" | "show_caption_above_media" | "has_spoiler" | "thumbnail" | "duration" | "width" | "height" | "cover" | "start_timestamp" | "supports_streaming"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithVideoNote()

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

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

Replies to current message with a quote and a video note

Parameters

ParameterType
paramsobject & object & Pick<SendVideoNoteParams, "length" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "thumbnail" | "duration"> & object & object

Returns

Promise<MessageContext<Bot>>


quoteWithVoice()

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

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

Replies to current message with a quote and a voice

Parameters

ParameterType
paramsobject & object & Pick<SendVoiceParams, "caption" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup" | "caption_entities" | "duration"> & object & object

Returns

Promise<MessageContext<Bot>>


react()

react(rawReactions, params?): Promise<true>

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

Reacts to a message

Parameters

ParameterType
rawReactionsMaybeArray<TelegramReactionTypeEmojiEmoji | TelegramReactionType>
params?Optional<SetMessageReactionParams, "chat_id" | "message_id">

Returns

Promise<true>


reply()

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

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

Replies to current message

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithAnimation()

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

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

Replies to current message with animation

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithAudio()

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

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

Replies to current message with audio

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithContact()

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

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

Replies to current message with contact

Parameters

ParameterType
paramsWithPartialReplyParameters<Optional<SendContactParams, "chat_id">>

Returns

Promise<MessageContext<Bot>>


replyWithDice()

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

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

Replies to current message with a dice

Parameters

ParameterType
emojiSendDiceEmoji
params?WithPartialReplyParameters<Partial<SendDiceParams>>

Returns

Promise<MessageContext<Bot>>


replyWithDocument()

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

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

Replies to current message with document

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithInvoice()

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

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

Replies to current message with invoice

Parameters

ParameterType
paramsWithPartialReplyParameters<Optional<SendInvoiceParams, "chat_id">>

Returns

Promise<MessageContext<Bot>>


replyWithLocation()

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

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

Replies to current message with location

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithMediaGroup()

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

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

Replies to current message with media group

Parameters

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

Returns

Promise<MessageContext<Bot>[]>


replyWithPhoto()

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

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

Replies to current message with photo

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithPoll()

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

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

Replies to current message with poll

Parameters

ParameterType
paramsWithPartialReplyParameters<Optional<SendPollParams, "chat_id">>

Returns

Promise<MessageContext<Bot>>


replyWithQuote()

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

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

Replies to current message with a quote

Parameters

ParameterType
paramsobject & object & Pick<SendMessageParams, "entities" | "business_connection_id" | "message_thread_id" | "direct_messages_topic_id" | "ephemeral_message_parameters" | "parse_mode" | "link_preview_options" | "disable_notification" | "protect_content" | "allow_paid_broadcast" | "message_effect_id" | "suggested_post_parameters" | "reply_parameters" | "reply_markup"> & object & object

Returns

Promise<MessageContext<Bot>>


replyWithSticker()

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

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

Replies to current message with sticker

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithVenue()

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

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

Replies to current message with venue

Parameters

ParameterType
paramsWithPartialReplyParameters<Optional<SendVenueParams, "chat_id">>

Returns

Promise<MessageContext<Bot>>


replyWithVideo()

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

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

Replies to current message with video

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithVideoNote()

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

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

Replies to current message with video note

Parameters

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

Returns

Promise<MessageContext<Bot>>


replyWithVoice()

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

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

Replies to current message with voice

Parameters

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

Returns

Promise<MessageContext<Bot>>


send()

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

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

Sends message to current chat.

Pass a branded @gramio/format rich value (Markdown RichString or a native structured block/message from @gramio/format/rich) and it is sent via sendRichMessage instead — bot.api.* stays 1:1; the method is chosen here.

Parameters

ParameterType
textstring | { toString: string; } | RichStringLike
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:5517

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:5513

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:5541

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:5533

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:5529

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:5543

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:5511

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:5525

Sends invoice to current user

Parameters

ParameterType
paramsOptional<SendInvoiceParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendInvoice


sendLivePhoto()

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

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

Sends live photo to current chat

Parameters

ParameterType
livePhotostring | Blob
photostring | Blob
params?Optional<SendLivePhotoParams, "photo" | "live_photo" | "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendLivePhoto


sendLocation()

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

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

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:5560

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:5547

Sends media group to current chat

Parameters

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

Returns

Promise<MessageContext<Bot>[]>

Inherited from

SendMixin.sendMediaGroup


sendMessageDraft()

sendMessageDraft(params): Promise<true>

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

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:5545

Sends paid media to current chat

Parameters

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

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendPaidMedia


sendPhoto()

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

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

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:5531

Sends poll to current chat

Parameters

ParameterType
paramsOptional<SendPollParams, "chat_id">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendPoll


sendRichMessage()

sendRichMessage(richMessage, params?): Promise<MessageContext<Bot>>

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

Sends rich message to current chat

Parameters

ParameterType
richMessageTelegramInputRichMessage
params?Optional<SendRichMessageParams, "chat_id" | "rich_message">

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendRichMessage


sendRichMessageDraft()

sendRichMessageDraft(richMessage, draftId, params?): Promise<true>

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

Streams a partial rich message draft to the current chat. The streamed draft is ephemeral and acts as a temporary 30-second preview — once the output is finalized, you must call sendRichMessage with the complete message to persist it.

Parameters

ParameterType
richMessageTelegramInputRichMessage
draftIdnumber
params?Optional<SendRichMessageDraftParams, "chat_id" | "rich_message" | "draft_id">

Returns

Promise<true>

Inherited from

SendMixin.sendRichMessageDraft


sendSticker()

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

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

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:5527

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:5515

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:5519

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:5521

Sends voice to current chat

Parameters

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

Returns

Promise<MessageContext<Bot>>

Inherited from

SendMixin.sendVoice


setReaction()

setReaction(reaction, params?): Promise<true>

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

Sets a reaction on a message

Parameters

ParameterType
reactionTelegramReactionTypeEmojiEmoji | TelegramReactionType
params?Optional<SetMessageReactionParams, "chat_id" | "message_id">

Returns

Promise<true>


setReactions()

setReactions(rawReactions, params?): Promise<true>

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

Sets multiple amount of reactions on a message

Parameters

ParameterType
rawReactions(TelegramReactionTypeEmojiEmoji | TelegramReactionType)[]
params?Optional<SetMessageReactionParams, "chat_id" | "message_id">

Returns

Promise<true>


stopLiveLocation()

stopLiveLocation(params?): Promise<true | MessageContext<Bot>>

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

Stops current message live location. An alias for stopMessageLiveLocation

Parameters

ParameterType
params?StopMessageLiveLocationParams

Returns

Promise<true | MessageContext<Bot>>


stopMessageLiveLocation()

stopMessageLiveLocation(params?): Promise<true | MessageContext<Bot>>

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

Stops current message live location

Parameters

ParameterType
params?StopMessageLiveLocationParams

Returns

Promise<true | MessageContext<Bot>>


stopPoll()

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

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

Stops poll in current chat

Parameters

ParameterType
messageIdnumber
params?Partial<StopPollParams>

Returns

Promise<Poll>

Inherited from

SendMixin.stopPoll


streamMessage()

Call Signature

streamMessage(options?): MessageDraft<Bot>

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

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

Two forms (mirroring SendMixin.streamRichMessage):

  • Iterable — pass an Iterable/AsyncIterable of MessageDraftPiece; it's drained and the array of sent messages is returned.
  • Handle — call with no iterable to get a MessageDraft: append() pieces and finalize(), or use await using to finalize on scope exit.

Both use sendMessageDraft for live previews and sendMessage to finalize each 4096-char segment.

Parameters
ParameterType
options?StreamMessageOptions
Returns

MessageDraft<Bot>

Example
ts
// iterable form
const messages = await context.streamMessage(llmStream);

// handle form (auto-finalize)
await using draft = context.streamMessage();
for await (const token of llm) draft.append(token);
Inherited from

SendMixin.streamMessage

Call Signature

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

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

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

Two forms (mirroring SendMixin.streamRichMessage):

  • Iterable — pass an Iterable/AsyncIterable of MessageDraftPiece; it's drained and the array of sent messages is returned.
  • Handle — call with no iterable to get a MessageDraft: append() pieces and finalize(), or use await using to finalize on scope exit.

Both use sendMessageDraft for live previews and sendMessage to finalize each 4096-char segment.

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

Promise<MessageContext<Bot>[]>

Example
ts
// iterable form
const messages = await context.streamMessage(llmStream);

// handle form (auto-finalize)
await using draft = context.streamMessage();
for await (const token of llm) draft.append(token);
Inherited from

SendMixin.streamMessage


streamRichMessage()

Call Signature

streamRichMessage(options?): RichMessageDraft<Bot>

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

Stream a rich message to the current chat, draft-first.

The hard part of sendRichMessageDraft is the contract: the draft is an ephemeral ~30-second preview, and you must finalize it with sendRichMessage or the message vanishes. This helper owns that lifecycle (throttled previews, a single finalize), so you can't forget it.

Two forms:

  • Handleconst draft = ctx.streamRichMessage(); draft.append(chunk); … await draft.finalize(). With await using, finalize runs automatically on scope exit.
  • Iterable — pass an (async) iterable of chunks; it's drained, finalized, and the sent message is returned.

A chunk is a @gramio/format RichString or a raw rich-markdown string.

Parameters
ParameterType
options?StreamRichMessageOptions
Returns

RichMessageDraft<Bot>

Example
ts
// handle form (auto-finalize)
await using draft = ctx.streamRichMessage();
for await (const token of llm) draft.append(rich`${token}`);

// iterable form
const message = await ctx.streamRichMessage(llmStream);
Inherited from

SendMixin.streamRichMessage

Call Signature

streamRichMessage(stream, options?): Promise<MessageContext<Bot>>

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

Stream a rich message to the current chat, draft-first.

The hard part of sendRichMessageDraft is the contract: the draft is an ephemeral ~30-second preview, and you must finalize it with sendRichMessage or the message vanishes. This helper owns that lifecycle (throttled previews, a single finalize), so you can't forget it.

Two forms:

  • Handleconst draft = ctx.streamRichMessage(); draft.append(chunk); … await draft.finalize(). With await using, finalize runs automatically on scope exit.
  • Iterable — pass an (async) iterable of chunks; it's drained, finalized, and the sent message is returned.

A chunk is a @gramio/format RichString or a raw rich-markdown string.

Parameters
ParameterType
streamIterable<RichChunk, any, any> | AsyncIterable<RichChunk, any, any>
options?StreamRichMessageOptions
Returns

Promise<MessageContext<Bot>>

Example
ts
// handle form (auto-finalize)
await using draft = ctx.streamRichMessage();
for await (const token of llm) draft.append(rich`${token}`);

// iterable form
const message = await ctx.streamRichMessage(llmStream);
Inherited from

SendMixin.streamRichMessage