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

x/grm/src/mod.ts>TelegramClient

MTProto API Client for Deno 🦕
Go to Latest
class TelegramClient
implements AbstractTelegramClient
extends TelegramBaseClient
import { TelegramClient } from "https://deno.land/x/grm@0.8.0/src/mod.ts";

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,
):
| CustomMessage
| Api.TypeMessage
| Map<number, CustomMessage>
| (CustomMessage | 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:
| Api.TypeReplyMarkup
| undefined
| Api.TypeButtonLike
| Api.TypeButtonLike[]
| Api.TypeButtonLike[][]
, 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: CustomMessage | Api.Message | Api.TypeMessageMedia, downloadParams?: types.DownloadMediaInterface): Promise<Buffer | string | undefined> | Buffer
downloadProfilePhoto(entity: Api.TypeEntityLike, downloadProfilePhotoParams?: types.DownloadProfilePhotoParams): Promise<
| string
| Buffer
| Buffer
| 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[]>
getInputEntity(entity: Api.TypeEntityLike): Promise<Api.TypeInputPeer>
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(
bot: Api.TypeEntityLike,
query: string,
entity?: Api.InputPeerSelf,
offset?: string,
geoPoint?: Api.TypeInputGeoPoint,
): 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(
entity: Api.TypeEntityLike,
message?: Api.TypeMessageIDLike | Api.TypeMessageIDLike[],
markAsReadParams?: types.MarkAsReadParams,
): Promise<boolean>
on(event: any)
pinMessage(
entity: Api.TypeEntityLike,
message?: undefined,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<Api.messages.AffectedHistory>
pinMessage(
entity: Api.TypeEntityLike,
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<CustomMessage>
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(
entity: Api.TypeEntityLike,
message?: undefined,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<Api.messages.AffectedHistory>
unpinMessage(
entity: Api.TypeEntityLike,
message: Api.TypeMessageIDLike,
pinMessageParams?: types.UpdatePinMessageParams,
): Promise<undefined>
updateTwoFaSettings(unnamed 0: types.TwoFaParams): Promise<void>
uploadFile(fileParams: types.UploadFileParams): Promise<Api.InputFile | Api.InputFileBig>