GramIO API Reference / @gramio/contexts/dist / ChatJoinRequestContext
Class: ChatJoinRequestContext<Bot>
Defined in: contexts/index.d.ts:5575
Represents a join request sent to a chat.
Extends
Context<Bot>.Constructor<ChatJoinRequestContext<Bot>>.ChatJoinRequest.TargetMixin.SendMixin<Bot>.ChatActionMixin<Bot>.ChatInviteControlMixin<Bot>.CloneMixin<Bot,ChatJoinRequestContext<Bot>,ChatJoinRequestContextOptions<Bot>>
Type Parameters
| Type Parameter |
|---|
Bot extends BotLike |
Constructors
Constructor
new ChatJoinRequestContext<
Bot>(options):ChatJoinRequestContext<Bot>
Defined in: contexts/index.d.ts:5578
Parameters
| Parameter | Type |
|---|---|
options | ChatJoinRequestContextOptions<Bot> |
Returns
ChatJoinRequestContext<Bot>
Overrides
Constructor
new ChatJoinRequestContext(...
args):ChatJoinRequestContext
Defined in: contexts/index.d.ts:5575
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
ChatJoinRequestContext
Overrides
Context<Bot>.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
bot | public | Bot | - | Context.bot | contexts/index.d.ts:4856 |
isTopicMessage | public | () => boolean | - | SendMixin.isTopicMessage | contexts/index.d.ts:4993 |
payload | public | TelegramChatJoinRequest | The raw data that is used for this Context | ChatJoinRequest.payload | contexts/index.d.ts:5577 |
update? | public | TelegramUpdate | - | Context.update | contexts/index.d.ts:4858 |
updateId? | public | number | - | Context.updateId | contexts/index.d.ts:4857 |
updateType | protected | UpdateName | - | Context.updateType | contexts/index.d.ts:4859 |
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: contexts/index.d.ts:4862
Returns
string
Inherited from
bio
Get Signature
get bio():
string
Defined in: contexts/index.d.ts:3885
Bio of the user
Returns
string
Inherited from
businessConnectionId
Get Signature
get businessConnectionId():
string
Defined in: contexts/index.d.ts:4895
Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
Returns
string
Inherited from
TargetMixin.businessConnectionId
chat
Get Signature
get chat():
Chat
Defined in: contexts/index.d.ts:3877
Chat to which the request was sent
Returns
Inherited from
chatId
Get Signature
get chatId():
number
Defined in: contexts/index.d.ts:4893
Chat ID
Returns
number
Inherited from
chatType
Get Signature
get chatType():
TelegramChatType
Defined in: contexts/index.d.ts:4897
Chat type
Returns
Inherited from
date
Get Signature
get date():
number
Defined in: contexts/index.d.ts:3883
Date the request was sent in Unix time
Returns
number
Inherited from
from
Get Signature
get from():
User
Defined in: contexts/index.d.ts:3879
User that sent the join request
Returns
Inherited from
inviteLink
Get Signature
get inviteLink():
ChatInviteLink
Defined in: contexts/index.d.ts:3887
Chat invite link that was used by the user to send the join request
Returns
Inherited from
senderBoostCount
Get Signature
get senderBoostCount():
number
Defined in: contexts/index.d.ts:4887
Optional. If the sender of the message boosted the chat, the number of boosts added by the user
Returns
number
Inherited from
senderChat
Get Signature
get senderChat():
Chat
Defined in: contexts/index.d.ts:4883
Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded to the discussion group
Returns
Inherited from
senderId
Get Signature
get senderId():
number
Defined in: contexts/index.d.ts:4891
Sender's ID
Returns
number
Inherited from
threadId
Get Signature
get threadId():
number
Defined in: contexts/index.d.ts:4992
Returns
number
Inherited from
userChatId
Get Signature
get userChatId():
number
Defined in: contexts/index.d.ts:3881
Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.
Returns
number
Inherited from
Methods
approve()
approve():
Promise<true>
Defined in: contexts/index.d.ts:5580
Approves chat join request
Returns
Promise<true>
clone()
clone(
options?):ChatJoinRequestContext
Defined in: contexts/index.d.ts:5407
Parameters
| Parameter | Type |
|---|---|
options? | ChatJoinRequestContextOptions |
Returns
ChatJoinRequestContext
Inherited from
createActionController()
createActionController(
action,params?):ChatActionController<Bot>
Defined in: contexts/index.d.ts:5396
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
createInviteLink()
createInviteLink(
params?):Promise<TelegramChatInviteLink>
Defined in: contexts/index.d.ts:5250
Creates an additional invite link
Parameters
| Parameter | Type |
|---|---|
params? | Optional<CreateChatInviteLinkParams, "chat_id"> |
Returns
Promise<TelegramChatInviteLink>
Inherited from
ChatInviteControlMixin.createInviteLink
decline()
decline():
Promise<true>
Defined in: contexts/index.d.ts:5582
Declines chat join request
Returns
Promise<true>
editInviteLink()
editInviteLink(
link,params?):Promise<TelegramChatInviteLink>
Defined in: contexts/index.d.ts:5252
Edits non-primary invite link created by the bot
Parameters
| Parameter | Type |
|---|---|
link | string |
params? | Optional<EditChatInviteLinkParams, "chat_id" | "invite_link"> |
Returns
Promise<TelegramChatInviteLink>
Inherited from
ChatInviteControlMixin.editInviteLink
exportInviteLink()
exportInviteLink(
params?):Promise<string>
Defined in: contexts/index.d.ts:5248
Generates new primary invite link
Parameters
| Parameter | Type |
|---|---|
params? | Optional<ExportChatInviteLinkParams, "chat_id"> |
Returns
Promise<string>
Inherited from
ChatInviteControlMixin.exportInviteLink
getChatBoosts()
getChatBoosts(
userId):Promise<TelegramUserChatBoosts>
Defined in: contexts/index.d.ts:5068
Returns chat boosts by the user
Parameters
| Parameter | Type |
|---|---|
userId | number |
Returns
Promise<TelegramUserChatBoosts>
Inherited from
hasFrom()
hasFrom(): this is Require<ChatJoinRequestContext<Bot>, "from" | "senderId">
Defined in: contexts/index.d.ts:4872
Checks if the instance has from and senderId properties
Returns
this is Require<ChatJoinRequestContext<Bot>, "from" | "senderId">
Inherited from
hasSenderChat()
hasSenderChat():
this is Require<ChatJoinRequestContext<Bot>, "senderChat">
Defined in: contexts/index.d.ts:4876
Checks if the instance has senderChat property
Returns
this is Require<ChatJoinRequestContext<Bot>, "senderChat">
Inherited from
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:4865
Type Parameters
| Type Parameter |
|---|
T extends UpdateName |
Parameters
| Parameter | Type |
|---|---|
rawTypes | MaybeArray<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
isChannel()
isChannel():
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Channel>
Defined in: contexts/index.d.ts:4905
Is this chat a channel?
Returns
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Channel>
Inherited from
isGroup()
isGroup():
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Group>
Defined in: contexts/index.d.ts:4901
Is this chat a group?
Returns
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Group>
Inherited from
isPM()
isPM():
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Private>
Defined in: contexts/index.d.ts:4899
Is this chat a private one?
Returns
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Private>
Inherited from
isSupergroup()
isSupergroup():
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Supergroup>
Defined in: contexts/index.d.ts:4903
Is this chat a supergroup?
Returns
this is RequireValue<ChatJoinRequestContext<Bot>, "chatType", Supergroup>
Inherited from
revokeInviteLink()
revokeInviteLink(
link,params?):Promise<TelegramChatInviteLink>
Defined in: contexts/index.d.ts:5254
Revokes an invite link generated by a bot
Parameters
| Parameter | Type |
|---|---|
link | string |
params? | Optional<RevokeChatInviteLinkParams, "chat_id" | "invite_link"> |
Returns
Promise<TelegramChatInviteLink>
Inherited from
ChatInviteControlMixin.revokeInviteLink
send()
send(
text,params?):Promise<MessageContext<Bot>>
Defined in: contexts/index.d.ts:4998
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:5008
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:5004
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:5032
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:5024
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:5020
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:5034
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:5002
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:5016
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:5014
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:5051
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:5038
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:5030
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:5036
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:5000
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:5022
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:5026
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:5018
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:5006
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:5010
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:5012
Sends voice to current chat
Parameters
| Parameter | Type |
|---|---|
voice | string | Blob |
params? | Optional<SendVoiceParams, "voice" | "chat_id"> |
Returns
Promise<MessageContext<Bot>>
Inherited from
stopPoll()
stopPoll(
messageId,params?):Promise<Poll>
Defined in: contexts/index.d.ts:5028
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:5066
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);