declare module 'komet:api' { export type Permission = | 'chat.write' | 'chat.edit' | 'chat.photo' | 'chat.file' | 'ui.notify' | 'contact.read' | 'message.readReply' | 'network' | 'storage'; export type AttachmentType = | 'photo' | 'video' | 'audio' | 'file' | 'contact' | 'location' | 'sticker' | 'control' | 'poll' | 'share' | 'call' | 'inlineKeyboard' | 'forward' | 'unknown'; export interface ReplyMessage { readonly id: string; readonly senderId: number; readonly text: string | null; readonly time: number; readonly attachments: ReadonlyArray<{ readonly type: AttachmentType }>; } export interface CommandContext { readonly args: string; readonly arguments: Readonly>; readonly reply: ReplyMessage | null; readonly apiVersion: number; } export type CommandHandler = (context: CommandContext) => void | Promise; export type MediaSource = | { readonly base64: string; readonly url?: string } | { readonly url: string; readonly base64?: string }; export type PhotoOptions = MediaSource & { readonly filename?: string; readonly caption?: string; }; export type FileOptions = MediaSource & { readonly filename?: string; }; export interface Peer { readonly id: number; readonly displayName: string; readonly country: string | null; readonly registrationTime: number | null; readonly updateTime: number | null; readonly options: ReadonlyArray; } export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; export interface FetchOptions { readonly method?: HttpMethod; readonly headers?: Readonly>; readonly body?: string; } export interface FetchResponse { readonly status: number; readonly headers: Readonly>; readonly body: string; readonly base64: string; } export type JsonValue = | null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }; export const chat: { sendText(text: string): Promise; editText(messageId: string, text: string): Promise; sendPhoto(options: PhotoOptions): Promise; sendFile(options: FileOptions): Promise; }; export const network: { fetch(url: string, options?: FetchOptions): Promise; }; export const ui: { notify(message: string): Promise; }; export const contact: { getPeer(): Promise; }; export const runtime: { sleep(milliseconds: number): Promise; isOnline(): Promise; isActive(): Promise; }; export const storage: { get(key: string): Promise; set(key: string, value: JsonValue): Promise; remove(key: string): Promise; }; }