mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-10-23 06:12:19 +00:00
feat(website): Include local commands in generated HTML (#287)
* feat(website): Include local commands when generating website Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com> * feat(website): Disabled commands are excluded from generated HTML Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com> * Updated CHANGELOG.md Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com> * fix(website): resolve enablement through the bot's own config helpers The generated page is meant to list what the bot actually answers, so it has to read the config the same way the bot does. Three places where it did not: The local `config.ini` overlay was never read. `read_config` parsed only the base file, while the bot overlays `<local_dir_path>/config.ini` on top of it, and that overlay is exactly where the web viewer saves a local plugin's settings. A local command disabled from the settings page still showed up on the site. `is_command_enabled` derived the section name and the legacy `enabled` spellings by hand, duplicating `BaseCommand._derive_config_section_name` and guessing that a legacy key lives in the command's own section. Half of them do not: `[Jokes] joke_enabled` disables `Joke_Command`. It now calls `command_section_name` and `read_enabled`, which share the alias table with the runtime and the settings UI. That table was missing the same-section `[Joke_Command] joke_enabled` and `[DadJoke_Command] dadjoke_enabled` spellings, which both commands accept through their own fallback. The settings page read only the `[Jokes]` form, so a bot disabled the same-section way displayed as enabled. Also fold the duplicated local-commands-dir resolution into `resolve_local_commands_dir`, take `bot_root` as a `MinimalBot` argument instead of assigning it post-construction twice, and restore the `hidden` attribute check that `generate_samples` lost when it moved to `filter_commands`. --------- Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com> Co-authored-by: agessaman <adam@gessaman.com>
This commit is contained in:
1 parent
258c9680b2
commit
af05c2ef7f
5 files changed
+343
-17
No files matched your search
@@ -10,6 +10,16 @@ python generate_website.py [config.ini]
|
||||
|
||||
This reads your config (default: `config.ini`), loads your commands and channels, and writes **`website/index.html`** in the same directory as the config file. Upload that file (and the directory if you use assets) to your web host.
|
||||
|
||||
## Which commands get listed
|
||||
|
||||
The page lists what your bot actually answers:
|
||||
|
||||
- **Local commands are included.** Any command installed under `[Bot] local_dir_path` (default `local/commands`) appears alongside the built-in ones.
|
||||
- **Disabled commands are omitted.** A command turned off with `enabled = false` in its `[*_Command]` section is left out, including the legacy spellings such as `[Jokes] joke_enabled`.
|
||||
- **The local config overlay is read.** Settings saved from the web viewer's plugin settings page land in `<local_dir_path>/config.ini`, and the generator reads that on top of your base config just as the bot does.
|
||||
|
||||
Admin-only, hidden, and keyword-less commands are never listed.
|
||||
|
||||
## Choose a style
|
||||
|
||||
The `--style` option selects a theme (colors, typography, layout). Default is `default` (modern dark). To see all themes:
|
||||
|
||||
Reference in new issue
Block a user