feat: complete Ancestor quote bot with production-ready Docker support

This commit is contained in:
unfunny
2026-09-13 14:14:38 -04:00
parent f2016da05a
commit fe7351a7dc
1145 changed files with 30890 additions and 97684 deletions

View File

@@ -1,5 +1,5 @@
import { type IEvent, type MatrixEvent } from "./models/event.ts";
import { type BaseLogger } from "./logger.ts";
import { Optional } from "matrix-events-sdk";
import { IEvent, MatrixEvent } from "./models/event";
/**
* Internalises a string, reusing a known pointer or storing the pointer
* if needed for future strings.
@@ -38,7 +38,7 @@ export declare function decodeParams(query: string): Record<string, string | str
* variables with. E.g. `{ "$bar": "baz" }`.
* @returns The result of replacing all template variables e.g. '/foo/baz'.
*/
export declare function encodeUri(pathTemplate: string, variables: Record<string, string | null | undefined>): string;
export declare function encodeUri(pathTemplate: string, variables: Record<string, Optional<string>>): string;
/**
* The removeElement() method removes the first element in the array that
* satisfies (returns true) the provided testing function.
@@ -123,30 +123,17 @@ export declare function ensureNoTrailingSlash(url?: string): string | undefined;
* Returns a promise which resolves with a given value after the given number of ms
*/
export declare function sleep<T>(ms: number, value?: T): Promise<T>;
/**
* Utility to log the duration of a promise.
*
* @param logger - The logger to log to.
* @param name - The name of the operation.
* @param block - The block to execute.
*/
export declare function logDuration<T>(logger: BaseLogger, name: string, block: () => Promise<T>): Promise<T>;
/**
* Utility to log the duration of a synchronous block.
*
* @param logger - The logger to log to.
* @param name - The name of the operation.
* @param block - The block to execute.
*/
export declare function logDurationSync<T>(logger: BaseLogger, name: string, block: () => T): T;
/**
* Promise/async version of {@link setImmediate}.
*
* Implementation is based on `setTimeout` for wider compatibility.
* @deprecated Use {@link sleep} instead.
*/
export declare function immediate(): Promise<void>;
export declare function isNullOrUndefined(val: any): boolean;
export interface IDeferred<T> {
resolve: (value: T | Promise<T>) => void;
reject: (reason?: any) => void;
promise: Promise<T>;
}
export declare function defer<T = void>(): IDeferred<T>;
export declare function promiseMapSeries<T>(promises: Array<T | Promise<T>>, fn: (t: T) => Promise<unknown> | undefined): Promise<void>;
export declare function promiseTry<T>(fn: () => T | Promise<T>): Promise<T>;
export declare function chunkPromises<T>(fns: (() => Promise<T>)[], chunkSize: number): Promise<T[]>;
@@ -157,11 +144,9 @@ export declare function chunkPromises<T>(fns: (() => Promise<T>)[], chunkSize: n
* should always return a new promise.
* @param promiseFn - The function to call to get a fresh promise instance. Takes an
* attempt count as an argument, for logging/debugging purposes.
* @param shouldRetry - Optional function which is called with the error the latest rejection from promiseFn,
* retrying will ba aborted if this return false.
* @returns The promise for the retried operation.
*/
export declare function simpleRetryOperation<T>(promiseFn: (attempt: number) => Promise<T>, shouldRetry?: (e: unknown) => boolean): Promise<T>;
export declare function simpleRetryOperation<T>(promiseFn: (attempt: number) => Promise<T>): Promise<T>;
/**
* The default alphabet used by string averaging in this SDK. This matches
* all usefully printable ASCII characters (0x20-0x7E, inclusive).
@@ -232,6 +217,12 @@ export declare function prevString(s: string, alphabet?: string): string;
* positive if the reference string is after; and zero if equal.
*/
export declare function lexicographicCompare(a: string, b: string): number;
/**
* Performant language-sensitive string comparison
* @param a - the first string to compare
* @param b - the second string to compare
*/
export declare function compare(a: string, b: string): number;
/**
* This function is similar to Object.assign() but it assigns recursively and
* allows you to ignore nullish values from the source
@@ -255,7 +246,7 @@ export declare function mapsEqual<K, V>(x: Map<K, V>, y: Map<K, V>, eq?: (v1: V,
* Also supports sub-lists of Maps.
*/
export declare function recursiveMapToObject(map: Map<any, any>): Record<any, any>;
export declare function unsafeProp(prop: keyof any | undefined): boolean;
export declare function unsafeProp<K extends keyof any | undefined>(prop: K): boolean;
export declare function safeSet<O extends Record<any, any>, K extends keyof O>(obj: O, prop: K, value: O[K]): void;
export declare function noUnsafeEventProps(event: Partial<IEvent>): boolean;
export declare class MapWithDefault<K, V> extends Map<K, V> {