2023-12-29 18:12:50 +01:00
|
|
|
---@meta Chatterino2
|
|
|
|
|
2023-12-30 11:26:19 +01:00
|
|
|
-- This file is automatically generated from src/controllers/plugins/LuaAPI.hpp by the scripts/make_luals_meta.py script
|
2023-12-29 18:12:50 +01:00
|
|
|
-- This file is intended to be used with LuaLS (https://luals.github.io/).
|
|
|
|
-- Add the folder this file is in to "Lua.workspace.library".
|
|
|
|
|
2023-12-30 11:26:19 +01:00
|
|
|
c2 = {}
|
|
|
|
|
2023-12-29 18:12:50 +01:00
|
|
|
---@alias LogLevel integer
|
2023-12-30 11:26:19 +01:00
|
|
|
---@type { Debug: LogLevel, Info: LogLevel, Warning: LogLevel, Critical: LogLevel }
|
|
|
|
c2.LogLevel = {}
|
2023-12-29 18:12:50 +01:00
|
|
|
|
2023-12-30 11:26:19 +01:00
|
|
|
---@alias EventType integer
|
|
|
|
---@type { CompletionRequested: EventType }
|
|
|
|
c2.EventType = {}
|
2023-12-29 18:12:50 +01:00
|
|
|
---@class CommandContext
|
|
|
|
---@field words string[] The words typed when executing the command. For example `/foo bar baz` will result in `{"/foo", "bar", "baz"}`.
|
|
|
|
---@field channel_name string The name of the channel the command was executed in.
|
|
|
|
|
|
|
|
---@class CompletionList
|
|
|
|
---@field values string[] The completions
|
|
|
|
---@field hide_others boolean Whether other completions from Chatterino should be hidden/ignored.
|
|
|
|
|
|
|
|
--- Registers a new command called `name` which when executed will call `handler`.
|
2023-12-30 11:26:19 +01:00
|
|
|
---
|
2023-12-29 18:12:50 +01:00
|
|
|
---@param name string The name of the command.
|
|
|
|
---@param handler fun(ctx: CommandContext) The handler to be invoked when the command gets executed.
|
|
|
|
---@return boolean ok Returns `true` if everything went ok, `false` if a command with this name exists.
|
|
|
|
function c2.register_command(name, handler) end
|
|
|
|
|
2023-12-30 11:26:19 +01:00
|
|
|
--- Registers a callback to be invoked when completions for a term are requested.
|
|
|
|
---
|
|
|
|
---@param type "CompletionRequested"
|
|
|
|
---@param func fun(query: string, full_text_content: string, cursor_position: integer, is_first_word: boolean): CompletionList The callback to be invoked.
|
|
|
|
function c2.register_callback(type, func) end
|
|
|
|
|
2023-12-29 18:12:50 +01:00
|
|
|
--- Sends a message to `channel` with the specified text. Also executes commands.
|
|
|
|
---
|
|
|
|
--- **Warning**: It is possible to trigger your own Lua command with this causing a potentially infinite loop.
|
|
|
|
---
|
|
|
|
---@param channel string The name of the Twitch channel
|
|
|
|
---@param text string The text to be sent
|
|
|
|
---@return boolean ok
|
|
|
|
function c2.send_msg(channel, text) end
|
|
|
|
|
|
|
|
--- Creates a system message (gray message) and adds it to the Twitch channel specified by `channel`.
|
2023-12-30 11:26:19 +01:00
|
|
|
---
|
2023-12-29 18:12:50 +01:00
|
|
|
---@param channel string
|
|
|
|
---@param text string
|
|
|
|
---@return boolean ok
|
|
|
|
function c2.system_msg(channel, text) end
|
|
|
|
|
2023-12-30 11:26:19 +01:00
|
|
|
--- Writes a message to the Chatterino log.
|
|
|
|
---
|
|
|
|
---@param level LogLevel The desired level.
|
|
|
|
---@param ... any Values to log. Should be convertible to a string with `tostring()`.
|
|
|
|
function c2.log(level, ...) end
|
|
|
|
|