Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/mtkruto/client/0_storage_operations.ts>StorageOperations

Cross-runtime JavaScript library for building Telegram clients
Latest
class StorageOperations
import { StorageOperations } from "https://deno.land/x/mtkruto@0.2.24/client/0_storage_operations.ts";

Constructors

new
StorageOperations(storage: Storage)

Properties

readonly
authKeyId: bigint | null
readonly
provider: Storage
readonly
supportsFiles: boolean

Methods

assertBot(source: string)
assertUser(source: string)
exportAuthString(apiId_?: number | null): Promise<string>
get<T>(...args: Parameters<Storage["get"]>): ReturnType<Storage["get"]>
getAccountId(): Promise<number | null>
getAccountType(): Promise<"user" | "bot" | null>
getApiId(): Promise<number | null>
getAuthKey(): Promise<Uint8Array | null>
getBusinessConnection(id: string): Promise<Api.botBusinessConnection | null>
getCallbackQueryAnswer(
chatId: number,
messageId: number,
question: string,
): Promise<[Api.messages_botCallbackAnswer, Date] | null>
getChannelAccessHash(id: number): Promise<bigint | null>
getChannelPts(channelId: bigint): MaybePromise<number | null>
getChats(listId: number): Promise<{ chatId: number; pinned: number; topMessageId: number; topMessageDate: Date; }[]>
getCustomEmojiDocument(id: bigint): Promise<[Api.document, Date] | null>
getDc(): MaybePromise<DC | null>
getEntity(key: number): Promise<ReadObject | null>
getFile(id: bigint): Promise<[number, number] | null>
getFirstUpdate(boxId: bigint): Promise<[readonly StorageKeyPart[], Api.Update] | null>
getFullChat(chatId: number): Promise<
| Api.userFull
| Api.channelFull
| Api.chatFull
| null
>
getGroupCall(id: bigint): Promise<Api.groupCall | null>
getGroupCallAccessHash(id: bigint): Promise<bigint | null>
getHistory(
chatId: number,
offsetId: number,
limit: number,
): Promise<Api.Message[]>
getInlineQueryAnswer(
userId: number,
chatId: number,
query: string,
offset: string,
): Promise<[Api.messages_botResults, Date] | null>
getLastMessage(chatId: number): Promise<Api.Message | null>
getMany<T>(...args: Parameters<Storage["getMany"]>): ReturnType<Storage["getMany"]>
getMessage(chatId: number, messageId: number): Promise<Api.Message | null>
getMessageChat(messageId: number): MaybePromise<number | null>
getPinnedChats(listId: number): Promise<number[] | null>
getServerSalt(): MaybePromise<bigint | null>
getState(): Promise<Api.updates_State | null>
getStickerSetName(id: bigint, accessHash: bigint): MaybePromise<[string, Date] | null>
getTlObject(keyOrBuffer: Api.AnyType | Uint8Array | readonly StorageKeyPart[]): Promise<ReadObject | null>
getUserAccessHash(id: number): Promise<bigint | null>
getUsername(username: string): Promise<[number, Date] | null>
hasAllChats(listId: number): Promise<boolean>
importAuthString(string: string)
incr(...args: Parameters<Storage["incr"]>): ReturnType<Storage["incr"]>
iterFileParts(
id: bigint,
partCount: number,
offset: number,
): AsyncGenerator<Uint8Array>
removeChats(listId: number)
saveFilePart(
id: bigint,
index: number,
bytes: Uint8Array,
)
set(...args: Parameters<Storage["set"]>): ReturnType<Storage["set"]>
setAccountId(accountId: number)
setAccountType(type: "user" | "bot")
setApiId(apiId: number)
setAuthKey(authKey: Uint8Array | null)
setBusinessConnection(id: string, connection: Api.botBusinessConnection | null)
setCallbackQueryAnswer(
chatId: number,
messageId: number,
question: string,
answer: Api.messages_botCallbackAnswer,
)
setChannelPts(channelId: bigint, pts: number)
setChat(
listId: number,
chatId: number,
pinned: number,
topMessageId: number,
topMessageDate: Date,
)
setCustomEmojiDocument(id: bigint, document: Api.document)
setDc(dc: DC | null)
setFilePartCount(
id: bigint,
partCount: number,
chunkSize: number,
)
setFullChat(chatId: number, fullChat:
| Api.userFull
| Api.channelFull
| Api.chatFull
| null
)
setGroupCall(id: bigint, groupCall: Api.groupCall | null)
setGroupCallAccessHash(id: bigint, accessHash: bigint | null)
setHasAllChats(listId: number, hasAllChats: boolean)
setInlineQueryAnswer(
userId: number,
chatId: number,
query: string,
offset: string,
results: Api.messages_botResults,
date: Date,
)
setMessage(
chatId: number,
messageId: number,
message: Api.Message | null,
)
setPinnedChats(listId: number, chatIds: number[] | null)
setServerSalt(serverSalt: bigint)
setState(state: Api.updates_State)
setTlObject(key: readonly StorageKeyPart[], value: Api.AnyType | null)
setUpdate(boxId: bigint, update: Api.Update)
updateStickerSetName(
id: bigint,
accessHash: bigint,
name: string,
)
updateUsernames(id: number, usernames: string[])