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

x/mtkruto/3_storage.ts>Storage

Cross-runtime JavaScript library for building Telegram clients
Go to Latest
class Storage
Re-export
Abstract
import { Storage } from "https://deno.land/x/mtkruto@0.1.157/3_storage.ts";

Properties

readonly
authKeyId: bigint | null
readonly
isMemoryStorage: boolean
abstract
readonly
supportsFiles: boolean

Methods

assertBot(source: string)
assertUser(source: string)
abstract
branch(id: string): Storage
exportAuthString(): Promise<string>
abstract
get<T>(key: readonly StorageKeyPart[]): MaybePromise<T | null>
getAccountType(): Promise<"user" | "bot" | null>
getAuthKey(): Promise<Uint8Array | 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<[types.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[], enums.Update] | null>
getHistory(
chatId: number,
offsetId: number,
limit: number,
): Promise<enums.Message[]>
getLastMessage(chatId: number): Promise<enums.Message | null>
abstract
getMany<T>(prefix: GetManyFilter, params?: { limit?: number; reverse?: boolean; }): MaybePromise<Generator<[readonly StorageKeyPart[], T]> | AsyncGenerator<[readonly StorageKeyPart[], T]>>
getMessage(chatId: number, messageId: number): Promise<enums.Message | null>
getMessageChat(messageId: number): MaybePromise<number | null>
getPinnedChats(listId: number): Promise<number[] | null>
getServerSalt(): MaybePromise<bigint | null>
getState(): Promise<enums.updates.State | null>
getStickerSetName(id: bigint, accessHash: bigint): MaybePromise<[string, Date] | null>
getTlObject(keyOrBuffer: TLObject | 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)
abstract
incr(key: readonly StorageKeyPart[], by: number): MaybePromise<void>
abstract
initialize(): MaybePromise<void>
iterFileParts(
id: bigint,
partCount: number,
offset: number,
): AsyncGenerator<Uint8Array>
removeChats(listId: number)
saveFilePart(
id: bigint,
index: number,
bytes: Uint8Array,
)
abstract
set(key: readonly StorageKeyPart[], value: unknown): MaybePromise<void>
setAccountType(type: "user" | "bot")
setAuthKey(authKey: Uint8Array | null)
setChannelPts(channelId: bigint, pts: number)
setChat(
listId: number,
chatId: number,
pinned: number,
topMessageId: number,
topMessageDate: Date,
)
setCustomEmojiDocument(id: bigint, document: types.Document)
setDc(dc: DC | null)
setFilePartCount(
id: bigint,
partCount: number,
chunkSize: number,
)
setHasAllChats(listId: number, hasAllChats: boolean)
setMessage(
chatId: number,
messageId: number,
message: enums.Message | null,
)
setPinnedChats(listId: number, chatIds: number[] | null)
setServerSalt(serverSalt: bigint)
setState(state: enums.updates.State)
setTlObject(key: readonly StorageKeyPart[], value: TLObject | null)
setUpdate(boxId: bigint, update: enums.Update)
updateStickerSetName(
id: bigint,
accessHash: bigint,
name: string,
)
updateUsernames(id: number, usernames: string[])