UNPKG

matrix-react-sdk

Version:
38 lines (37 loc) 1.52 kB
import { MatrixClient } from "matrix-js-sdk/src/matrix"; import { SlashCommand as SlashCommandEvent } from "@matrix-org/analytics-events/types/typescript/SlashCommand"; import { TimelineRenderingType } from "../contexts/RoomContext"; import { TranslationKey } from "../languageHandler"; import { RunResult } from "./interface"; type RunFn = (this: Command, matrixClient: MatrixClient, roomId: string, threadId: string | null, args?: string) => RunResult; interface ICommandOpts { command: string; aliases?: string[]; args?: string; description: TranslationKey; analyticsName?: SlashCommandEvent["command"]; runFn?: RunFn; category: string; hideCompletionAfterSpace?: boolean; isEnabled?(matrixClient: MatrixClient | null): boolean; renderingTypes?: TimelineRenderingType[]; } export declare class Command { readonly command: string; readonly aliases: string[]; readonly args?: string; readonly description: TranslationKey; readonly runFn?: RunFn; readonly category: string; readonly hideCompletionAfterSpace: boolean; readonly renderingTypes?: TimelineRenderingType[]; readonly analyticsName?: SlashCommandEvent["command"]; private readonly _isEnabled?; constructor(opts: ICommandOpts); getCommand(): string; getCommandWithArgs(): string; run(matrixClient: MatrixClient, roomId: string, threadId: string | null, args?: string): RunResult; getUsage(): string; isEnabled(cli: MatrixClient | null): boolean; } export {};