UNPKG

@tgsnake/fileid

Version:

core framework for tgsnake for generating file id

124 lines 4.15 kB
/// <reference types="node" /> /** * tgsnake - Telegram MTProto framework for nodejs. * Copyright (C) 2022 butthx <https://github.com/butthx> * * THIS FILE IS PART OF TGSNAKE * * tgsnake is a free software : you can redistribute it and/or modify * it under the terms of the MIT License as published. */ import { FileType, ThumbnailSource, FileTypeUniqueId, Options } from './index.js'; import { Buffer } from 'node:buffer'; export declare class Decode implements Options { /** * The major version of bot api file id. Usually is 4. */ version: number; /** * The minor version of bot api file id. Usually same with tdlib version or 32. */ subVersion: number; /** * The data center id, where that file is stored. */ dcId: number; /** * The enum/number of FileType. recommend to use enum. * ```ts * import { FileType, FileId } from "@tgsnake/fileid" * const fileId = FileId.encode({ * fileType : FileType.PHOTO * }) * ``` */ fileType: FileType; /** * The id of file. */ id: bigint; /** * The hash to access that file. */ accessHash: bigint; /** * File reference of that file. */ fileReference?: Buffer; /** * If the file has web location, fill this with url of that web location. */ url?: string; /** * If the file has volume id, fill this with it. or if file doesn't have a volume id, fill this with BigInt(0). This is required when you try to make file id of photo/thumbnail. */ volumeId?: bigint; /** * If the file has local id, fill this with it. or if file doesn't have a local id, fill this with 0. This is required when you try to make file id of photo/thumbnail. */ localId?: number; /** * The secret key from file, if file doesn't have a secret key fill this with BigInt(0). This is required when you try to make ThumbnailSource.LEGACY */ secret?: bigint; /** * If you want to make a file id of photo profil, fill this with BigInt of chatId. */ chatId?: bigint; /** * If you want to make a file id of photo profil, fill this with BigInt of accessHash that chat, or BigInt(0) it must be work when you doesn't have a accessHash of that chat. */ chatAccessHash?: bigint; /** * The id of that sticker set. */ stickerSetId?: bigint; /** * The accessHash of that sticker set. BigInt(0) ot must be work when you doesn't have a accessHash of that sticker set. */ stickerSetAccessHash?: bigint; /** * The enum/number of ThumbnailSource. recommended to use enum. * ```ts * import { FileId, ThumbnailSource } from "@tgsnake/fileid" * const fileId = FileId.encode({ * thumbnailSource : ThumbnailSource.DOCUMENT * }) * ``` */ thumbnailSource?: ThumbnailSource; /** * The enum/number of FileType. recommend to use enum. * ```ts * import { FileType, FileId } from "@tgsnake/fileid" * const fileId = FileId.encode({ * thumbnailFileType : FileType.PHOTO * }) * ``` */ thumbnailFileType?: FileType; /** * The size of that thumbnail. * see : https://core.telegram.org/api/files#image-thumbnail-types */ thumbnailSize?: string; /** * Only for generating uniqueFileId. * The enum/number of FileTypeUniqueId. recommended to use enum. * ```ts * import { FileTypeUniqueId, FileId } from "@tgsnake/fileid" * const fileId = FileId.encode({ * fileType : FileTypeUniqueId.PHOTO * }) * ``` */ fileTypeUniqueId?: FileTypeUniqueId; constructor({ version, subVersion, dcId, fileType, id, accessHash, fileReference, url, volumeId, localId, secret, chatId, chatAccessHash, stickerSetId, stickerSetAccessHash, thumbnailSource, thumbnailFileType, thumbnailSize, fileTypeUniqueId, }: Options); static fileId(fileId: string): Decode; static uniqueId(uniqueId: string): Decode; toJSON(): { [key: string]: any; }; toString(): string; } //# sourceMappingURL=decode.d.ts.map