mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
Improve documentation
This commit is contained in:
parent
6ea838b9a3
commit
b4036f9f11
26 changed files with 248 additions and 206 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: 59f01b51bca09082ff992b52b6e98cfc
|
||||
config: 72c039d18ea46f966a2534df3d8861fa
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. currentmodule:: royalnet.commands
|
||||
|
||||
Adding a Command to the Pack
|
||||
Creating a new Command
|
||||
====================================
|
||||
|
||||
A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet interface.
|
||||
|
@ -327,7 +327,7 @@ if you want the command to raise an error if the number of results is greater th
|
|||
More Alchemy
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can read more about :mod:`sqlalchemy` at their `website <https://www.sqlalchemy.org/>`_.
|
||||
You can read more about sqlalchemy at their `website <https://www.sqlalchemy.org/>`_.
|
||||
|
||||
Calling Events
|
||||
------------------------------------
|
||||
|
@ -347,4 +347,9 @@ This section is not documented yet.
|
|||
Running repeating jobs
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This section is not documented yet.
|
||||
This section is not documented yet.
|
||||
|
||||
Adding the command to __init__.py
|
||||
---------------------------------------------
|
||||
|
||||
This section is not documented yet.
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
Creating a Royalnet Pack
|
||||
.. currentmodule:: royalnet
|
||||
|
||||
Royalnet Packs
|
||||
====================================
|
||||
|
||||
This section is not documented yet.
|
||||
A **Royalnet Pack** is a Python `module <https://docs.python.org/3/tutorial/modules.html>`_ that can be loaded in a
|
||||
Royalnet instance to add more features, such as more commands, more webpages and more events.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:maxdepth: 1
|
||||
|
||||
newpack
|
||||
command
|
||||
star
|
||||
event
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
||||
VERSION: '5.4a2',
|
||||
VERSION: '5.6.2',
|
||||
LANGUAGE: 'None',
|
||||
COLLAPSE_INDEX: false,
|
||||
BUILDER: 'html',
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>API Reference — Royalnet 5.4a2 documentation</title>
|
||||
<title>API Reference — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">API Reference</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#module-royalnet.alchemy">Alchemy</a></li>
|
||||
|
@ -200,7 +200,7 @@ Check the tables submodule for more details.</p></li>
|
|||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.alchemy.Alchemy.get">
|
||||
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">table: Union[str, type]</em><span class="sig-paren">)</span> → sqlalchemy.sql.schema.Table<a class="headerlink" href="#royalnet.alchemy.Alchemy.get" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param">table: Union[str, type]</em><span class="sig-paren">)</span> → sqlalchemy.ext.declarative.api.DeclarativeMeta<a class="headerlink" href="#royalnet.alchemy.Alchemy.get" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get the table with a specified name or class.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
|
@ -564,6 +564,17 @@ in the format <code class="docutils literal notranslate"><span class="pre">(requ
|
|||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.commands.CommandData.find_user">
|
||||
<em class="property">async </em><code class="sig-name descname">find_user</code><span class="sig-paren">(</span><em class="sig-param">alias: str</em><span class="sig-paren">)</span> → Optional[User]<a class="headerlink" href="#royalnet.commands.CommandData.find_user" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Find the User having a specific Alias.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>alias</strong> – the Alias to search for.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.commands.CommandData.get_author">
|
||||
<em class="property">async </em><code class="sig-name descname">get_author</code><span class="sig-paren">(</span><em class="sig-param">error_if_none: bool = False</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.get_author" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -911,14 +922,9 @@ As is the case with the logging module, it will be started on the first request
|
|||
<code class="sig-name descname">register_events</code><span class="sig-paren">(</span><em class="sig-param">events: List[Type[royalnet.commands.event.Event]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_events" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.constellation.Constellation.register_exc_stars">
|
||||
<code class="sig-name descname">register_exc_stars</code><span class="sig-paren">(</span><em class="sig-param">exc_stars: List[Type[royalnet.constellation.star.ExceptionStar]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_exc_stars" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.constellation.Constellation.register_page_stars">
|
||||
<code class="sig-name descname">register_page_stars</code><span class="sig-paren">(</span><em class="sig-param">page_stars: List[Type[royalnet.constellation.star.PageStar]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_page_stars" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname">register_page_stars</code><span class="sig-paren">(</span><em class="sig-param">page_stars: List[Type[royalnet.constellation.pagestar.PageStar]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Constellation.register_page_stars" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
|
@ -945,13 +951,19 @@ As is the case with the logging module, it will be started on the first request
|
|||
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Starlette</span></code> app.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.constellation.Constellation.stars">
|
||||
<code class="sig-name descname">stars</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.stars" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A list of all the <a class="reference internal" href="#royalnet.constellation.PageStar" title="royalnet.constellation.PageStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">PageStar</span></code></a> registered to this <a class="reference internal" href="#royalnet.constellation.Constellation" title="royalnet.constellation.Constellation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Constellation</span></code></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="royalnet.constellation.Star">
|
||||
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">Star</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.Star" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A Star is a class representing a part of the website.</p>
|
||||
<p>It shouldn’t be used directly: please use <a class="reference internal" href="#royalnet.constellation.PageStar" title="royalnet.constellation.PageStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">PageStar</span></code></a> and <a class="reference internal" href="#royalnet.constellation.ExceptionStar" title="royalnet.constellation.ExceptionStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code></a> instead!</p>
|
||||
<p>It shouldn’t be used directly: please use <a class="reference internal" href="#royalnet.constellation.PageStar" title="royalnet.constellation.PageStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">PageStar</span></code></a> and <code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code> instead!</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.constellation.Star.Session">
|
||||
<em class="property">property </em><code class="sig-name descname">Session</code><a class="headerlink" href="#royalnet.constellation.Star.Session" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -980,7 +992,7 @@ As is the case with the logging module, it will be started on the first request
|
|||
<dt id="royalnet.constellation.Star.page">
|
||||
<em class="property">async </em><code class="sig-name descname">page</code><span class="sig-paren">(</span><em class="sig-param">request: starlette.requests.Request</em><span class="sig-paren">)</span> → starlette.responses.Response<a class="headerlink" href="#royalnet.constellation.Star.page" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The function generating the <code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code> to a web <code class="xref py py-class docutils literal notranslate"><span class="pre">Request</span></code>.</p>
|
||||
<p>If it raises an error, the corresponding <a class="reference internal" href="#royalnet.constellation.ExceptionStar" title="royalnet.constellation.ExceptionStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code></a> will be used to handle the request instead.</p>
|
||||
<p>If it raises an error, the corresponding <code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code> will be used to handle the request instead.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
|
@ -996,7 +1008,7 @@ As is the case with the logging module, it will be started on the first request
|
|||
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">PageStar</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.PageStar" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A PageStar is a class representing a single route of the website (for example, <code class="docutils literal notranslate"><span class="pre">/api/user/get</span></code>).</p>
|
||||
<p>To create a new website route you should create a new class inheriting from this class with a function overriding
|
||||
<a class="reference internal" href="#royalnet.constellation.Star.page" title="royalnet.constellation.Star.page"><code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code></a> and changing the values of <a class="reference internal" href="#royalnet.constellation.PageStar.path" title="royalnet.constellation.PageStar.path"><code class="xref py py-attr docutils literal notranslate"><span class="pre">path</span></code></a> and optionally <a class="reference internal" href="#royalnet.constellation.PageStar.methods" title="royalnet.constellation.PageStar.methods"><code class="xref py py-attr docutils literal notranslate"><span class="pre">methods</span></code></a>.</p>
|
||||
<a class="reference internal" href="#royalnet.constellation.Star.page" title="royalnet.constellation.Star.page"><code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code></a>, <a class="reference internal" href="#royalnet.constellation.PageStar.path" title="royalnet.constellation.PageStar.path"><code class="xref py py-attr docutils literal notranslate"><span class="pre">path</span></code></a> and optionally <a class="reference internal" href="#royalnet.constellation.PageStar.methods" title="royalnet.constellation.PageStar.methods"><code class="xref py py-attr docutils literal notranslate"><span class="pre">methods</span></code></a>.</p>
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.constellation.PageStar.methods">
|
||||
<code class="sig-name descname">methods</code><em class="property"> = ['GET']</em><a class="headerlink" href="#royalnet.constellation.PageStar.methods" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -1020,38 +1032,6 @@ As is the case with the logging module, it will be started on the first request
|
|||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="royalnet.constellation.ExceptionStar">
|
||||
<em class="property">class </em><code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">ExceptionStar</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.ExceptionStar" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>An ExceptionStar is a class that handles an <a class="reference external" href="https://docs.python.org/3.8/library/exceptions.html#Exception" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a> raised by another star by returning a different
|
||||
response than the one originally intended.</p>
|
||||
<p>The handled exception type is specified in the <a class="reference internal" href="#royalnet.constellation.ExceptionStar.error" title="royalnet.constellation.ExceptionStar.error"><code class="xref py py-attr docutils literal notranslate"><span class="pre">error</span></code></a>.</p>
|
||||
<p>It can also handle standard webserver errors, such as <code class="docutils literal notranslate"><span class="pre">404</span> <span class="pre">Not</span> <span class="pre">Found</span></code>:
|
||||
to handle them, set <a class="reference internal" href="#royalnet.constellation.ExceptionStar.error" title="royalnet.constellation.ExceptionStar.error"><code class="xref py py-attr docutils literal notranslate"><span class="pre">error</span></code></a> to an <a class="reference external" href="https://docs.python.org/3.8/library/functions.html#int" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> of the corresponding error code.</p>
|
||||
<p>To create a new exception handler you should create a new class inheriting from this class with a function
|
||||
overriding <a class="reference internal" href="#royalnet.constellation.Star.page" title="royalnet.constellation.Star.page"><code class="xref py py-meth docutils literal notranslate"><span class="pre">page()</span></code></a> and changing the value of <a class="reference internal" href="#royalnet.constellation.ExceptionStar.error" title="royalnet.constellation.ExceptionStar.error"><code class="xref py py-attr docutils literal notranslate"><span class="pre">error</span></code></a>.</p>
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.constellation.ExceptionStar.error">
|
||||
<code class="sig-name descname">error</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.ExceptionStar.error" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The error that should be handled by this star. It should be either a subclass of <a class="reference external" href="https://docs.python.org/3.8/library/exceptions.html#Exception" title="(in Python v3.8)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code></a>,
|
||||
or the <a class="reference external" href="https://docs.python.org/3.8/library/functions.html#int" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> of an HTTP error code.</p>
|
||||
<p class="rubric">Examples</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">error</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">404</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">error</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="ne">Exception</span><span class="p">]</span> <span class="o">=</span> <span class="ne">ValueError</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="royalnet.constellation.shoot">
|
||||
<code class="sig-prename descclassname">royalnet.constellation.</code><code class="sig-name descname">shoot</code><span class="sig-paren">(</span><em class="sig-param">code: int</em>, <em class="sig-param">description: str</em><span class="sig-paren">)</span> → starlette.responses.JSONResponse<a class="headerlink" href="#royalnet.constellation.shoot" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create a error <code class="xref py py-class docutils literal notranslate"><span class="pre">JSONResponse</span></code> with the passed error code and description.</p>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
<div class="section" id="module-royalnet.herald">
|
||||
<span id="herald"></span><h2>Herald<a class="headerlink" href="#module-royalnet.herald" title="Permalink to this headline">¶</a></h2>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Index — Royalnet 5.4a2 documentation</title>
|
||||
<title>Index — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a></li>
|
||||
</ul>
|
||||
|
@ -321,8 +321,6 @@
|
|||
<h2 id="E">E</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="apireference.html#royalnet.constellation.ExceptionStar.error">error (royalnet.constellation.ExceptionStar attribute)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.commands.Event">Event (class in royalnet.commands)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.constellation.Constellation.events">events (royalnet.constellation.Constellation attribute)</a>
|
||||
|
@ -333,8 +331,6 @@
|
|||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="apireference.html#royalnet.constellation.ExceptionStar">ExceptionStar (class in royalnet.constellation)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.utils.MultiLock.exclusive">exclusive() (royalnet.utils.MultiLock method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.commands.ExternalError">ExternalError</a>
|
||||
|
@ -348,6 +344,8 @@
|
|||
<li><a href="apireference.html#royalnet.herald.Server.find_client">find_client() (royalnet.herald.Server method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.herald.Server.find_destination">find_destination() (royalnet.herald.Server method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.commands.CommandData.find_user">find_user() (royalnet.commands.CommandData method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.herald.Config.from_config">from_config() (royalnet.herald.Config class method)</a>
|
||||
</li>
|
||||
|
@ -609,8 +607,6 @@
|
|||
<li><a href="apireference.html#royalnet.serf.Serf.register_events">(royalnet.serf.Serf method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="apireference.html#royalnet.constellation.Constellation.register_exc_stars">register_exc_stars() (royalnet.constellation.Constellation method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.constellation.Constellation.register_page_stars">register_page_stars() (royalnet.constellation.Constellation method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.commands.CommandData.reply">reply() (royalnet.commands.CommandData method)</a>
|
||||
|
@ -635,10 +631,10 @@
|
|||
</li>
|
||||
<li><a href="apireference.html#module-royalnet.alchemy">royalnet.alchemy (module)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="apireference.html#module-royalnet.backpack">royalnet.backpack (module)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="apireference.html#module-royalnet.bard">royalnet.bard (module)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#module-royalnet.commands">royalnet.commands (module)</a>
|
||||
|
@ -724,14 +720,14 @@
|
|||
<li><a href="apireference.html#royalnet.commands.CommandData.session_commit">session_commit() (royalnet.commands.CommandData method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.bard.YtdlFile.set_ytdlinfo_from_id3_tags">set_ytdlinfo_from_id3_tags() (royalnet.bard.YtdlFile method)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.constellation.shoot">shoot() (in module royalnet.constellation)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.utils.sleep_until">sleep_until() (in module royalnet.utils)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.constellation.Star">Star (class in royalnet.constellation)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.constellation.Constellation.starlette">starlette (royalnet.constellation.Constellation attribute)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.constellation.Constellation.stars">stars (royalnet.constellation.Constellation attribute)</a>
|
||||
</li>
|
||||
<li><a href="apireference.html#royalnet.commands.Command.syntax">syntax (royalnet.commands.Command attribute)</a>
|
||||
</li>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Royalnet — Royalnet 5.4a2 documentation</title>
|
||||
<title>Royalnet — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
<link rel="stylesheet" href="_static/rygdocs.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Creating a Royalnet Pack" href="packs/pack.html" />
|
||||
<link rel="next" title="Royalnet Packs" href="packs/pack.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a></li>
|
||||
</ul>
|
||||
|
@ -157,55 +157,9 @@
|
|||
<p>Welcome to the documentation of Royalnet!</p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="packs/command.html">Adding a Command to the Pack</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#creating-a-new-command">Creating a new Command</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#command-arguments">Command arguments</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#direct-access">Direct access</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#optional-access">Optional access</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#full-string">Full string</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#regular-expressions">Regular expressions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#raising-errors">Raising errors</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#coroutines-and-slow-operations">Coroutines and slow operations</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#delete-the-invoking-message">Delete the invoking message</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#using-the-database">Using the database</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#querying-the-database">Querying the database</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#adding-filters-to-the-query">Adding filters to the query</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#ordering-the-results-of-a-query">Ordering the results of a query</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#fetching-the-results-of-a-query">Fetching the results of a query</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#more-alchemy">More Alchemy</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#calling-events">Calling Events</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#displaying-keyboards">Displaying Keyboards</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="packs/command.html#running-code-at-the-initialization-of-the-bot">Running code at the initialization of the bot</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="packs/command.html#running-repeating-jobs">Running repeating jobs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="packs/star.html">Adding a Star to the Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="packs/event.html">Using Events</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="packs/table.html">Using Tables and databases</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="randomdiscoveries.html#discord-websocket-undocumented-error-codes">Discord websocket undocumented error codes</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.alchemy">Alchemy</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.backpack">Backpack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.bard">Bard</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.commands">Commands</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.constellation">Constellation</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.herald">Herald</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.serf">Serf</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.utils">Utils</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="some-useful-links">
|
||||
|
@ -225,7 +179,7 @@
|
|||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="packs/pack.html" class="btn btn-neutral float-right" title="Creating a Royalnet Pack" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
<a href="packs/pack.html" class="btn btn-neutral float-right" title="Royalnet Packs" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Adding a Command to the Pack — Royalnet 5.4a2 documentation</title>
|
||||
<title>Creating a new Command — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="Adding a Star to the Pack" href="star.html" />
|
||||
<link rel="prev" title="Creating a Royalnet Pack" href="pack.html" />
|
||||
<link rel="prev" title="Creating a new Pack" href="newpack.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -86,9 +86,10 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Creating a Royalnet Pack</a><ul class="current">
|
||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Adding a Command to the Pack</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#creating-a-new-command">Creating a new Command</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Royalnet Packs</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="newpack.html">Creating a new Pack</a></li>
|
||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Creating a new Command</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#id1">Creating a new Command</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#command-arguments">Command arguments</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#direct-access">Direct access</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#optional-access">Optional access</a></li>
|
||||
|
@ -113,6 +114,7 @@
|
|||
<li class="toctree-l4"><a class="reference internal" href="#running-repeating-jobs">Running repeating jobs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#adding-the-command-to-init-py">Adding the command to __init__.py</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="star.html">Adding a Star to the Pack</a></li>
|
||||
|
@ -167,9 +169,9 @@
|
|||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="pack.html">Creating a Royalnet Pack</a> »</li>
|
||||
<li><a href="pack.html">Royalnet Packs</a> »</li>
|
||||
|
||||
<li>Adding a Command to the Pack</li>
|
||||
<li>Creating a new Command</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
@ -188,8 +190,8 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="adding-a-command-to-the-pack">
|
||||
<h1>Adding a Command to the Pack<a class="headerlink" href="#adding-a-command-to-the-pack" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="creating-a-new-command">
|
||||
<h1>Creating a new Command<a class="headerlink" href="#creating-a-new-command" title="Permalink to this headline">¶</a></h1>
|
||||
<p>A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet interface.</p>
|
||||
<p>A Command code looks like this:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">royalnet.commands</span> <span class="k">as</span> <span class="nn">rc</span>
|
||||
|
@ -208,8 +210,8 @@
|
|||
<span class="k">await</span> <span class="n">data</span><span class="o">.</span><span class="n">reply</span><span class="p">(</span><span class="s2">"Pong!"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="section" id="creating-a-new-command">
|
||||
<h2>Creating a new Command<a class="headerlink" href="#creating-a-new-command" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="id1">
|
||||
<h2>Creating a new Command<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
|
||||
<p>First, think of a <code class="docutils literal notranslate"><span class="pre">name</span></code> for your command.
|
||||
It’s the name your command will be called with: for example, the “spaghetti” command will be called by typing <strong>/spaghetti</strong> in chat.
|
||||
Try to keep the name as short as possible, while staying specific enough so no other command will have the same name.</p>
|
||||
|
@ -482,7 +484,7 @@ if you want the command to raise an error if the number of results is greater th
|
|||
</div>
|
||||
<div class="section" id="more-alchemy">
|
||||
<h3>More Alchemy<a class="headerlink" href="#more-alchemy" title="Permalink to this headline">¶</a></h3>
|
||||
<p>You can read more about <code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlalchemy</span></code> at their <a class="reference external" href="https://www.sqlalchemy.org/">website</a>.</p>
|
||||
<p>You can read more about sqlalchemy at their <a class="reference external" href="https://www.sqlalchemy.org/">website</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="calling-events">
|
||||
|
@ -501,6 +503,10 @@ if you want the command to raise an error if the number of results is greater th
|
|||
<p>This section is not documented yet.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="adding-the-command-to-init-py">
|
||||
<h2>Adding the command to __init__.py<a class="headerlink" href="#adding-the-command-to-init-py" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This section is not documented yet.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -514,7 +520,7 @@ if you want the command to raise an error if the number of results is greater th
|
|||
<a href="star.html" class="btn btn-neutral float-right" title="Adding a Star to the Pack" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="pack.html" class="btn btn-neutral float-left" title="Creating a Royalnet Pack" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
<a href="newpack.html" class="btn btn-neutral float-left" title="Creating a new Pack" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Using Events — Royalnet 5.4a2 documentation</title>
|
||||
<title>Using Events — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -86,8 +86,9 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Creating a Royalnet Pack</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Adding a Command to the Pack</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Royalnet Packs</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="newpack.html">Creating a new Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Creating a new Command</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="star.html">Adding a Star to the Pack</a></li>
|
||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Using Events</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="table.html">Using Tables and databases</a></li>
|
||||
|
@ -140,7 +141,7 @@
|
|||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="pack.html">Creating a Royalnet Pack</a> »</li>
|
||||
<li><a href="pack.html">Royalnet Packs</a> »</li>
|
||||
|
||||
<li>Using Events</li>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Creating a Royalnet Pack — Royalnet 5.4a2 documentation</title>
|
||||
<title>Royalnet Packs — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
<link rel="stylesheet" href="../_static/rygdocs.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="Adding a Command to the Pack" href="command.html" />
|
||||
<link rel="next" title="Creating a new Pack" href="newpack.html" />
|
||||
<link rel="prev" title="Royalnet" href="../index.html" />
|
||||
</head>
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -86,8 +86,9 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Creating a Royalnet Pack</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Adding a Command to the Pack</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Royalnet Packs</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="newpack.html">Creating a new Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Creating a new Command</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="star.html">Adding a Star to the Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="event.html">Using Events</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="table.html">Using Tables and databases</a></li>
|
||||
|
@ -140,7 +141,7 @@
|
|||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li>Creating a Royalnet Pack</li>
|
||||
<li>Royalnet Packs</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
@ -159,39 +160,14 @@
|
|||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="creating-a-royalnet-pack">
|
||||
<h1>Creating a Royalnet Pack<a class="headerlink" href="#creating-a-royalnet-pack" title="Permalink to this headline">¶</a></h1>
|
||||
<p>This section is not documented yet.</p>
|
||||
<div class="section" id="royalnet-packs">
|
||||
<h1>Royalnet Packs<a class="headerlink" href="#royalnet-packs" title="Permalink to this headline">¶</a></h1>
|
||||
<p>A <strong>Royalnet Pack</strong> is a Python <a class="reference external" href="https://docs.python.org/3/tutorial/modules.html">module</a> that can be loaded in a
|
||||
Royalnet instance to add more features, such as more commands, more webpages and more events.</p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="command.html">Adding a Command to the Pack</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#creating-a-new-command">Creating a new Command</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#command-arguments">Command arguments</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#direct-access">Direct access</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#optional-access">Optional access</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#full-string">Full string</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#regular-expressions">Regular expressions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#raising-errors">Raising errors</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#coroutines-and-slow-operations">Coroutines and slow operations</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#delete-the-invoking-message">Delete the invoking message</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#using-the-database">Using the database</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#querying-the-database">Querying the database</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#adding-filters-to-the-query">Adding filters to the query</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#ordering-the-results-of-a-query">Ordering the results of a query</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#fetching-the-results-of-a-query">Fetching the results of a query</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#more-alchemy">More Alchemy</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#calling-events">Calling Events</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#displaying-keyboards">Displaying Keyboards</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html#running-code-at-the-initialization-of-the-bot">Running code at the initialization of the bot</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="command.html#running-repeating-jobs">Running repeating jobs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="newpack.html">Creating a new Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="command.html">Creating a new Command</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="star.html">Adding a Star to the Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="event.html">Using Events</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="table.html">Using Tables and databases</a></li>
|
||||
|
@ -207,7 +183,7 @@
|
|||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="command.html" class="btn btn-neutral float-right" title="Adding a Command to the Pack" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
<a href="newpack.html" class="btn btn-neutral float-right" title="Creating a new Pack" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="../index.html" class="btn btn-neutral float-left" title="Royalnet" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Adding a Star to the Pack — Royalnet 5.4a2 documentation</title>
|
||||
<title>Adding a Star to the Pack — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="Using Events" href="event.html" />
|
||||
<link rel="prev" title="Adding a Command to the Pack" href="command.html" />
|
||||
<link rel="prev" title="Creating a new Command" href="command.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -86,8 +86,9 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Creating a Royalnet Pack</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Adding a Command to the Pack</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Royalnet Packs</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="newpack.html">Creating a new Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Creating a new Command</a></li>
|
||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Adding a Star to the Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="event.html">Using Events</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="table.html">Using Tables and databases</a></li>
|
||||
|
@ -140,7 +141,7 @@
|
|||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="pack.html">Creating a Royalnet Pack</a> »</li>
|
||||
<li><a href="pack.html">Royalnet Packs</a> »</li>
|
||||
|
||||
<li>Adding a Star to the Pack</li>
|
||||
|
||||
|
@ -177,7 +178,7 @@
|
|||
<a href="event.html" class="btn btn-neutral float-right" title="Using Events" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="command.html" class="btn btn-neutral float-left" title="Adding a Command to the Pack" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
<a href="command.html" class="btn btn-neutral float-left" title="Creating a new Command" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Using Tables and databases — Royalnet 5.4a2 documentation</title>
|
||||
<title>Using Tables and databases — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -86,8 +86,9 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Creating a Royalnet Pack</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Adding a Command to the Pack</a></li>
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="pack.html">Royalnet Packs</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="newpack.html">Creating a new Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="command.html">Creating a new Command</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="star.html">Adding a Star to the Pack</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="event.html">Using Events</a></li>
|
||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Using Tables and databases</a></li>
|
||||
|
@ -140,7 +141,7 @@
|
|||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="pack.html">Creating a Royalnet Pack</a> »</li>
|
||||
<li><a href="pack.html">Royalnet Packs</a> »</li>
|
||||
|
||||
<li>Using Tables and databases</li>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Python Module Index — Royalnet 5.4a2 documentation</title>
|
||||
<title>Python Module Index — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
|||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Random discoveries — Royalnet 5.4a2 documentation</title>
|
||||
<title>Random discoveries — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
|||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Random discoveries</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#discord-websocket-undocumented-error-codes">Discord websocket undocumented error codes</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Search — Royalnet 5.4a2 documentation</title>
|
||||
<title>Search — Royalnet 5.6.2 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
|
||||
<div class="version">
|
||||
5.4a2
|
||||
5.6.2
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Creating a Royalnet Pack</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="packs/pack.html">Royalnet Packs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="randomdiscoveries.html">Random discoveries</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a></li>
|
||||
</ul>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ Royalnet
|
|||
Welcome to the documentation of Royalnet!
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:maxdepth: 1
|
||||
|
||||
packs/pack
|
||||
randomdiscoveries
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. currentmodule:: royalnet.commands
|
||||
|
||||
Adding a Command to the Pack
|
||||
Creating a new Command
|
||||
====================================
|
||||
|
||||
A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet interface.
|
||||
|
@ -327,7 +327,7 @@ if you want the command to raise an error if the number of results is greater th
|
|||
More Alchemy
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can read more about :mod:`sqlalchemy` at their `website <https://www.sqlalchemy.org/>`_.
|
||||
You can read more about sqlalchemy at their `website <https://www.sqlalchemy.org/>`_.
|
||||
|
||||
Calling Events
|
||||
------------------------------------
|
||||
|
@ -347,4 +347,9 @@ This section is not documented yet.
|
|||
Running repeating jobs
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This section is not documented yet.
|
||||
This section is not documented yet.
|
||||
|
||||
Adding the command to __init__.py
|
||||
---------------------------------------------
|
||||
|
||||
This section is not documented yet.
|
||||
|
|
109
docs_source/packs/newpack.rst
Normal file
109
docs_source/packs/newpack.rst
Normal file
|
@ -0,0 +1,109 @@
|
|||
Creating a new Pack
|
||||
====================================
|
||||
|
||||
Prerequisites
|
||||
------------------------------------
|
||||
|
||||
You'll need to have `Python 3.8 <https://www.python.org/downloads/release/python-382/>`_ and `poetry <https://github.com/python-poetry/poetry>`_
|
||||
to develop Royalnet Packs.
|
||||
|
||||
Creating the repository
|
||||
------------------------------------
|
||||
|
||||
To create a new pack, create a new repository based on the `Royalnet Pack template <https://github.com/Steffo99/royalnet-pack-template>`_
|
||||
and clone it to your workspace.
|
||||
|
||||
pyproject.toml
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``pyproject.toml`` file contains information about your Python project that will be read by ``poetry`` while building
|
||||
the pack and publishing it to PyPI.
|
||||
|
||||
Choose a name for your Pack and set it in the ``tool.property.name`` field: ::
|
||||
|
||||
[tool.poetry]
|
||||
# TODO: Insert here your Pack name!
|
||||
name = "pastapack"
|
||||
# ...
|
||||
|
||||
Follow the instructions in the other ``# TODO`` comments to finish editing the file.
|
||||
|
||||
examplepack
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``examplepack`` folder contains the source code of your pack, and should be renamed to the name you set in the ``pyproject.toml`` file.
|
||||
|
||||
It should contain a ``version.py`` file and six folders: ::
|
||||
|
||||
examplepack
|
||||
├── commands
|
||||
├── events
|
||||
├── stars
|
||||
├── tables
|
||||
├── types
|
||||
├── utils
|
||||
└── version.py
|
||||
|
||||
version.py
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``version.py`` file contains the version number of your pack.
|
||||
|
||||
If you changed the ``version`` field in the ``pyproject.toml`` file, change the value of ``semantic`` in ``version.py`` to the same value.
|
||||
|
||||
Remember to use `semantic versioning <https://semver.org/>`_! ::
|
||||
|
||||
semantic = "1.0.0"
|
||||
|
||||
The commands folder
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The commands folder should contain all commands that your Pack will add to the Royalnet instances it is installed in.
|
||||
|
||||
To learn how to create a new :class:`~commands.Command`, read the :doc:`command` page.
|
||||
|
||||
The events folder
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The events folder should contain all events (remote procedure calls) that your Pack will add to the Royalnet instances it is installed in.
|
||||
|
||||
To learn how to create a new :class:`~commands.Event`, read the :doc:`event` page.
|
||||
|
||||
The stars folder
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The stars folder should contain all stars (webserver routes) that your Pack will add to the Royalnet instances it is installed in.
|
||||
|
||||
To learn how to create a new :class:`~constellation.PageStar`, read the :doc:`star` page.
|
||||
|
||||
The tables folder
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The tables folder should contain all Alchemy tables (SQLAlchemy-compatible SQL tables) that your Pack will add to the Royalnet instances it is installed in.
|
||||
|
||||
To learn how to create a new table, read the :doc:`table` page.
|
||||
|
||||
The utils folder
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The utils folder should contain the utility functions and classes that your Pack uses.
|
||||
|
||||
Its contents are imported **before** the commands, events and stars but **after** the tables, so **you can't import them** in the files contained in the ``tables`` folder, or you will create a `circular import <https://stackabuse.com/python-circular-imports/>`_!
|
||||
|
||||
Files in this folder are **forbidden from importing modules** from the ``commands``, ``events`` and ``stars`` folders, as that will create a circular import too.
|
||||
|
||||
The types folder
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The types folder should contain the enums and custom types that are used in your tables.
|
||||
|
||||
Please note that the contents of this folder are imported **before** everything else in the pack.
|
||||
|
||||
Its contents **can be imported anywhere** in the Pack, including the ``tables`` folder, without creating a circular import.
|
||||
|
||||
However, its files are **forbidden from importing anything else** from the rest of the pack!
|
||||
|
||||
Publishing the pack
|
||||
------------------------------------
|
||||
|
||||
This section is not documented yet.
|
|
@ -1,11 +1,15 @@
|
|||
Creating a Royalnet Pack
|
||||
.. currentmodule:: royalnet
|
||||
|
||||
Royalnet Packs
|
||||
====================================
|
||||
|
||||
This section is not documented yet.
|
||||
A **Royalnet Pack** is a Python `module <https://docs.python.org/3/tutorial/modules.html>`_ that can be loaded in a
|
||||
Royalnet instance to add more features, such as more commands, more webpages and more events.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:maxdepth: 1
|
||||
|
||||
newpack
|
||||
command
|
||||
star
|
||||
event
|
||||
|
|
Loading…
Reference in a new issue