2023-04-02 15:31:53 +02:00
|
|
|
/** @noSelfInFile */
|
|
|
|
|
|
|
|
declare module c2 {
|
|
|
|
enum LogLevel {
|
|
|
|
Debug,
|
|
|
|
Info,
|
|
|
|
Warning,
|
|
|
|
Critical,
|
|
|
|
}
|
|
|
|
class CommandContext {
|
|
|
|
words: String[];
|
|
|
|
channel_name: String;
|
|
|
|
}
|
|
|
|
|
|
|
|
function log(level: LogLevel, ...data: any[]): void;
|
|
|
|
function register_command(
|
|
|
|
name: String,
|
|
|
|
handler: (ctx: CommandContext) => void
|
|
|
|
): boolean;
|
|
|
|
function send_msg(channel: String, text: String): boolean;
|
|
|
|
function system_msg(channel: String, text: String): boolean;
|
2023-12-10 14:41:05 +01:00
|
|
|
|
|
|
|
class CompletionList {
|
|
|
|
values: String[];
|
|
|
|
hide_others: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum EventType {
|
2023-12-29 18:12:50 +01:00
|
|
|
CompletionRequested = "CompletionRequested",
|
2023-12-10 14:41:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type CbFuncCompletionsRequested = (
|
|
|
|
query: string,
|
|
|
|
full_text_content: string,
|
|
|
|
cursor_position: number,
|
|
|
|
is_first_word: boolean
|
|
|
|
) => CompletionList;
|
2023-12-29 18:12:50 +01:00
|
|
|
type CbFunc<T> = T extends EventType.CompletionRequested
|
2023-12-10 14:41:05 +01:00
|
|
|
? CbFuncCompletionsRequested
|
|
|
|
: never;
|
|
|
|
|
|
|
|
function register_callback<T>(type: T, func: CbFunc<T>): void;
|
2023-04-02 15:31:53 +02:00
|
|
|
}
|