Move plugins to Sol (#5622)
Co-authored-by: Nerixyz <nerixdev@outlook.de> Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
+7
-16
@@ -171,7 +171,7 @@ function cmd_words(ctx)
|
||||
-- ctx contains:
|
||||
-- words - table of words supplied to the command including the trigger
|
||||
-- channel - the channel the command is being run in
|
||||
channel:add_system_message("Words are: " .. table.concat(ctx.words, " "))
|
||||
ctx.channel:add_system_message("Words are: " .. table.concat(ctx.words, " "))
|
||||
end
|
||||
|
||||
c2.register_command("/words", cmd_words)
|
||||
@@ -183,7 +183,7 @@ Limitations/known issues:
|
||||
rebuilding the window content caused by reloading another plugin will solve this.
|
||||
- Spaces in command names aren't handled very well (https://github.com/Chatterino/chatterino2/issues/1517).
|
||||
|
||||
#### `register_callback("CompletionRequested", handler)`
|
||||
#### `register_callback(c2.EventType.CompletionRequested, handler)`
|
||||
|
||||
Registers a callback (`handler`) to process completions. The callback takes a single table with the following entries:
|
||||
|
||||
@@ -207,7 +207,7 @@ function string.startswith(s, other)
|
||||
end
|
||||
|
||||
c2.register_callback(
|
||||
"CompletionRequested",
|
||||
c2.EventType.CompletionRequested,
|
||||
function(event)
|
||||
if ("!join"):startswith(event.query) then
|
||||
---@type CompletionList
|
||||
@@ -219,15 +219,6 @@ c2.register_callback(
|
||||
)
|
||||
```
|
||||
|
||||
#### `Platform` enum
|
||||
|
||||
This table describes platforms that can be accessed. Chatterino supports IRC
|
||||
however plugins do not yet have explicit access to get IRC channels objects.
|
||||
The values behind the names may change, do not count on them. It has the
|
||||
following keys:
|
||||
|
||||
- `Twitch`
|
||||
|
||||
#### `ChannelType` enum
|
||||
|
||||
This table describes channel types Chatterino supports. The values behind the
|
||||
@@ -260,9 +251,9 @@ used on non-Twitch channels. Special channels while marked as
|
||||
is an actual Twitch chatroom use `Channel:get_type()` instead of
|
||||
`Channel:is_twitch_channel()`.
|
||||
|
||||
##### `Channel:by_name(name, platform)`
|
||||
##### `Channel:by_name(name)`
|
||||
|
||||
Finds a channel given by `name` on `platform` (see [`Platform` enum](#Platform-enum)). Returns the channel or `nil` if not open.
|
||||
Finds a channel given by `name`. Returns the channel or `nil` if not open.
|
||||
|
||||
Some miscellaneous channels are marked as if they are specifically Twitch channels:
|
||||
|
||||
@@ -275,7 +266,7 @@ Some miscellaneous channels are marked as if they are specifically Twitch channe
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local pajladas = c2.Channel.by_name("pajlada", c2.Platform.Twitch)
|
||||
local pajladas = c2.Channel.by_name("pajlada")
|
||||
```
|
||||
|
||||
##### `Channel:by_twitch_id(id)`
|
||||
@@ -363,7 +354,7 @@ pajladas:add_system_message("Hello, world!")
|
||||
|
||||
Returns `true` if the channel is a Twitch channel, that is its type name has
|
||||
the `Twitch` prefix. This returns `true` for special channels like Mentions.
|
||||
You might want `Channel:get_type() == "Twitch"` if you want to use
|
||||
You might want `Channel:get_type() == c2.ChannelType.Twitch` if you want to use
|
||||
Twitch-specific functions.
|
||||
|
||||
##### `Channel:get_twitch_id()`
|
||||
|
||||
Reference in New Issue
Block a user