From e0c8a39d6734672342ca36f0fcfc149348d16838 Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 5 Mar 2021 17:25:16 +0100 Subject: [PATCH] Updated references and added LICENSE. --- LICENSE | 21 ++++++++++++ README.md | 17 +++++++--- module-development/settings.md | 61 +++++++++++++++++++++------------- 3 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bb311f8 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index 4865780..8068b9d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 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 @@ -15,38 +15,44 @@ 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` file inside, that describes what your category is about and lists the category's files by adding this line: + ``` {% include list.liquid all=true %} ``` 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: + ```yaml --- title: Your title # other front matter definitions --- + ``` To sort a category's pages, add a `sort` property to the pages' front matter section: + ```yaml --- # other front matter definitions sort: --- + ``` ## Updating the documentation website Before pushing your edits to the documentation, you may want to see what they look like. To do so, you need to: + - 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` -- install this project's specific requirements: +- install this project's specific requirements: `bundle install` (or `bundle update` if you already built it before) -- run Jekyll: +- run Jekyll: `bundle exec jekyll serve` - open the address that is returned on the terminal in your browser (usually `http://127.0.0.1:4000/`) @@ -63,4 +69,5 @@ repo. - GH Pages: [Github Pages docs](https://docs.github.com/en/github/working-with-github-pages/setting-up-a-github-pages-site-with-jekyll) - Generator: [Jekyll docs](https://jekyllrb.com/docs/) - Theme: [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/) and - [rundocs.io](https://rundocs.io/) \ No newline at end of file + [rundocs.io](https://rundocs.io/) + diff --git a/module-development/settings.md b/module-development/settings.md index 3d7eb36..ce03777 100644 --- a/module-development/settings.md +++ b/module-development/settings.md @@ -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, pages, and other elements by importing the right procedures. - ## Adding a new settings page 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. First import `createItem`: + ```js import { createItem } from '@goosemod/settings'; ``` Then in your module's `onLoadingFinished`, call to `createItem` like this: + ```js -createItem("Page name", [ - "version", +createItem('Page name', [ + 'version', // field objects ]); ``` @@ -47,15 +48,16 @@ restore the state of Discord prior to when it was enabled. removing one is even easier. First add `removeItem` to your imports from `@goosemod/settings`: + ```js import { createItem, removeItem } from '@goosemod/settings'; ``` Then in your module's `onRemove`, call to `removeItem` like so: -```js -removeItem("Page name"); -``` +```js +removeItem('Page name'); +``` ## 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 needed, for example: precising the default values of your settings. The way you would define a fields subtext is like so: + ```js { // field definition elements @@ -77,19 +80,20 @@ you would define a fields subtext is like so: 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: + ```js { - type: "divider" + type: 'divider'; } ``` ```note -Divider fields **do not** use the `subtext` property. However they have a +Divider fields **do not** use the `subtext` property. However they have a `text` property. ``` ```warning -The divider field's `text` property has not yet been experimented with +The divider field's `text` property has not yet been experimented with and documented. ``` @@ -97,6 +101,7 @@ and documented. Header fields let you make categories in your settings page, they are defined like so: + ```js { type: "header", @@ -111,6 +116,7 @@ Header fields do not use the `subtext` property. ### Text field Text fields let you write text without user controls, they are defined like so: + ```js { 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 like so: + ```js { type: "button", @@ -137,9 +144,9 @@ Buttons do not use the `subtext` property. ``` ```note -Button fields are pretty bare and only simple buttons. If you use them, you may -want to add a [text field](#text-field) before to explain their function and a -[divider field](#divider-field) afterwards to properly separate them from the +Button fields are pretty bare and only simple buttons. If you use them, you may +want to add a [text field](#text-field) before to explain their function and a +[divider field](#divider-field) afterwards to properly separate them from the following fields. ``` @@ -151,7 +158,8 @@ Given that button fields are so bare, I'd recommend using #### Text-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 { type: "text-and-button", @@ -164,7 +172,7 @@ They are defined like so: ``` ```note -Unlike [button fields](#button-field), text-button fields include a +Unlike [button fields](#button-field), text-button fields include a [divider field](#divider-field), so you don't need to add one after. ``` @@ -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 the danger styling (red). They are defined like so: + ```js { type: "text-and-danger-button", @@ -184,7 +193,7 @@ the danger styling (red). They are defined like so: ``` ```note -Due to the design language surrounding them, you should only use these if the +Due to the design language surrounding them, you should only use these if the action could have impactful consequences. ``` @@ -192,6 +201,7 @@ action could have impactful consequences. Toggle fields let you make on/off switches for your basic settings, they are defined like so: + ```js { type: "toggle", @@ -211,6 +221,7 @@ defined like so: 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). They are defined like so: + ```js { type: "toggle-text-button", @@ -229,10 +240,11 @@ They are defined like so: } ``` -#### Toggle-Text-Button-Danger +#### Toggle-Text-Button-Danger Exactly like the [toggle-text-button field](#toggle-text-button-field), but the button has the danger styling (red). They are defined like so: + ```js { type: "toggle-text-danger-button", @@ -252,7 +264,7 @@ the button has the danger styling (red). They are defined like so: ``` ```note -Due to the design language surrounding them, you should only use these if the +Due to the design language surrounding them, you should only use these if the action could have impactful consequences. ``` @@ -260,6 +272,7 @@ action could have impactful consequences. Colour fields let you make colour pickers for your settings, they are defined like so: + ```js { type: "text-and-color", @@ -281,25 +294,26 @@ The colour picker doesn't support alpha channel (opacity) yet. ### Card field ```warning -Not yet experimented with or documented. +Not yet experimented with or documented. ``` ### Search field ```warning -Not yet experimented with or documented. +Not yet experimented with or documented. ``` ### Sidebar field ```warning -Not yet experimented with or documented. +Not yet experimented with or documented. ``` ### Custom field Custom fields only support a single property: `element`. They are defined like so: + ```js { type: "custom", @@ -313,6 +327,7 @@ so: ``` ```note -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). -``` \ No newline at end of file +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/NovaGM/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57). +``` +