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

x/grm/src/mod.ts>client.TelegramClient

MTProto API Client for Deno 🦕
Go to Latest
class client.TelegramClient
import { client } from "https://deno.land/x/grm@0.5.2/src/mod.ts";
const { TelegramClient } = client;

Constructors

new
TelegramClient(
session: string | Session,
apiId: number,
apiHash: string,
clientParams?: TelegramClientParams,
)

Properties

readonly
parseMode

Methods

_getInputDialog(peer: any): Promise<any>
_getInputNotify(notify: any): Promise<any>
_getResponseMessage(
req: any,
result: any,
inputChat: any,
):
| Map<number, Api.Message>
| (Api.Message | undefined)[]
| undefined
_removeSender(dcId: number)
_switchDC(newDc: number)
addEventHandler(callback: { (event: NewMessageEvent): void; }, event: NewMessage): void
addEventHandler(callback: { (event: CallbackQueryEvent): void; }, event: CallbackQuery): void
addEventHandler(callback: { (event: AlbumEvent): void; }, event: Album): void
addEventHandler(callback: { (event: EditedMessageEvent): void; }, event: EditedMessage): void
addEventHandler(callback: { (event: DeletedMessageEvent): void; }, event: DeletedMessage): void
addEventHandler(callback: { (event: any): void; }, event?: EventBuilder): void
buildReplyMarkup(buttons: , inlineOnly?)
checkAuthorization(): Promise<boolean>
deleteMessages(
entity: Api.TypeEntityLike | undefined,
messageIds: Api.TypeMessageIDLike[],
unnamed 2,
): Promise<Api.messages.AffectedMessages[]>
downloadFile(inputLocation: Api.TypeInputFileLocation, fileParams?: types.DownloadFileParamsV2): Promise<string | Buffer | undefined>
downloadMedia(messageOrMedia: Api.Message | Api.TypeMessageMedia, downloadParams?: types.DownloadMediaInterface): Promise<Buffer | string | undefined> | Buffer
downloadProfilePhoto(entity: Api.TypeEntityLike, downloadProfilePhotoParams?: types.DownloadProfilePhotoParams): Promise<
| string
| undefined
>
editMessage(entity: Api.TypeEntityLike, editMessageParams: types.EditMessageParams): Promise<Api.Message>
forwardMessages(entity: Api.TypeEntityLike, forwardMessagesParams: types.ForwardMessagesParams): Promise<Api.Message[]>
getDC(
dcId: number,
downloadDC?,
web?,
): Promise<{ id: number; ipAddress: string; port: number; }>
getDialogs(params?: types.IterDialogsParams): Promise<TotalList<Dialog>>
getEntity(entity: Api.TypeEntityLike): Promise<Api.TypeEntity>
getEntity(entity: Api.TypeEntityLike[]): Promise<Api.TypeEntity[]>
getMe(inputPeer?): Promise<Api.InputPeerUser | Api.User>
getMessages(entity: Api.TypeEntityLike | undefined, getMessagesParams?: Partial<types.IterMessagesParams>): Promise<TotalList<Api.Message>>
getParticipants(entity: Api.TypeEntityLike, params?: types.IterParticipantsParams): Promise<TotalList<Api.User>>
getPeerId(peer: Api.TypeEntityLike, addMark?): Promise<string>
inlineQuery(
query: string,
offset?: string,
): Promise<InlineResults>
invoke<R extends Api.AnyRequest>(request: R, sender?: MTProtoSender): Promise<R["__response"]>
isBot(): Promise<boolean | undefined>
isUserAuthorized(): Promise<boolean>
iterDialogs(iterDialogsParams?: types.IterDialogsParams): AsyncIterable<Dialog>
iterDownload(iterFileParams: types.IterDownloadFunction): downloadMethods.DirectDownloadIter
iterMessages(entity: Api.TypeEntityLike | undefined, iterParams?: Partial<types.IterMessagesParams>): AsyncIterable<Api.Message>
iterParticipants(entity: Api.TypeEntityLike, params?: types.IterParticipantsParams): AsyncIterable<Api.User>
listEventHandlers(): [EventBuilder, CallableFunction][]
markAsRead(
message?: Api.TypeMessageIDLike | Api.TypeMessageIDLike[],
markAsReadParams?: types.MarkAsReadParams,
): Promise<boolean>
on(event: any)
pinMessage(
message?: undefined,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<Api.messages.AffectedHistory>
pinMessage(
message: Api.TypeMessageIDLike,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<Api.Message>
removeEventHandler(callback: CallableFunction, event: EventBuilder)
sendCode(
apiCredentials: types.ApiCredentials,
phoneNumber: string,
forceSMS?,
): Promise<{ phoneCodeHash: string; isCodeViaApp: boolean; }>
sendFile(entity: Api.TypeEntityLike, sendFileParams: types.SendFileInterface): Promise<Api.Message>
sendMessage(entity: Api.TypeEntityLike, sendMessageParams?: types.SendMessageParams): Promise<Api.Message>
setParseMode(mode:
| "md"
| "markdown"
| "html"
| types.ParseInterface
| undefined
)
signInBot(apiCredentials: types.ApiCredentials, authParams: types.BotAuthParams): Promise<Api.TypeUser>
signInUser(apiCredentials: types.ApiCredentials, authParams: types.UserAuthParams): Promise<Api.TypeUser>
signInUserWithQrCode(apiCredentials: types.ApiCredentials, authParams: types.QrCodeAuthParams): Promise<Api.TypeUser>
signInWithPassword(apiCredentials: types.ApiCredentials, authParams: types.UserPasswordAuthParams): Promise<Api.TypeUser>
start(authParams?: types.UserAuthParams | types.BotAuthParams): Promise<void>
unpinMessage(
message?: undefined,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<Api.messages.AffectedHistory>
unpinMessage(
message: Api.TypeMessageIDLike,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<undefined>
updateTwoFaSettings(unnamed 0: types.TwoFaParams): Promise<void>
uploadFile(fileParams: types.UploadFileParams): Promise<Api.InputFile | Api.InputFileBig>

Static Properties

readonly
events