UNPKG

koishi-plugin-bilibili-notify-advanced-subscription

Version:

Bilibili-Notify 高级订阅配置插件

274 lines (273 loc) 11.6 kB
import { CustomCardStyle, CustomGuardBuy, CustomLiveMsg, PushFeature, SubItemMasters } from "@bilibili-notify/push"; import { Context, Schema } from "koishi"; //#region \0rolldown/runtime.js //#endregion //#region ../../node_modules/cosmokit/lib/index.d.ts type Dict<T = any, K extends string | symbol = string> = { [key in K]: T }; declare function isArrayBufferLike(value: any): value is ArrayBufferLike; declare function isArrayBufferSource(value: any): value is Binary.Source; declare namespace Binary { type Source<T extends ArrayBufferLike = ArrayBufferLike> = T | ArrayBufferView<T>; const is: typeof isArrayBufferLike; const isSource: typeof isArrayBufferSource; function fromSource<T extends ArrayBufferLike>(source: Source<T>): T; function toBase64(source: Source): string; function fromBase64(source: string): ArrayBuffer | Uint8Array<ArrayBuffer>; function toHex(source: Source): string; function fromHex(source: string): ArrayBuffer; } //#endregion //#region ../../node_modules/@standard-schema/spec/dist/index.d.ts /** The Standard Typed interface. This is a base type extended by other specs. */ interface StandardTypedV1<Input = unknown, Output = Input> { /** The Standard properties. */ readonly "~standard": StandardTypedV1.Props<Input, Output>; } declare namespace StandardTypedV1 { /** The Standard Typed properties interface. */ interface Props<Input = unknown, Output = Input> { /** The version number of the standard. */ readonly version: 1; /** The vendor name of the schema library. */ readonly vendor: string; /** Inferred types associated with the schema. */ readonly types?: Types<Input, Output> | undefined; } /** The Standard Typed types interface. */ interface Types<Input = unknown, Output = Input> { /** The input type of the schema. */ readonly input: Input; /** The output type of the schema. */ readonly output: Output; } /** Infers the input type of a Standard Typed. */ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"]; /** Infers the output type of a Standard Typed. */ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"]; } /** The Standard Schema interface. */ interface StandardSchemaV1<Input = unknown, Output = Input> { /** The Standard Schema properties. */ readonly "~standard": StandardSchemaV1.Props<Input, Output>; } declare namespace StandardSchemaV1 { /** The Standard Schema properties interface. */ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> { /** Validates unknown input values. */ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>; } /** The result interface of the validate function. */ type Result<Output> = SuccessResult<Output> | FailureResult; /** The result interface if validation succeeds. */ interface SuccessResult<Output> { /** The typed output value. */ readonly value: Output; /** A falsy value for `issues` indicates success. */ readonly issues?: undefined; } interface Options { /** Explicit support for additional vendor-specific parameters, if needed. */ readonly libraryOptions?: Record<string, unknown> | undefined; } /** The result interface if validation fails. */ interface FailureResult { /** The issues of failed validation. */ readonly issues: ReadonlyArray<Issue>; } /** The issue interface of the failure output. */ interface Issue { /** The error message of the issue. */ readonly message: string; /** The path of the issue, if any. */ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined; } /** The path segment interface of the issue. */ interface PathSegment { /** The key representing a path segment. */ readonly key: PropertyKey; } /** The Standard types interface. */ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {} /** Infers the input type of a Standard. */ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>; /** Infers the output type of a Standard. */ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>; } /** The Standard JSON Schema interface. */ declare namespace index_d_exports { export { Schema$1 as default }; } declare const kSchema: unique symbol; declare global { namespace Schemastery { type From<X> = X extends string | number | boolean ? Schema$1<X> : X extends Schema$1 ? X : X extends typeof String ? Schema$1<string> : X extends typeof Number ? Schema$1<number> : X extends typeof Boolean ? Schema$1<boolean> : X extends typeof Function ? Schema$1<Function, (...args: any[]) => any> : X extends Constructor<infer S> ? Schema$1<S> : never; type TypeS1<X> = X extends Schema$1<infer S, unknown> ? S : never; type Inverse<X> = X extends Schema$1<any, infer Y> ? (arg: Y) => void : never; type TypeS<X> = TypeS1<From<X>>; type TypeT<X> = ReturnType<From<X>>; type Resolve = (data: any, schema: Schema$1, options: Options, strict?: boolean) => [any, any?]; type IntersectS<X> = From<X> extends Schema$1<infer S, unknown> ? S : never; type IntersectT<X> = Inverse<From<X>> extends ((arg: infer T) => void) ? T : never; type TupleS<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeS<L>?, ...TupleS<R>] : any[]; type TupleT<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeT<L>?, ...TupleT<R>] : any[]; type ObjectS<X extends Dict> = { [K in keyof X]?: TypeS<X[K]> | null } & Dict; type ObjectT<X extends Dict> = { [K in keyof X]: TypeT<X[K]> } & Dict; type Constructor<T = any> = new (...args: any[]) => T; interface Static { <T = any>(options: Partial<Schema$1<T>>): Schema$1<T>; new <T = any>(options: Partial<Schema$1<T>>): Schema$1<T>; prototype: Schema$1; resolve: Resolve; from<X = any>(source?: X): From<X>; extend(type: string, resolve: Resolve): void; any<T = any>(): Schema$1<T>; never(): Schema$1<never>; const<const T>(value: T): Schema$1<T>; string(): Schema$1<string>; number(): Schema$1<number>; natural(): Schema$1<number>; percent(): Schema$1<number>; boolean(): Schema$1<boolean>; date(): Schema$1<string | Date, Date>; regExp(flag?: string): Schema$1<string | RegExp, RegExp>; arrayBuffer(): Schema$1<Binary.Source, ArrayBufferLike>; arrayBuffer(encoding: 'hex' | 'base64'): Schema$1<Binary.Source | string, ArrayBufferLike>; bitset<K extends string>(bits: Partial<Record<K, number>>): Schema$1<number | readonly K[], number>; function(): Schema$1<Function, (...args: any[]) => any>; is(constructor: string): Schema$1; is<T>(constructor: Constructor<T>): Schema$1<T>; array<X>(inner: X): Schema$1<TypeS<X>[], TypeT<X>[]>; dict<X, Y extends Schema$1<any, string> = Schema$1<string>>(inner: X, sKey?: Y): Schema$1<Dict<TypeS<X>, TypeS<Y>>, Dict<TypeT<X>, TypeT<Y>>>; tuple<const X extends readonly any[]>(list: X): Schema$1<TupleS<X>, TupleT<X>>; object<X extends Dict>(dict: X): Schema$1<ObjectS<X>, ObjectT<X>>; union<const X>(list: readonly X[]): Schema$1<TypeS<X>, TypeT<X>>; intersect<const X>(list: readonly X[]): Schema$1<IntersectS<X>, IntersectT<X>>; transform<X, T>(inner: X, callback: (value: TypeS<X>, options: Schemastery.Options) => T, preserve?: boolean): Schema$1<TypeS<X>, T>; lazy<X extends Schema$1>(callback: () => X): X; ValidationError: typeof ValidationError; } interface Options { autofix?: boolean; ignore?(data: any, schema: Schema$1): boolean; path?: (keyof any)[]; } interface Meta<T = any> { default?: T extends {} ? Partial<T> : T; required?: boolean; disabled?: boolean; collapse?: boolean; badges?: { text: string; type: string; }[]; hidden?: boolean; loose?: boolean; role?: string; extra?: any; link?: string; description?: string | Dict<string>; comment?: string; pattern?: { source: string; flags?: string; }; max?: number; min?: number; step?: number; } } interface Schemastery<S = any, T = S> { (data?: S | null, options?: Schemastery.Options): T; new (data?: S | null, options?: Schemastery.Options): T; [kSchema]: true; uid: number; meta: Schemastery.Meta<T>; type: string; sKey?: Schema$1; inner?: Schema$1; list?: Schema$1[]; dict?: Dict<Schema$1>; bits?: Dict<number>; callback?: Function; constructor?: string | Function; builder?: Function; value?: T; refs?: Dict<Schema$1>; preserve?: boolean; '~standard': StandardSchemaV1.Props; toString(inline?: boolean): string; toJSON(): Schema$1<S, T>; required(value?: boolean): Schema$1<S, T>; hidden(value?: boolean): Schema$1<S, T>; loose(value?: boolean): Schema$1<S, T>; role(text: string, extra?: any): Schema$1<S, T>; link(link: string): Schema$1<S, T>; default(value: T): Schema$1<S, T>; comment(text: string): Schema$1<S, T>; description(text: string): Schema$1<S, T>; disabled(value?: boolean): Schema$1<S, T>; collapse(value?: boolean): Schema$1<S, T>; deprecated(): Schema$1<S, T>; experimental(): Schema$1<S, T>; pattern(regexp: RegExp): Schema$1<S, T>; max(value: number): Schema$1<S, T>; min(value: number): Schema$1<S, T>; step(value: number): Schema$1<S, T>; set(key: string, value: Schema$1): Schema$1<S, T>; push(value: Schema$1): Schema$1<S, T>; simplify(value?: any): any; i18n(messages: Dict): Schema$1<S, T>; extra<K extends keyof Schemastery.Meta>(key: K, value: Schemastery.Meta[K]): Schema$1<S, T>; } } declare class ValidationError extends TypeError { options: Schemastery.Options; name: string; constructor(message: string, options: Schemastery.Options); static is(error: any): error is ValidationError; } type Schema$1<S = any, T = S> = Schemastery<S, T>; declare const Schema$1: Schemastery.Static; //#endregion //#region src/core.d.ts type ChannelConfig = Record<PushFeature, boolean> & { channelId: string; }; interface TargetConfig { platform: string; channelArr: ChannelConfig[]; } type SubItemRawConfig = SubItemMasters & { uid: string; roomId: string; target: TargetConfig[]; customLiveSummary: { enable: boolean; liveSummary?: string[]; }; customLiveMsg: CustomLiveMsg; customCardStyle: CustomCardStyle; customGuardBuy: CustomGuardBuy; customSpecialDanmakuUsers: { enable: boolean; specialDanmakuUsers?: string[]; msgTemplate?: string; }; customSpecialUsersEnterTheRoom: { enable: boolean; specialUsersEnterTheRoom?: string[]; msgTemplate?: string; }; }; interface BilibiliNotifyAdvancedSubConfig { subs: Record<string, SubItemRawConfig>; } declare const BilibiliNotifyAdvancedSubConfig: Schema<BilibiliNotifyAdvancedSubConfig>; //#endregion //#region src/index.d.ts declare const name = "bilibili-notify-advanced-subscription"; type Config = BilibiliNotifyAdvancedSubConfig; declare const Config: index_d_exports<BilibiliNotifyAdvancedSubConfig>; declare function apply(ctx: Context, config: Config): void; //#endregion export { Config, apply, name };