Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/mtkruto/client/4_client.ts>Context

Cross-runtime JavaScript library for building Telegram clients
Go to Latest
interface Context
import { type Context } from "https://deno.land/x/mtkruto@0.1.141/client/4_client.ts";

Properties

client: Client

The client that received the update.

optional
me: User

The currently authorized user.

optional
msg: Message

Resolves to message, editedMessage, or the message field of callbackQuery.

optional
chat: ChatP

Resolves to msg?.chat. TODO

optional
from: User

Resolves to the from field of message, editedMessage, callbackQuery, or inlineQuery.

optional
senderChat: ChatP

Resolves to msg?.senderChat.

reply: (text: string, params?: Omit<SendMessageParams, "replyToMessageId"> & ReplyParams) => Promise<MessageText>

Reply the received message with a text message.

replyPoll: (
question: string,
options: [string, string, ...string[]],
params?: Omit<SendPollParams, "replyToMessageId"> & ReplyParams,
) => Promise<MessagePoll>

Reply the received message with a poll.

replyPhoto: (photo: FileSource, params?: Omit<SendPhotoParams, "replyToMessageId"> & ReplyParams) => Promise<MessagePhoto>

Reply the received message with a photo.

replyDocument: (document: FileSource, params?: Omit<SendDocumentParams, "replyToMessageId"> & ReplyParams) => Promise<MessageDocument>

Reply the received message with a document.

replyLocation: (
latitude: number,
longitude: number,
params?: Omit<SendLocationParams, "replyToMessageId"> & ReplyParams,
) => Promise<MessageLocation>

Reply the received message with a location.

replyDice: (params?: Omit<SendDiceParams, "replyToMessageId"> & ReplyParams) => Promise<MessageDice>

Reply the received message with a dice.

replyVenue: (
latitude: number,
longitude: number,
title: string,
address: string,
params?: Omit<SendVenueParams, "replyToMessageId"> & ReplyParams,
) => Promise<MessageVenue>

Reply the received message with a venue.

replyContact: (
firstName: string,
number: string,
params?: Omit<SendContactParams, "replyToMessageId"> & ReplyParams,
) => Promise<MessageContact>

Reply the received message with a contact.

replyVideo: (video: FileSource, params?: Omit<SendVideoParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVideo>

Reply the received message with a video.

replyAnimation: (animation: FileSource, params?: Omit<SendAnimationParams, "replyToMessageId"> & ReplyParams) => Promise<MessageAnimation>

Reply the received message with an animation.

replyVoice: (voice: FileSource, params?: Omit<SendVoiceParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVoice>

Reply the received message with a voice message.

replyAudio: (audio: FileSource, params?: Omit<SendAudioParams, "replyToMessageId"> & ReplyParams) => Promise<MessageAudio>

Reply the received message with an audio file.

replyVideoNote: (videoNote: FileSource, params?: Omit<SendVideoNoteParams, "replyToMessageId"> & ReplyParams) => Promise<MessageVideoNote>

Reply the received message with a video note.

delete: () => Promise<void>

Delete the received message.

forward: (to: ID, params?: ForwardMessagesParams) => Promise<this["msg"]>

Forward the received message.

pin: (params?: PinMessageParams) => Promise<void>

Pin the received message.

unpin: (params?: PinMessageParams) => Promise<void>

Unpin the received message.

banSender: (params?: BanChatMemberParams) => Promise<void>

Ban the sender of the received message.

kickSender: () => Promise<void>

Kick the sender of the received message.

setSenderRights: (params?: SetChatMemberRightsParams) => Promise<void>

Set the rights of the received message.

react: (reactions: Reaction[], params?: SetReactionsParams) => Promise<void>

Change the reactions made to the received message.

sendChatAction: (action: ChatAction, params?: { messageThreadId?: number; }) => Promise<void>

Send a chat action to the chat which the message was received from.

editMessageText: (
messageId: number,
text: string,
) => Promise<MessageText>

Edit a message in the chat which the message was received from.

editMessageReplyMarkup: (messageId: number, params?: EditMessageReplyMarkupParams) => Promise<Message>

Edit the reply markup of a message in the chat which the message was received from.

answerCallbackQuery: (params?: AnswerCallbackQueryParams) => Promise<void>

Answer the received callback query.

answerInlineQuery: (results: InlineQueryResult[], params?: AnswerInlineQueryParams) => Promise<void>

Answer the received inline query.

getMessage: (messageId: number) => Promise<Message | null>

Retrieve a single message of the chat which the message was received from.

getMessages: (messageIds: number[]) => Promise<Message[]>

Retrieve multiple messages of the chat which the message was received from.

forwardMessage: (
to: ID,
messageId: number,
) => Promise<Message>

Forward a message of the chat which the message was received from.

forwardMessages: (
to: ID,
messageIds: number[],
) => Promise<Message[]>

Forward multiple messages of the chat which the message was received from.

deleteMessage: (messageId: number, params?: DeleteMessagesParams) => Promise<void>

Delete a message in the chat which the message was received from.

deleteMessages: (messageIds: number[], params?: DeleteMessagesParams) => Promise<void>

Delete multiple messages in the chat which the message was received from.

pinMessage: (messageId: number, params?: PinMessageParams) => Promise<void>

Pin a message in the chat which the message was received from.

unpinMessage: (messageId: number) => Promise<void>

Unpin a message in the chat which the message was received from.

unpinMessages: (messageId: number) => Promise<void>

Unpin the pinned messages in the chat which the message was received from.

setAvailableReactions: (availableReactions: "none" | "all" | Reaction[]) => Promise<void>

Set the available reactions of the chat which the message was received from.

addReaction: (
messageId: number,
reaction: Reaction,
) => Promise<void>

Add a reaction to a message of the chat which the message was received from.

removeReaction: (messageId: number, reaction: Reaction) => Promise<void>

Remove a reaction from a message of the chat which the message was received from.

setReactions: (
messageId: number,
reactions: Reaction[],
) => Promise<void>

Change the reactions made to a message of the chat which the message was received from.

setChatPhoto: (photo: FileSource, params?: SetChatPhotoParams) => Promise<void>

Set the photo of the chat which the message was received from.

deleteChatPhoto: () => Promise<void>

Delete the photo of the chat which the message was received from.

banChatMember: (memberId: ID, params?: BanChatMemberParams) => Promise<void>

Ban a member from the chat which the message was received from.

unbanChatMember: (memberId: ID) => Promise<void>

Unban a member from the chat which the message was received from.

kickChatMember: (memberId: ID) => Promise<void>

Kick a member from the chat which the message was received from.

setChatMemberRights: (memberId: ID, params?: SetChatMemberRightsParams) => Promise<void>

Set the rights of a member of the chat which the message was received from.

deleteChatMemberMessages: (userId: ID) => Promise<void>
toJSON: () => Update