From d61d5c001ab1a9fa23741215d601b8ccde9a9df5 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 11 Mar 2020 16:23:08 +0100 Subject: [PATCH] Improve documentation --- docs/html/_sources/index.rst.txt | 2 +- docs_source/packs/command.rst | 19 +++++++++++++------ docs_source/packs/newpack.rst | 13 ++++++++++++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/docs/html/_sources/index.rst.txt b/docs/html/_sources/index.rst.txt index 1e5a928f..4e36cbb3 100644 --- a/docs/html/_sources/index.rst.txt +++ b/docs/html/_sources/index.rst.txt @@ -4,7 +4,7 @@ Royalnet Welcome to the documentation of Royalnet! .. toctree:: - :maxdepth: 5 + :maxdepth: 1 packs/pack randomdiscoveries diff --git a/docs_source/packs/command.rst b/docs_source/packs/command.rst index c8e2efc4..84cfef68 100644 --- a/docs_source/packs/command.rst +++ b/docs_source/packs/command.rst @@ -62,7 +62,19 @@ To send a message in the chat the command was called in, you can use the :meth:` async def run(self, args: rc.CommandArgs, data: rc.CommandData): await data.reply("🍝") -And... it's done! The command is ready to be :doc:`added to your pack `! +Finally, open the ``commands/__init__.py`` file, and import your command there, then add a reference to your imported +command to the ``available_commands`` list: :: + + # Imports go here! + from .spaghetti import SpaghettiCommand + + # Enter the commands of your Pack here! + available_commands = [ + SpaghettiCommand, + ] + + # Don't change this, it should automatically generate __all__ + __all__ = [command.__name__ for command in available_commands] Command arguments ------------------------------------ @@ -348,8 +360,3 @@ Running repeating jobs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This section is not documented yet. - -Adding the command to __init__.py ---------------------------------------------- - -This section is not documented yet. diff --git a/docs_source/packs/newpack.rst b/docs_source/packs/newpack.rst index d2bef3d6..c3f4e07a 100644 --- a/docs_source/packs/newpack.rst +++ b/docs_source/packs/newpack.rst @@ -13,6 +13,8 @@ Creating the repository To create a new pack, create a new repository based on the `Royalnet Pack template `_ and clone it to your workspace. +After cloning the template, run ``poetry install`` to install the dependencies for the pack, creating the ``poetry.lock`` file. + pyproject.toml ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -103,7 +105,16 @@ Its contents **can be imported anywhere** in the Pack, including the ``tables`` However, its files are **forbidden from importing anything else** from the rest of the pack! +Adding new dependencies to the Pack +------------------------------------ + +As the Pack is actually a Python package, you can use ``poetry`` (or ``pip``) to add new dependencies! + +Use ``poetry add packagename`` to add and install a new dependency from the PyPI. + Publishing the pack ------------------------------------ -This section is not documented yet. +To publish your Pack on the PyPI, run ``poetry build``, then ``poetry publish``. + +Poetry will build your Pack and upload it to the PyPI for you. \ No newline at end of file