2023-04-02 15:31:53 +02:00
|
|
|
/** @noSelfInFile */
|
|
|
|
|
|
|
|
declare module c2 {
|
|
|
|
enum LogLevel {
|
|
|
|
Debug,
|
|
|
|
Info,
|
|
|
|
Warning,
|
|
|
|
Critical,
|
|
|
|
}
|
|
|
|
class CommandContext {
|
|
|
|
words: String[];
|
2024-02-18 22:35:40 +01:00
|
|
|
channel: Channel;
|
2023-04-02 15:31:53 +02:00
|
|
|
}
|
|
|
|
|
2024-02-03 19:12:00 +01:00
|
|
|
enum Platform {
|
|
|
|
Twitch,
|
|
|
|
}
|
|
|
|
enum ChannelType {
|
|
|
|
None,
|
|
|
|
Direct,
|
|
|
|
Twitch,
|
|
|
|
TwitchWhispers,
|
|
|
|
TwitchWatching,
|
|
|
|
TwitchMentions,
|
|
|
|
TwitchLive,
|
|
|
|
TwitchAutomod,
|
|
|
|
Irc,
|
|
|
|
Misc,
|
|
|
|
}
|
|
|
|
|
|
|
|
interface IWeakResource {
|
|
|
|
is_valid(): boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
class RoomModes {
|
|
|
|
unique_chat: boolean;
|
|
|
|
subscriber_only: boolean;
|
|
|
|
emotes_only: boolean;
|
|
|
|
follower_only: null | number;
|
|
|
|
slow_mode: null | number;
|
|
|
|
}
|
|
|
|
class StreamStatus {
|
|
|
|
live: boolean;
|
|
|
|
viewer_count: number;
|
|
|
|
uptime: number;
|
|
|
|
title: string;
|
|
|
|
game_name: string;
|
|
|
|
game_id: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Channel implements IWeakResource {
|
|
|
|
is_valid(): boolean;
|
|
|
|
get_name(): string;
|
|
|
|
get_type(): ChannelType;
|
|
|
|
get_display_name(): string;
|
|
|
|
send_message(message: string, execute_commands: boolean): void;
|
|
|
|
add_system_message(message: string): void;
|
|
|
|
|
|
|
|
is_twitch_channel(): boolean;
|
|
|
|
|
|
|
|
get_room_modes(): RoomModes;
|
|
|
|
get_stream_status(): StreamStatus;
|
|
|
|
get_twitch_id(): string;
|
|
|
|
is_broadcaster(): boolean;
|
|
|
|
is_mod(): boolean;
|
|
|
|
is_vip(): boolean;
|
|
|
|
|
|
|
|
static by_name(name: string, platform: Platform): null | Channel;
|
|
|
|
static by_twitch_id(id: string): null | Channel;
|
|
|
|
}
|
|
|
|
|
2023-04-02 15:31:53 +02:00
|
|
|
function log(level: LogLevel, ...data: any[]): void;
|
|
|
|
function register_command(
|
|
|
|
name: String,
|
|
|
|
handler: (ctx: CommandContext) => void
|
|
|
|
): boolean;
|
2023-12-10 14:41:05 +01:00
|
|
|
|
2024-03-30 15:23:02 +01:00
|
|
|
class CompletionEvent {
|
|
|
|
query: string;
|
|
|
|
full_text_content: string;
|
|
|
|
cursor_position: number;
|
|
|
|
is_first_word: 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
|
|
|
}
|
|
|
|
|
2024-03-30 15:23:02 +01:00
|
|
|
type CbFuncCompletionsRequested = (ev: CompletionEvent) => 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;
|
2024-02-25 12:45:59 +01:00
|
|
|
function later(callback: () => void, msec: number): void;
|
2023-04-02 15:31:53 +02:00
|
|
|
}
|