Settings
Architus bot settings are dynamically rendered, consumed, and validated based off of a JSON schema as detailed below.
GET/settings/{guild_id}
Requires authentication
Gets the settings schema data for the current server.
At the highest level, the Settings schema is composed of an array of category definitions, each of which contain one or more settings cards:
{
"categories": [
...
]
}
The reasoning behind having a top-level organization scheme of the category
is to support a view that looks something like the following mockup, where multiple vertical sections would be possible, enabling large collections of settings
to be effectively categorized.
Field | Type | Description |
---|---|---|
title? | string | if non-null, then this category will appear separate from the global category |
cards | array of setting card objects | child cards within the category |
Each card is configured individually, representing a collection of individual settings that fall under a given topic.
Field | Type | Description |
---|---|---|
title | string | title string that appears at the top of the card once rendered |
settings | array of setting objects | individual settings fields that are listed once rendered, ordered from top to bottom |
{
"title": "Gulag",
"settings": [
{
"key": "gulag_command",
"label": "Command",
"input_type": "string",
"default": "gulag"
},
...
]
}
In order to be consumed on both the backend and the frontend, each Setting object contains a variety of information related to each setting entry.
Field | Type | Description |
---|---|---|
key | string | internal unique key used to access the setting across the application |
label | string | display text shown to the left of each setting (Fewer than 25 characters) |
input_type | string enum | type of input component used on the frontend. One of ["string", "numeric", "string_auto-complete", "string_highlighted", "switch", "array_auto-complete"] |
default | any | initial value of the setting used for newly initialized guilds |
value | any | current value of the setting |
help_tooltip? | string | text content of an optional HelpTooltip component |
properties? | object | key-value pairs passed as props to the input component |
validation_steps? | array of Union<string, validation objects> | chain of validation steps necessary for the setting value to pass, ran on both the frontend and backend, unless otherwise specified (see object information). If a string, then the value represents the key of the individual step |
cli? | cli object | if non-null, then includes the individual setting in the list of settings that can be edited in the Discord client using the !settings /?settings command |
{
"key": "starboard_threshold",
"label": "Starboard Threshold",
"input_type": "numeric",
"default": 5,
"value": 6,
"properties": {
"min": 0,
"integer": true
},
"validation_steps": [
"isNumber",
"isInteger",
{ "key": "isInRange", "args": { "min": 0 } }
],
"cli": {
"name": "Starboard Threshold",
"emote": "⭐",
"message": "⭐ This is the number of reacts a message...",
"input_mode": "replace"
}
}