Updated references and added LICENSE.

This commit is contained in:
Keanu Timmermans 2021-03-05 17:25:16 +01:00
parent 0e9d900311
commit e0c8a39d67
Signed by: keanucode
GPG Key ID: A7431C0D513CA93B
3 changed files with 71 additions and 28 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 NovaGM Members
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -2,7 +2,7 @@
User-made documentation for [GooseMod](https://goosemod.com). User-made documentation for [GooseMod](https://goosemod.com).
[View the documentation](https://keanugoosemod.github.io/Documentation). [View the documentation](https://novagm.github.io/Documentation).
## Adding content ## Adding content
@ -15,32 +15,38 @@ To add a page, add a MarkDown `.md` file to one of the categories
You can also add your own category by adding a directory with a `README.md` You can also add your own category by adding a directory with a `README.md`
file inside, that describes what your category is about and lists the file inside, that describes what your category is about and lists the
category's files by adding this line: category's files by adding this line:
``` ```
{% include list.liquid all=true %} {% include list.liquid all=true %}
``` ```
By default Jekyll will pull the first title as the page's title, but that can By default Jekyll will pull the first title as the page's title, but that can
be overwritten with front matter at the top of your page: be overwritten with front matter at the top of your page:
```yaml ```yaml
--- ---
title: Your title title: Your title
# other front matter definitions # other front matter definitions
--- ---
``` ```
To sort a category's pages, add a `sort` property to the pages' front matter To sort a category's pages, add a `sort` property to the pages' front matter
section: section:
```yaml ```yaml
--- ---
# other front matter definitions # other front matter definitions
sort: <number> sort: <number>
--- ---
``` ```
## Updating the documentation website ## Updating the documentation website
Before pushing your edits to the documentation, you may want to see what they Before pushing your edits to the documentation, you may want to see what they
look like. To do so, you need to: look like. To do so, you need to:
- have a local [Ruby](https://www.ruby-lang.org) environment - have a local [Ruby](https://www.ruby-lang.org) environment
- install the `bundler` and `jekyll` gems - install the `bundler` and `jekyll` gems
`gem install bundler jekyll` `gem install bundler jekyll`
@ -64,3 +70,4 @@ repo.
- Generator: [Jekyll docs](https://jekyllrb.com/docs/) - Generator: [Jekyll docs](https://jekyllrb.com/docs/)
- Theme: [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/) and - Theme: [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/) and
[rundocs.io](https://rundocs.io/) [rundocs.io](https://rundocs.io/)

View File

@ -11,7 +11,6 @@ The GooseMod settings interface can be accessed in your modules by importing
`@goosemod/settings`. You can extend Discord's settings with more categories, `@goosemod/settings`. You can extend Discord's settings with more categories,
pages, and other elements by importing the right procedures. pages, and other elements by importing the right procedures.
## Adding a new settings page ## Adding a new settings page
When GooseMod loads all modules, it first creates a new category called When GooseMod loads all modules, it first creates a new category called
@ -26,14 +25,16 @@ Do remember to remove the settings pages you add when your module gets disabled
though. though.
First import `createItem`: First import `createItem`:
```js ```js
import { createItem } from '@goosemod/settings'; import { createItem } from '@goosemod/settings';
``` ```
Then in your module's `onLoadingFinished`, call to `createItem` like this: Then in your module's `onLoadingFinished`, call to `createItem` like this:
```js ```js
createItem("Page name", [ createItem('Page name', [
"version", 'version',
// field objects // field objects
]); ]);
``` ```
@ -47,15 +48,16 @@ restore the state of Discord prior to when it was enabled.
removing one is even easier. removing one is even easier.
First add `removeItem` to your imports from `@goosemod/settings`: First add `removeItem` to your imports from `@goosemod/settings`:
```js ```js
import { createItem, removeItem } from '@goosemod/settings'; import { createItem, removeItem } from '@goosemod/settings';
``` ```
Then in your module's `onRemove`, call to `removeItem` like so: Then in your module's `onRemove`, call to `removeItem` like so:
```js
removeItem("Page name");
```
```js
removeItem('Page name');
```
## Types of settings fields ## Types of settings fields
@ -65,6 +67,7 @@ a `text` property defining the field's text.
Most fields also have a `subtext` property to add additional information if Most fields also have a `subtext` property to add additional information if
needed, for example: precising the default values of your settings. The way needed, for example: precising the default values of your settings. The way
you would define a fields subtext is like so: you would define a fields subtext is like so:
```js ```js
{ {
// field definition elements // field definition elements
@ -77,9 +80,10 @@ you would define a fields subtext is like so:
A simple divider to separate your fields. Most other fields already add a A simple divider to separate your fields. Most other fields already add a
divider, so needing one is a more specific use case. They are defined like so: divider, so needing one is a more specific use case. They are defined like so:
```js ```js
{ {
type: "divider" type: 'divider';
} }
``` ```
@ -97,6 +101,7 @@ and documented.
Header fields let you make categories in your settings page, they are defined Header fields let you make categories in your settings page, they are defined
like so: like so:
```js ```js
{ {
type: "header", type: "header",
@ -111,6 +116,7 @@ Header fields do not use the `subtext` property.
### Text field ### Text field
Text fields let you write text without user controls, they are defined like so: Text fields let you write text without user controls, they are defined like so:
```js ```js
{ {
type: "text", type: "text",
@ -122,6 +128,7 @@ Text fields let you write text without user controls, they are defined like so:
Button fields let you add simple buttons to launch actions, they are defined Button fields let you add simple buttons to launch actions, they are defined
like so: like so:
```js ```js
{ {
type: "button", type: "button",
@ -152,6 +159,7 @@ Given that button fields are so bare, I'd recommend using
A regular [text field](#text-field) with a smaller [button](#button-field). A regular [text field](#text-field) with a smaller [button](#button-field).
They are defined like so: They are defined like so:
```js ```js
{ {
type: "text-and-button", type: "text-and-button",
@ -172,6 +180,7 @@ Unlike [button fields](#button-field), text-button fields include a
Exactly like the [text-button field](#text-button-field), but the button has Exactly like the [text-button field](#text-button-field), but the button has
the danger styling (red). They are defined like so: the danger styling (red). They are defined like so:
```js ```js
{ {
type: "text-and-danger-button", type: "text-and-danger-button",
@ -192,6 +201,7 @@ action could have impactful consequences.
Toggle fields let you make on/off switches for your basic settings, they are Toggle fields let you make on/off switches for your basic settings, they are
defined like so: defined like so:
```js ```js
{ {
type: "toggle", type: "toggle",
@ -211,6 +221,7 @@ defined like so:
A [toggle field](#toggle-field) with a small [button](#button-field), or a A [toggle field](#toggle-field) with a small [button](#button-field), or a
[text-button field](#text-button-field) with a [toggle switch](#toggle-field). [text-button field](#text-button-field) with a [toggle switch](#toggle-field).
They are defined like so: They are defined like so:
```js ```js
{ {
type: "toggle-text-button", type: "toggle-text-button",
@ -233,6 +244,7 @@ They are defined like so:
Exactly like the [toggle-text-button field](#toggle-text-button-field), but Exactly like the [toggle-text-button field](#toggle-text-button-field), but
the button has the danger styling (red). They are defined like so: the button has the danger styling (red). They are defined like so:
```js ```js
{ {
type: "toggle-text-danger-button", type: "toggle-text-danger-button",
@ -260,6 +272,7 @@ action could have impactful consequences.
Colour fields let you make colour pickers for your settings, they are defined Colour fields let you make colour pickers for your settings, they are defined
like so: like so:
```js ```js
{ {
type: "text-and-color", type: "text-and-color",
@ -300,6 +313,7 @@ Not yet experimented with or documented.
Custom fields only support a single property: `element`. They are defined like Custom fields only support a single property: `element`. They are defined like
so: so:
```js ```js
{ {
type: "custom", type: "custom",
@ -314,5 +328,6 @@ so:
```note ```note
Custom fields can be used to make any kind of field that is not built into Custom fields can be used to make any kind of field that is not built into
GooseMod. For example, [here is a procedure building a text input field](https://github.com/KeanuGooseMod/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57). GooseMod. For example, [here is a procedure building a text input field](https://github.com/NovaGM/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57).
``` ```