diff --git a/.prettierrc b/.prettierrc index b73da844..c4c5b860 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,9 @@ trailingComma: es5 endOfLine: auto overrides: + - files: "*.ts" + options: + tabWidth: 4 - files: "*.md" options: proseWrap: preserve diff --git a/docs/chatterino.d.ts b/docs/chatterino.d.ts index 7929fbc3..f2acaa69 100644 --- a/docs/chatterino.d.ts +++ b/docs/chatterino.d.ts @@ -1,133 +1,132 @@ /** @noSelfInFile */ declare module c2 { - enum LogLevel { - Debug, - Info, - Warning, - Critical, - } - class CommandContext { - words: String[]; - channel: Channel; - } + enum LogLevel { + Debug, + Info, + Warning, + Critical, + } + class CommandContext { + words: string[]; + channel: Channel; + } - enum Platform { - Twitch, - } - enum ChannelType { - None, - Direct, - Twitch, - TwitchWhispers, - TwitchWatching, - TwitchMentions, - TwitchLive, - TwitchAutomod, - Irc, - Misc, - } + enum ChannelType { + None, + Direct, + Twitch, + TwitchWhispers, + TwitchWatching, + TwitchMentions, + TwitchLive, + TwitchAutomod, + Misc, + } - interface IWeakResource { - is_valid(): boolean; - } + interface IWeakResource { + is_valid(): boolean; + } - interface ISharedResource {} + interface ISharedResource {} - 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 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; + class Channel implements IWeakResource { + is_valid(): boolean; + get_name(): string; + get_type(): ChannelType; + get_display_name(): string; - is_twitch_channel(): boolean; + send_message(message: string, execute_commands: boolean): void; + send_message(message: string): void; - get_room_modes(): RoomModes; - get_stream_status(): StreamStatus; - get_twitch_id(): string; - is_broadcaster(): boolean; - is_mod(): boolean; - is_vip(): boolean; + add_system_message(message: string): void; - static by_name(name: string, platform: Platform): null | Channel; - static by_twitch_id(id: string): null | Channel; - } + is_twitch_channel(): boolean; - enum HTTPMethod { - Get, - Post, - Put, - Delete, - Patch, - } + get_room_modes(): RoomModes; + get_stream_status(): StreamStatus; + get_twitch_id(): string; + is_broadcaster(): boolean; + is_mod(): boolean; + is_vip(): boolean; - class HTTPResponse implements ISharedResource { - data(): string; - status(): number | null; - error(): string; - } + static by_name(name: string): null | Channel; + static by_twitch_id(id: string): null | Channel; + } - type HTTPCallback = (res: HTTPResponse) => void; - class HTTPRequest implements ISharedResource { - on_success(callback: HTTPCallback): void; - on_error(callback: HTTPCallback): void; - finally(callback: () => void): void; + enum HTTPMethod { + Get, + Post, + Put, + Delete, + Patch, + } - set_timeout(millis: number): void; - set_payload(data: string): void; - set_header(name: string, value: string): void; + class HTTPResponse implements ISharedResource { + data(): string; + status(): number | null; + error(): string; + } - execute(): void; + type HTTPCallback = (res: HTTPResponse) => void; + class HTTPRequest implements ISharedResource { + on_success(callback: HTTPCallback): void; + on_error(callback: HTTPCallback): void; + finally(callback: () => void): void; - // might error - static create(method: HTTPMethod, url: string): HTTPRequest; - } + set_timeout(millis: number): void; + set_payload(data: string): void; + set_header(name: string, value: string): void; - function log(level: LogLevel, ...data: any[]): void; - function register_command( - name: String, - handler: (ctx: CommandContext) => void - ): boolean; + execute(): void; - class CompletionEvent { - query: string; - full_text_content: string; - cursor_position: number; - is_first_word: boolean; - } + // might error + static create(method: HTTPMethod, url: string): HTTPRequest; + } - class CompletionList { - values: String[]; - hide_others: boolean; - } + function log(level: LogLevel, ...data: any[]): void; + function register_command( + name: string, + handler: (ctx: CommandContext) => void + ): boolean; - enum EventType { - CompletionRequested = "CompletionRequested", - } + class CompletionEvent { + query: string; + full_text_content: string; + cursor_position: number; + is_first_word: boolean; + } - type CbFuncCompletionsRequested = (ev: CompletionEvent) => CompletionList; - type CbFunc = T extends EventType.CompletionRequested - ? CbFuncCompletionsRequested - : never; + class CompletionList { + values: string[]; + hide_others: boolean; + } - function register_callback(type: T, func: CbFunc): void; - function later(callback: () => void, msec: number): void; + enum EventType { + CompletionRequested = "CompletionRequested", + } + + type CbFuncCompletionsRequested = (ev: CompletionEvent) => CompletionList; + type CbFunc = T extends EventType.CompletionRequested + ? CbFuncCompletionsRequested + : never; + + function register_callback(type: T, func: CbFunc): void; + function later(callback: () => void, msec: number): void; } diff --git a/docs/plugin-meta.lua b/docs/plugin-meta.lua index 27cdf878..828e9706 100644 --- a/docs/plugin-meta.lua +++ b/docs/plugin-meta.lua @@ -70,6 +70,8 @@ c2.ChannelType = { ---@field subscriber_only boolean ---@field unique_chat boolean You might know this as r9kbeta or robot9000. ---@field emotes_only boolean Whether or not text is allowed in messages. Note that "emotes" here only means Twitch emotes, not Unicode emoji, nor 3rd party text-based emotes +---@field follower_only number? Time in minutes you need to follow to chat or nil. +---@field slow_mode number? Time in seconds you need to wait before sending messages or nil. -- End src/providers/twitch/TwitchChannel.hpp diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index 484b52bb..eb15e78c 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -115,24 +115,26 @@ public: */ bool emoteOnly = false; + /** + * @lua@field follower_only number? Time in minutes you need to follow to chat or nil. + */ /** * @brief Number of minutes required for users to be followed before typing in chat * * Special cases: * -1 = follower mode off * 0 = follower mode on, no time requirement - * - * @lua@field follower_only number? Time in minutes you need to follow to chat or nil. - **/ + */ int followerOnly = -1; + /** + * @lua@field slow_mode number? Time in seconds you need to wait before sending messages or nil. + */ /** * @brief Number of seconds required to wait before typing emotes * * 0 = slow mode off - * - * @lua@field slow_mode number? Time in seconds you need to wait before sending messages or nil. - **/ + */ int slowMode = 0; };