ddnet
Version:
A typescript npm package for interacting with data from ddnet.org
83 lines (82 loc) • 2 kB
TypeScript
import { TeeSkinRenderOptions } from './TeeSkinUtils.js';
/**
* Depth 2 {@link DeepRequired}
*
* @internal
*/
export type D2Required<T extends object> = Required<{
[P in keyof T]: T[P] extends object | undefined ? Required<T[P]> : T[P];
}>;
/**
* Tee skin options
*/
export interface TeeSkin6Options {
/**
* The resource to use, pass a {@link Buffer} for loading local custom skins, otherwise a skin name.
*
* @default
* "default"
*/
skinResource?: string | Buffer;
/**
* The url to query in case {@link skinResource} is a string.
*
* @remarks
* The "/" at the end of the url is important.
*
* @default
* "https://skins.scrumplex.net/skin/"
*/
skinDbUrl?: string;
}
/**
* Class used to render TW 0.6 skins (ddnet).
*/
export declare class TeeSkin6 {
/**
* 0.6 Tee Skin file responses cache. (48h default TTL)
*/
private static cache;
/**
* Sets the TTL (Time-To-Live) for objects in cache.
*/
static setTTL: (ttlMS?: number) => void;
/**
* Clears the {@link TeeSkin6.cache}.
*/
static clearCache: () => Promise<void>;
/**
* Options for this instance.
*/
readonly opts: D2Required<TeeSkin6Options>;
/**
* Skin file buffer.
*/
private ogFileBuf;
/**
* Construct a new {@link TeeSkin6} instance.
*/
constructor(options?: TeeSkin6Options);
/**
* Get the skin file buffer.
*/
getSkinFileBuf(
/**
* Wether to bypass the cache when fetching.
*/
force?: boolean): Promise<Buffer>;
/**
* Populate {@link ogFileBuf} with the skin file buffer.
*
* If using local custom skin, it won't do anything. Otherwise it will fetch the skin and store the response buffer.
*/
private populateBuffer;
/**
* Renders a tee image.
*/
render(
/**
* Render options to use.
*/
options?: TeeSkinRenderOptions): Promise<Buffer>;
}