-
Notifications
You must be signed in to change notification settings - Fork 0
Dashboard Config Editor
This page explains how to make your plugin config editable in Athena's dashboard using a dashboard schema file.
For a config named hello, you need both files:
- /plugins/<plugin_name>/data/configs/en-hello.json5
- /plugins/<plugin_name>/data/dashboard/en-hello.json
If the dashboard schema file is missing, your config is still loaded, but it is not editable in the dashboard config editor.
ㅤ
To make your config editable in the dashboard, add the dashboardConfigurable: true flag to your config interface constructor:
const helloConfig = new this.heart.core.discord.core.config.interface(
this.heart,
{ name: 'hello', plugin: this.getName(), dashboardConfigurable: true }, // Add this flag
{
config: {
// your config structure
}
},
);Without this flag, even if you provide a dashboard schema file, your config will not appear in the dashboard config editor. This flag is required to enable dashboard integration for your config.
ㅤ
Your dashboard schema file maps config keys to UI field definitions.
{
"bot_name": {
"type": 0,
"name": "Bot Name",
"description": "Display name used by your plugin",
"autocomplete": []
},
"bot": {
"type": 2,
"name": "Bot Enabled",
"description": "Enable or disable plugin features globally",
"autocomplete": [true, false]
}
}Common field settings:
- name: UI label shown in the editor
- description: Help text under the field
- extra: Optional markdown details shown in the info popover
- autocomplete: Suggested values for supported field types
ㅤ
The dashboard supports many built-in types. For custom plugin schemas, the most common are:
- type 0: string input
- type 1: number input
- type 2: boolean toggle/choice
- type 3: array of strings
- type 4: array of numbers
- type 5: array of booleans
- type 10: This type is used to define a new group of related settings
- type 1000: array of objects (schema-driven)
- type 1001: dynamic object where each key maps to an array of schema-driven objects
- type 1002: dynamic object where each key maps to a single object (schema-driven)
For type 1000, 1001, and 1002 schema fields, the current dashboard mapping is:
-
0=> string -
1=> string -
2=> number -
3=> boolean -
5=> array (tags)
ㅤ
Use this when users should add multiple objects with one fixed structure.
{
"dashboard_panels": {
"type": 1000,
"name": "Dashboard Panels",
"schema": {
"name": { "type": 0, "label": "Panel Name", "placeholder": "Welcome" },
"channel_id": { "type": 0, "label": "Channel ID", "placeholder": "000000000000000000" },
"enabled": { "type": 3, "label": "Enabled" },
"tags": { "type": 5, "label": "Tags", "placeholder": "Type and press Enter" }
},
"autocomplete": []
}
}Use this when users should create named groups and each group contains an array of objects.
{
"alert_rules": {
"type": 1001,
"name": "Alert Rules",
"value_schema": {
"schema": {
"role_id": { "type": 0, "label": "Role ID" },
"threshold": { "type": 2, "label": "Threshold" },
"enabled": { "type": 3, "label": "Enabled" },
"notes": { "type": 5, "label": "Notes" }
}
},
"autocomplete": []
}
}Use this when users should create named groups and each group contains a single configured object (not an array).
{
"service_configs": {
"type": 1002,
"name": "Service Configurations",
"value_schema": {
"schema": {
"api_key": { "type": 0, "label": "API Key" },
"endpoint": { "type": 0, "label": "Endpoint URL" },
"timeout": { "type": 2, "label": "Timeout (ms)" },
"enabled": { "type": 3, "label": "Enabled" }
}
}
}
}Data structure:
service_configs: {
"service_a": {
api_key: "key123",
endpoint: "https://api.example.com",
timeout: 5000,
enabled: true
},
"service_b": {
api_key: "key456",
endpoint: "https://api2.example.com",
timeout: 3000,
enabled: false
}
}ㅤ
Your data/configs/en-hello.json5 defaults and data/dashboard/en-hello.json schema should describe the same keys.
For example:
- schema key dashboard_panels should exist in default config as config.dashboard_panels
- schema key alert_rules should exist in default config as config.alert_rules
If key names diverge, the editor can show empty values or reject edits.