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
|
will not change however the exact contents probably will, for example with
|
||||||
permission system ideas.
|
permission system ideas.
|
||||||
Example file:
|
Example file:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "Test plugin",
|
"name": "Test plugin",
|
||||||
"description": "This plugin is for testing stuff.",
|
"description": "This plugin is for testing stuff.",
|
||||||
"authors": "Mm2PL",
|
"authors": "Mm2PL",
|
||||||
"homepage": "https://github.com/Chatterino/Chatterino2",
|
"homepage": "https://github.com/Chatterino/Chatterino2",
|
||||||
"tags": [
|
"tags": ["test"],
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -44,11 +43,12 @@ An example plugin is available at [https://github.com/Mm2PL/Chatterino-test-plug
|
||||||
## API
|
## API
|
||||||
|
|
||||||
The following parts of the Lua standard library are loaded:
|
The following parts of the Lua standard library are loaded:
|
||||||
- `_G` (all globals)
|
|
||||||
- `table`
|
- `_G` (all globals)
|
||||||
- `string`
|
- `table`
|
||||||
- `math`
|
- `string`
|
||||||
- `utf8`
|
- `math`
|
||||||
|
- `utf8`
|
||||||
|
|
||||||
The official manual for them is available [here](https://www.lua.org/manual/5.4/manual.html#6).
|
The official manual for them is available [here](https://www.lua.org/manual/5.4/manual.html#6).
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ Returns `true` if everything went ok, `false` if there already exists another
|
||||||
command with this name.
|
command with this name.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function cmdWords(ctx)
|
function cmdWords(ctx)
|
||||||
-- ctx contains:
|
-- ctx contains:
|
||||||
|
@ -75,15 +76,17 @@ c2.register_command("/wordsl", cmdWords)
|
||||||
```
|
```
|
||||||
|
|
||||||
Limitations/known issues:
|
Limitations/known issues:
|
||||||
- commands registered in functions, not in the global scope might not show up in the settings UI,
|
|
||||||
|
- 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
|
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)
|
- spaces in command names aren't handled very well (https://github.com/Chatterino/chatterino2/issues/1517)
|
||||||
|
|
||||||
### `send_msg(channel, text)`
|
### `send_msg(channel, text)`
|
||||||
|
|
||||||
Sends a message to `channel` with the specified text. Also executes commands.
|
Sends a message to `channel` with the specified text. Also executes commands.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
function cmdShout(ctx)
|
function cmdShout(ctx)
|
||||||
table.remove(ctx.words, 1)
|
table.remove(ctx.words, 1)
|
||||||
|
@ -94,7 +97,8 @@ c2.register_command("/shout", cmdShout)
|
||||||
```
|
```
|
||||||
|
|
||||||
Limitations/Known issues:
|
Limitations/Known issues:
|
||||||
- it is possible to trigger your own Lua command with this causing a potentially infinite loop
|
|
||||||
|
- it is possible to trigger your own Lua command with this causing a potentially infinite loop
|
||||||
|
|
||||||
### `system_msg(channel, text)`
|
### `system_msg(channel, text)`
|
||||||
|
|
||||||
|
@ -104,10 +108,10 @@ throw an error if the number of arguments received doesn't match what it
|
||||||
expects.
|
expects.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local ok = c2.system_msg("pajlada", "test")
|
local ok = c2.system_msg("pajlada", "test")
|
||||||
if (not ok)
|
if (not ok)
|
||||||
-- channel not found
|
-- channel not found
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue