mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
I hate prettier SO FUCKING MUCH
This commit is contained in:
parent
ee1bb1956b
commit
cf7b73f251
1 changed files with 23 additions and 19 deletions
|
@ -25,15 +25,14 @@ be [semver 2.0](https://semver.org/) compliant. The general idea of `info.json`
|
|||
will not change however the exact contents probably will, for example with
|
||||
permission system ideas.
|
||||
Example file:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Test plugin",
|
||||
"description": "This plugin is for testing stuff.",
|
||||
"authors": "Mm2PL",
|
||||
"homepage": "https://github.com/Chatterino/Chatterino2",
|
||||
"tags": [
|
||||
"test"
|
||||
],
|
||||
"tags": ["test"],
|
||||
"version": "0.0.0",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
@ -44,6 +43,7 @@ An example plugin is available at [https://github.com/Mm2PL/Chatterino-test-plug
|
|||
## API
|
||||
|
||||
The following parts of the Lua standard library are loaded:
|
||||
|
||||
- `_G` (all globals)
|
||||
- `table`
|
||||
- `string`
|
||||
|
@ -63,6 +63,7 @@ Returns `true` if everything went ok, `false` if there already exists another
|
|||
command with this name.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
function cmdWords(ctx)
|
||||
-- ctx contains:
|
||||
|
@ -75,6 +76,7 @@ c2.register_command("/wordsl", cmdWords)
|
|||
```
|
||||
|
||||
Limitations/known issues:
|
||||
|
||||
- commands registered in functions, not in the global scope might not show up in the settings UI,
|
||||
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)
|
||||
|
@ -84,6 +86,7 @@ Limitations/known issues:
|
|||
Sends a message to `channel` with the specified text. Also executes commands.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
function cmdShout(ctx)
|
||||
table.remove(ctx.words, 1)
|
||||
|
@ -94,6 +97,7 @@ c2.register_command("/shout", cmdShout)
|
|||
```
|
||||
|
||||
Limitations/Known issues:
|
||||
|
||||
- it is possible to trigger your own Lua command with this causing a potentially infinite loop
|
||||
|
||||
### `system_msg(channel, text)`
|
||||
|
@ -104,10 +108,10 @@ throw an error if the number of arguments received doesn't match what it
|
|||
expects.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local ok = c2.system_msg("pajlada", "test")
|
||||
if (not ok)
|
||||
-- channel not found
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue