I hate prettier SO FUCKING MUCH

This commit is contained in:
Mm2PL 2023-02-02 21:37:42 +01:00
parent ee1bb1956b
commit cf7b73f251
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9

View file

@ -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,6 +43,7 @@ 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) - `_G` (all globals)
- `table` - `table`
- `string` - `string`
@ -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,6 +76,7 @@ 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)
@ -84,6 +86,7 @@ Limitations/known issues:
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,6 +97,7 @@ 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
``` ```