Add help @help topic for admin documentation
This commit is contained in:
parent
e361050b93
commit
129541743f
2 changed files with 41 additions and 0 deletions
31
content/help/@help.toml
Normal file
31
content/help/@help.toml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
name = "@help"
|
||||||
|
title = "help system administration"
|
||||||
|
admin = true
|
||||||
|
body = """
|
||||||
|
the help system stores topics as TOML files in content/help/.
|
||||||
|
each topic has a name, title, optional admin flag, and body text.
|
||||||
|
|
||||||
|
commands
|
||||||
|
@help list all help topics
|
||||||
|
@help create create a new topic (guided)
|
||||||
|
@help create <name> create a new topic with the given name
|
||||||
|
@help edit <topic> edit an existing topic
|
||||||
|
@help remove <topic> remove a topic
|
||||||
|
|
||||||
|
creating topics
|
||||||
|
@help create walks you through each field:
|
||||||
|
name the topic name (what players type after 'help')
|
||||||
|
title short description shown in listings
|
||||||
|
admin only whether only admins can view it
|
||||||
|
body the help text (opens in the editor)
|
||||||
|
|
||||||
|
editing topics
|
||||||
|
@help edit shows current values for each field.
|
||||||
|
press enter to keep the current value.
|
||||||
|
the editor opens with the existing body text.
|
||||||
|
|
||||||
|
files
|
||||||
|
topics are stored in content/help/<name>.toml
|
||||||
|
they can also be edited directly with any text editor.
|
||||||
|
changes are loaded at server startup.
|
||||||
|
"""
|
||||||
|
|
@ -251,3 +251,13 @@ async def test_at_help_remove_prompts_confirmation(admin_player):
|
||||||
await commands.dispatch(admin_player, "@help remove combat")
|
await commands.dispatch(admin_player, "@help remove combat")
|
||||||
output = "".join(c[0][0] for c in admin_player.writer.write.call_args_list)
|
output = "".join(c[0][0] for c in admin_player.writer.write.call_args_list)
|
||||||
assert "y/n" in output.lower() or "confirm" in output.lower()
|
assert "y/n" in output.lower() or "confirm" in output.lower()
|
||||||
|
|
||||||
|
|
||||||
|
def test_at_help_toml_loads_from_content():
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
help_dir = Path(__file__).resolve().parents[1] / "content" / "help"
|
||||||
|
if help_dir.exists():
|
||||||
|
topics = load_help_topics(help_dir)
|
||||||
|
assert "@help" in topics
|
||||||
|
assert topics["@help"].admin is True
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue