1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Fix a bug?

This commit is contained in:
Steffo 2019-10-17 15:39:34 +02:00
parent 4a07afe72b
commit 457926e351
12 changed files with 28 additions and 1909 deletions

Binary file not shown.

Binary file not shown.

View file

@ -5,66 +5,7 @@ These pages were automatically generated from docstrings in code.
They might be outdated, or incomplete. They might be outdated, or incomplete.
Audio .. automodule:: royalnet
------------------------------------
.. automodule:: royalnet.audio
:members:
:undoc-members:
:private-members:
Bots
------------------------------------
.. automodule:: royalnet.bots
:members:
:undoc-members:
:private-members:
Commands
------------------------------------
.. automodule:: royalnet.commands
:members:
:undoc-members:
:private-members:
Database
------------------------------------
.. automodule:: royalnet.database
:members:
:undoc-members:
:private-members:
Network
------------------------------------
.. automodule:: royalnet.network
:members:
:undoc-members:
:private-members:
Utils
------------------------------------
.. automodule:: royalnet.utils
:members:
:undoc-members:
:private-members:
Web
------------------------------------
.. automodule:: royalnet.web
:members:
:undoc-members:
:private-members:
Error
------------------------------------
.. automodule:: royalnet.error
:members: :members:
:undoc-members: :undoc-members:
:private-members: :private-members:

View file

@ -5170,7 +5170,7 @@ jQuery.event = {
} }
} }
// Remove common event handler if we removed something and no more handlers exist // Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers) // (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) { if ( origCount && !handlers.length ) {
if ( !special.teardown || if ( !special.teardown ||

File diff suppressed because it is too large Load diff

View file

@ -199,7 +199,7 @@ Its the name your command will be called with: for example, the “spaghetti
Try to keep the name as short as possible, while staying specific enough so no other command will have the same name.</p> Try to keep the name as short as possible, while staying specific enough so no other command will have the same name.</p>
<p>Next, create a new Python file with the <code class="docutils literal notranslate"><span class="pre">name</span></code> you have thought of. <p>Next, create a new Python file with the <code class="docutils literal notranslate"><span class="pre">name</span></code> you have thought of.
The previously mentioned “spaghetti” command should have a file called <code class="docutils literal notranslate"><span class="pre">spaghetti.py</span></code>.</p> The previously mentioned “spaghetti” command should have a file called <code class="docutils literal notranslate"><span class="pre">spaghetti.py</span></code>.</p>
<p>Then, in the first row of the file, import the <a class="reference internal" href="apireference.html#royalnet.commands.Command" title="royalnet.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> class from royalnet, and create a new class inheriting from it:</p> <p>Then, in the first row of the file, import the <code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code> class from royalnet, and create a new class inheriting from it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">royalnet.commands</span> <span class="k">import</span> <span class="n">Command</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">royalnet.commands</span> <span class="k">import</span> <span class="n">Command</span>
<span class="k">class</span> <span class="nc">SpaghettiCommand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span> <span class="k">class</span> <span class="nc">SpaghettiCommand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
@ -215,8 +215,8 @@ The previously mentioned “spaghetti” command should have a file called <code
<span class="n">description</span> <span class="o">=</span> <span class="s2">&quot;Send a spaghetti emoji in the chat.&quot;</span> <span class="n">description</span> <span class="o">=</span> <span class="s2">&quot;Send a spaghetti emoji in the chat.&quot;</span>
</pre></div> </pre></div>
</div> </div>
<p>Now override the <a class="reference internal" href="apireference.html#royalnet.commands.Command.run" title="royalnet.commands.Command.run"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.run()</span></code></a> method, adding the code you want the bot to run when the command is called.</p> <p>Now override the <code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.run()</span></code> method, adding the code you want the bot to run when the command is called.</p>
<p>To send a message in the chat the command was called in, you can use the <a class="reference internal" href="apireference.html#royalnet.commands.CommandData.reply" title="royalnet.commands.CommandData.reply"><code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandData.reply()</span></code></a> method:</p> <p>To send a message in the chat the command was called in, you can use the <code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandData.reply()</span></code> method:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">royalnet.commands</span> <span class="k">import</span> <span class="n">Command</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">royalnet.commands</span> <span class="k">import</span> <span class="n">Command</span>
<span class="k">class</span> <span class="nc">SpaghettiCommand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span> <span class="k">class</span> <span class="nc">SpaghettiCommand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
@ -234,7 +234,7 @@ The previously mentioned “spaghetti” command should have a file called <code
<h2>Command arguments<a class="headerlink" href="#command-arguments" title="Permalink to this headline"></a></h2> <h2>Command arguments<a class="headerlink" href="#command-arguments" title="Permalink to this headline"></a></h2>
<p>A command can have some arguments passed by the user: for example, on Telegram an user may type <cite>/spaghetti carbonara al-dente</cite> <p>A command can have some arguments passed by the user: for example, on Telegram an user may type <cite>/spaghetti carbonara al-dente</cite>
to pass the <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> <cite>“carbonara al-dente”</cite> to the command code.</p> to pass the <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> <cite>“carbonara al-dente”</cite> to the command code.</p>
<p>These arguments can be accessed in multiple ways through the <code class="docutils literal notranslate"><span class="pre">args</span></code> parameter passed to the <a class="reference internal" href="apireference.html#royalnet.commands.Command.run" title="royalnet.commands.Command.run"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.run()</span></code></a> <p>These arguments can be accessed in multiple ways through the <code class="docutils literal notranslate"><span class="pre">args</span></code> parameter passed to the <code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.run()</span></code>
method.</p> method.</p>
<p>If you want your command to use arguments, override the <code class="docutils literal notranslate"><span class="pre">syntax</span></code> class attribute with a brief description of the <p>If you want your command to use arguments, override the <code class="docutils literal notranslate"><span class="pre">syntax</span></code> class attribute with a brief description of the
syntax of your command, possibly using (round parentheses) for required arguments and [square brackets] for optional syntax of your command, possibly using (round parentheses) for required arguments and [square brackets] for optional
@ -271,7 +271,7 @@ ones.</p>
</div> </div>
<div class="section" id="optional-access"> <div class="section" id="optional-access">
<h3>Optional access<a class="headerlink" href="#optional-access" title="Permalink to this headline"></a></h3> <h3>Optional access<a class="headerlink" href="#optional-access" title="Permalink to this headline"></a></h3>
<p>If you dont want arguments to be required, you can access them through the <a class="reference internal" href="apireference.html#royalnet.commands.CommandArgs.optional" title="royalnet.commands.CommandArgs.optional"><code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandArgs.optional()</span></code></a> method: it <p>If you dont want arguments to be required, you can access them through the <code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandArgs.optional()</span></code> method: it
will return <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code> if the argument wasnt passed, making it <strong>optional</strong>.</p> will return <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code> if the argument wasnt passed, making it <strong>optional</strong>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">optional</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">optional</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="c1"># &quot;carbonara&quot;</span> <span class="c1"># &quot;carbonara&quot;</span>
@ -291,12 +291,12 @@ will return <code class="xref py py-const docutils literal notranslate"><span cl
</div> </div>
<div class="section" id="full-string"> <div class="section" id="full-string">
<h3>Full string<a class="headerlink" href="#full-string" title="Permalink to this headline"></a></h3> <h3>Full string<a class="headerlink" href="#full-string" title="Permalink to this headline"></a></h3>
<p>If you want the full argument string, you can use the <a class="reference internal" href="apireference.html#royalnet.commands.CommandArgs.joined" title="royalnet.commands.CommandArgs.joined"><code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandArgs.joined()</span></code></a> method.</p> <p>If you want the full argument string, you can use the <code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandArgs.joined()</span></code> method.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">joined</span><span class="p">()</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">joined</span><span class="p">()</span>
<span class="c1"># &quot;carbonara al-dente&quot;</span> <span class="c1"># &quot;carbonara al-dente&quot;</span>
</pre></div> </pre></div>
</div> </div>
<p>You can specify a minimum number of arguments too, so that an <a class="reference internal" href="apireference.html#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> will be <p>You can specify a minimum number of arguments too, so that an <code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code> will be
raised if not enough arguments are present:</p> raised if not enough arguments are present:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">joined</span><span class="p">(</span><span class="n">require_at_least</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">joined</span><span class="p">(</span><span class="n">require_at_least</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="c1"># InvalidInputError() is raised</span> <span class="c1"># InvalidInputError() is raised</span>
@ -306,8 +306,8 @@ raised if not enough arguments are present:</p>
<div class="section" id="regular-expressions"> <div class="section" id="regular-expressions">
<h3>Regular expressions<a class="headerlink" href="#regular-expressions" title="Permalink to this headline"></a></h3> <h3>Regular expressions<a class="headerlink" href="#regular-expressions" title="Permalink to this headline"></a></h3>
<p>For more complex commands, you may want to get arguments through <a class="reference external" href="https://regexr.com/">regular expressions</a>.</p> <p>For more complex commands, you may want to get arguments through <a class="reference external" href="https://regexr.com/">regular expressions</a>.</p>
<p>You can then use the <a class="reference internal" href="apireference.html#royalnet.commands.CommandArgs.match" title="royalnet.commands.CommandArgs.match"><code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandArgs.match()</span></code></a> method, which tries to match a pattern to the command argument string, <p>You can then use the <code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandArgs.match()</span></code> method, which tries to match a pattern to the command argument string,
which returns a tuple of the matched groups and raises an <a class="reference internal" href="apireference.html#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> if there is no match.</p> which returns a tuple of the matched groups and raises an <code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code> if there is no match.</p>
<p>To match a pattern, <a class="reference external" href="https://docs.python.org/3.7/library/re.html#re.match" title="(in Python v3.7)"><code class="xref py py-func docutils literal notranslate"><span class="pre">re.match()</span></code></a> is used, meaning that Python will try to match only at the beginning of the string.</p> <p>To match a pattern, <a class="reference external" href="https://docs.python.org/3.7/library/re.html#re.match" title="(in Python v3.7)"><code class="xref py py-func docutils literal notranslate"><span class="pre">re.match()</span></code></a> is used, meaning that Python will try to match only at the beginning of the string.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;(carb\w+)&quot;</span><span class="p">)</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">args</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;(carb\w+)&quot;</span><span class="p">)</span>
<span class="c1"># (&quot;carbonara&quot;,)</span> <span class="c1"># (&quot;carbonara&quot;,)</span>
@ -326,18 +326,18 @@ which returns a tuple of the matched groups and raises an <a class="reference in
</div> </div>
<div class="section" id="raising-errors"> <div class="section" id="raising-errors">
<h2>Raising errors<a class="headerlink" href="#raising-errors" title="Permalink to this headline"></a></h2> <h2>Raising errors<a class="headerlink" href="#raising-errors" title="Permalink to this headline"></a></h2>
<p>If you want to display an error message to the user, you can raise a <a class="reference internal" href="apireference.html#royalnet.commands.CommandError" title="royalnet.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> using the error message as argument:</p> <p>If you want to display an error message to the user, you can raise a <code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code> using the error message as argument:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="ow">not</span> <span class="n">kitchen</span><span class="o">.</span><span class="n">is_open</span><span class="p">():</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="ow">not</span> <span class="n">kitchen</span><span class="o">.</span><span class="n">is_open</span><span class="p">():</span>
<span class="k">raise</span> <span class="n">CommandError</span><span class="p">(</span><span class="s2">&quot;The kitchen is closed. Come back later!&quot;</span><span class="p">)</span> <span class="k">raise</span> <span class="n">CommandError</span><span class="p">(</span><span class="s2">&quot;The kitchen is closed. Come back later!&quot;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
<p>You can also manually raise <a class="reference internal" href="apireference.html#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> to redisplay the command syntax, along with your error message:</p> <p>You can also manually raise <code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code> to redisplay the command syntax, along with your error message:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">allowed_pasta</span><span class="p">:</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">allowed_pasta</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InvalidInputError</span><span class="p">(</span><span class="s2">&quot;The specified pasta type is invalid.&quot;</span><span class="p">)</span> <span class="k">raise</span> <span class="n">InvalidInputError</span><span class="p">(</span><span class="s2">&quot;The specified pasta type is invalid.&quot;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
<p>If you need a Royalnet feature thats not available on the current interface, you can raise an <p>If you need a Royalnet feature thats not available on the current interface, you can raise an
<a class="reference internal" href="apireference.html#royalnet.commands.UnsupportedError" title="royalnet.commands.UnsupportedError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnsupportedError</span></code></a> with a brief description of whats missing:</p> <code class="xref py py-exc docutils literal notranslate"><span class="pre">UnsupportedError</span></code> with a brief description of whats missing:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">interface</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="s2">&quot;telegram&quot;</span><span class="p">:</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">interface</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="s2">&quot;telegram&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="s2">&quot;This command can only be run on Telegram interfaces.&quot;</span><span class="p">)</span> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="s2">&quot;This command can only be run on Telegram interfaces.&quot;</span><span class="p">)</span>
</pre></div> </pre></div>
@ -346,7 +346,7 @@ which returns a tuple of the matched groups and raises an <a class="reference in
<div class="section" id="running-code-at-the-initialization-of-the-bot"> <div class="section" id="running-code-at-the-initialization-of-the-bot">
<h2>Running code at the initialization of the bot<a class="headerlink" href="#running-code-at-the-initialization-of-the-bot" title="Permalink to this headline"></a></h2> <h2>Running code at the initialization of the bot<a class="headerlink" href="#running-code-at-the-initialization-of-the-bot" title="Permalink to this headline"></a></h2>
<p>You can run code while the bot is starting by overriding the <code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.__init__()</span></code> function.</p> <p>You can run code while the bot is starting by overriding the <code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.__init__()</span></code> function.</p>
<p>You should keep the <code class="docutils literal notranslate"><span class="pre">super().__init__(interface)</span></code> call at the start of it, so that the <a class="reference internal" href="apireference.html#royalnet.commands.Command" title="royalnet.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> instance is <p>You should keep the <code class="docutils literal notranslate"><span class="pre">super().__init__(interface)</span></code> call at the start of it, so that the <code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code> instance is
initialized properly, then add your code after it.</p> initialized properly, then add your code after it.</p>
<p>You can add fields to the command to keep <strong>shared data between multiple command calls</strong> (but not bot restarts): it may <p>You can add fields to the command to keep <strong>shared data between multiple command calls</strong> (but not bot restarts): it may
be useful for fetching external static data and keeping it until the bot is restarted, or to store references to all the be useful for fetching external static data and keeping it until the bot is restarted, or to store references to all the
@ -377,7 +377,7 @@ be useful for fetching external static data and keeping it until the bot is rest
<div class="section" id="coroutines-and-slow-operations"> <div class="section" id="coroutines-and-slow-operations">
<h2>Coroutines and slow operations<a class="headerlink" href="#coroutines-and-slow-operations" title="Permalink to this headline"></a></h2> <h2>Coroutines and slow operations<a class="headerlink" href="#coroutines-and-slow-operations" title="Permalink to this headline"></a></h2>
<p>You may have noticed that in the previous examples we used <code class="docutils literal notranslate"><span class="pre">await</span> <span class="pre">data.reply(&quot;🍝&quot;)</span></code> instead of just <code class="docutils literal notranslate"><span class="pre">data.reply(&quot;🍝&quot;)</span></code>.</p> <p>You may have noticed that in the previous examples we used <code class="docutils literal notranslate"><span class="pre">await</span> <span class="pre">data.reply(&quot;🍝&quot;)</span></code> instead of just <code class="docutils literal notranslate"><span class="pre">data.reply(&quot;🍝&quot;)</span></code>.</p>
<p>This is because <a class="reference internal" href="apireference.html#royalnet.commands.CommandData.reply" title="royalnet.commands.CommandData.reply"><code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandData.reply()</span></code></a> isnt a simple method: it is a coroutine, a special kind of function that <p>This is because <code class="xref py py-meth docutils literal notranslate"><span class="pre">CommandData.reply()</span></code> isnt a simple method: it is a coroutine, a special kind of function that
can be executed separately from the rest of the code, allowing the bot to do other things in the meantime.</p> can be executed separately from the rest of the code, allowing the bot to do other things in the meantime.</p>
<p>By adding the <code class="docutils literal notranslate"><span class="pre">await</span></code> keyword before the <code class="docutils literal notranslate"><span class="pre">data.reply(&quot;🍝&quot;)</span></code>, we tell the bot that it can do other things, like <p>By adding the <code class="docutils literal notranslate"><span class="pre">await</span></code> keyword before the <code class="docutils literal notranslate"><span class="pre">data.reply(&quot;🍝&quot;)</span></code>, we tell the bot that it can do other things, like
receiving new messages, while the message is being sent.</p> receiving new messages, while the message is being sent.</p>
@ -389,7 +389,7 @@ are finished and may cause bugs in other parts of the code!</p>
<span class="o">...</span> <span class="o">...</span>
</pre></div> </pre></div>
</div> </div>
<p>If the slow function you want does not cause any side effect, you can wrap it with the <a class="reference internal" href="apireference.html#royalnet.utils.asyncify" title="royalnet.utils.asyncify"><code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.utils.asyncify()</span></code></a> <p>If the slow function you want does not cause any side effect, you can wrap it with the <code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.utils.asyncify()</span></code>
function:</p> function:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="c1"># If the called function has no side effect, you can do this!</span> <span class="c1"># If the called function has no side effect, you can do this!</span>
@ -404,7 +404,7 @@ a coroutine that does the same exact thing.</p>
<h2>Delete the invoking message<a class="headerlink" href="#delete-the-invoking-message" title="Permalink to this headline"></a></h2> <h2>Delete the invoking message<a class="headerlink" href="#delete-the-invoking-message" title="Permalink to this headline"></a></h2>
<p>The invoking message of a command is the message that the user sent that the bot recognized as a command; for example, <p>The invoking message of a command is the message that the user sent that the bot recognized as a command; for example,
the message <code class="docutils literal notranslate"><span class="pre">/spaghetti</span> <span class="pre">carbonara</span></code> is the invoking message for the <code class="docutils literal notranslate"><span class="pre">spaghetti</span></code> command run.</p> the message <code class="docutils literal notranslate"><span class="pre">/spaghetti</span> <span class="pre">carbonara</span></code> is the invoking message for the <code class="docutils literal notranslate"><span class="pre">spaghetti</span></code> command run.</p>
<p>You can have the bot delete the invoking message for a command by calling the <a class="reference internal" href="apireference.html#royalnet.commands.CommandData.delete_invoking" title="royalnet.commands.CommandData.delete_invoking"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandData.delete_invoking</span></code></a> <p>You can have the bot delete the invoking message for a command by calling the <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandData.delete_invoking</span></code>
method:</p> method:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="k">await</span> <span class="n">data</span><span class="o">.</span><span class="n">delete_invoking</span><span class="p">()</span> <span class="k">await</span> <span class="n">data</span><span class="o">.</span><span class="n">delete_invoking</span><span class="p">()</span>
@ -427,13 +427,13 @@ to True:</p>
<div class="section" id="using-the-database"> <div class="section" id="using-the-database">
<h2>Using the database<a class="headerlink" href="#using-the-database" title="Permalink to this headline"></a></h2> <h2>Using the database<a class="headerlink" href="#using-the-database" title="Permalink to this headline"></a></h2>
<p>Bots can be connected to a PostgreSQL database through a special SQLAlchemy interface called <p>Bots can be connected to a PostgreSQL database through a special SQLAlchemy interface called
<a class="reference internal" href="apireference.html#royalnet.database.Alchemy" title="royalnet.database.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code></a>.</p> <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code>.</p>
<p>If the connection is established, the <code class="docutils literal notranslate"><span class="pre">self.interface.alchemy</span></code> and <code class="docutils literal notranslate"><span class="pre">self.interface.session</span></code> fields will be <p>If the connection is established, the <code class="docutils literal notranslate"><span class="pre">self.interface.alchemy</span></code> and <code class="docutils literal notranslate"><span class="pre">self.interface.session</span></code> fields will be
available for use in commands.</p> available for use in commands.</p>
<p><code class="docutils literal notranslate"><span class="pre">self.interface.alchemy</span></code> is an instance of <a class="reference internal" href="apireference.html#royalnet.database.Alchemy" title="royalnet.database.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code></a>, which contains the <p><code class="docutils literal notranslate"><span class="pre">self.interface.alchemy</span></code> is an instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code>, which contains the
<a class="reference external" href="https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.Engine" title="(in SQLAlchemy v1.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">sqlalchemy.engine.Engine</span></code></a>, metadata and tables, while <code class="docutils literal notranslate"><span class="pre">self.interface.session</span></code> is a <a class="reference external" href="https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.Engine" title="(in SQLAlchemy v1.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">sqlalchemy.engine.Engine</span></code></a>, metadata and tables, while <code class="docutils literal notranslate"><span class="pre">self.interface.session</span></code> is a
<a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/session_api.html#sqlalchemy.orm.session.Session" title="(in SQLAlchemy v1.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">sqlalchemy.orm.session.Session</span></code></a>, and can be interacted in the same way as one.</p> <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/session_api.html#sqlalchemy.orm.session.Session" title="(in SQLAlchemy v1.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">sqlalchemy.orm.session.Session</span></code></a>, and can be interacted in the same way as one.</p>
<p>If you want to use <a class="reference internal" href="apireference.html#royalnet.database.Alchemy" title="royalnet.database.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code></a> in your command, you should override the <p>If you want to use <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code> in your command, you should override the
<code class="docutils literal notranslate"><span class="pre">require_alchemy_tables</span></code> field with the <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#set" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">set</span></code></a> of Alchemy tables you need.</p> <code class="docutils literal notranslate"><span class="pre">require_alchemy_tables</span></code> field with the <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#set" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">set</span></code></a> of Alchemy tables you need.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">royalnet.commands</span> <span class="k">import</span> <span class="n">Command</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">royalnet.commands</span> <span class="k">import</span> <span class="n">Command</span>
<span class="kn">from</span> <span class="nn">royalnet.database.tables</span> <span class="k">import</span> <span class="n">Royal</span> <span class="kn">from</span> <span class="nn">royalnet.database.tables</span> <span class="k">import</span> <span class="n">Royal</span>
@ -453,7 +453,7 @@ available for use in commands.</p>
<div class="section" id="querying-the-database"> <div class="section" id="querying-the-database">
<h3>Querying the database<a class="headerlink" href="#querying-the-database" title="Permalink to this headline"></a></h3> <h3>Querying the database<a class="headerlink" href="#querying-the-database" title="Permalink to this headline"></a></h3>
<p>You can <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query" title="(in SQLAlchemy v1.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query</span></code></a> the database using the SQLAlchemy ORM.</p> <p>You can <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query" title="(in SQLAlchemy v1.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query</span></code></a> the database using the SQLAlchemy ORM.</p>
<p>The SQLAlchemy tables can be found inside <a class="reference internal" href="apireference.html#royalnet.database.Alchemy" title="royalnet.database.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code></a> with the same name they were created <p>The SQLAlchemy tables can be found inside <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.Alchemy</span></code> with the same name they were created
from, if they were specified in <code class="docutils literal notranslate"><span class="pre">require_alchemy_tables</span></code>.</p> from, if they were specified in <code class="docutils literal notranslate"><span class="pre">require_alchemy_tables</span></code>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">RoyalTable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">interface</span><span class="o">.</span><span class="n">alchemy</span><span class="o">.</span><span class="n">Royal</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">RoyalTable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">interface</span><span class="o">.</span><span class="n">alchemy</span><span class="o">.</span><span class="n">Royal</span>
<span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">interface</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">RoyalTable</span><span class="p">)</span> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">interface</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">RoyalTable</span><span class="p">)</span>
@ -487,7 +487,7 @@ from, if they were specified in <code class="docutils literal notranslate"><span
<p>You can fetch the query results with the <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.all" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.all()</span></code></a>, <p>You can fetch the query results with the <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.all" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.all()</span></code></a>,
<a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.first" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.first()</span></code></a>, <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.one" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.one()</span></code></a> and <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.first" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.first()</span></code></a>, <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.one" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.one()</span></code></a> and
<a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.one_or_none" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.one_or_none()</span></code></a> methods.</p> <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.one_or_none" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.one_or_none()</span></code></a> methods.</p>
<p>Remember to use <a class="reference internal" href="apireference.html#royalnet.utils.asyncify" title="royalnet.utils.asyncify"><code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.utils.asyncify()</span></code></a> when fetching results, as it may take a while!</p> <p>Remember to use <code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.utils.asyncify()</span></code> when fetching results, as it may take a while!</p>
<p>Use <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.all" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.all()</span></code></a> if you want a <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#list" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <strong>all results</strong>:</p> <p>Use <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.all" title="(in SQLAlchemy v1.3)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlalchemy.orm.query.Query.all()</span></code></a> if you want a <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#list" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <strong>all results</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">results</span><span class="p">:</span> <span class="nb">list</span> <span class="o">=</span> <span class="k">await</span> <span class="n">asyncify</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">)</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">results</span><span class="p">:</span> <span class="nb">list</span> <span class="o">=</span> <span class="k">await</span> <span class="n">asyncify</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">)</span>
</pre></div> </pre></div>

View file

@ -150,585 +150,8 @@
<h1 id="index">Index</h1> <h1 id="index">Index</h1>
<div class="genindex-jumpbox"> <div class="genindex-jumpbox">
<a href="#_"><strong>_</strong></a>
| <a href="#A"><strong>A</strong></a>
| <a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#D"><strong>D</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#H"><strong>H</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#J"><strong>J</strong></a>
| <a href="#K"><strong>K</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#O"><strong>O</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#U"><strong>U</strong></a>
| <a href="#Y"><strong>Y</strong></a>
</div> </div>
<h2 id="_">_</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandArgs.__getitem__">__getitem__() (royalnet.commands.CommandArgs method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlInfo.__init__">__init__() (royalnet.audio.YtdlInfo method)</a>
<ul>
<li><a href="apireference.html#royalnet.database.Alchemy.__init__">(royalnet.database.Alchemy method)</a>
</li>
<li><a href="apireference.html#royalnet.network.Package.__init__">(royalnet.network.Package method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.DiscordBot._bot_factory">_bot_factory() (royalnet.bots.DiscordBot method)</a>
</li>
<li><a href="apireference.html#royalnet.database.Alchemy._create_tables">_create_tables() (royalnet.database.Alchemy method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot._data_factory">_data_factory() (royalnet.bots.DiscordBot method)</a>
<ul>
<li><a href="apireference.html#royalnet.bots.GenericBot._data_factory">(royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot._data_factory">(royalnet.bots.TelegramBot method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.audio.YtdlFile._default_ytdl_args">_default_ytdl_args (royalnet.audio.YtdlFile attribute)</a>
<ul>
<li><a href="apireference.html#royalnet.audio.YtdlInfo._default_ytdl_args">(royalnet.audio.YtdlInfo attribute)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.TelegramBot._handle_callback_query">_handle_callback_query() (royalnet.bots.TelegramBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot._handle_message">_handle_message() (royalnet.bots.TelegramBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot._handle_update">_handle_update() (royalnet.bots.TelegramBot method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.bots.DiscordBot._init_client">_init_client() (royalnet.bots.DiscordBot method)</a>
<ul>
<li><a href="apireference.html#royalnet.bots.TelegramBot._init_client">(royalnet.bots.TelegramBot method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.GenericBot._init_commands">_init_commands() (royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.GenericBot._init_database">_init_database() (royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.GenericBot._init_loop">_init_loop() (royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.GenericBot._init_network">_init_network() (royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.GenericBot._init_sentry">_init_sentry() (royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot._init_voice">_init_voice() (royalnet.bots.DiscordBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot._initialize">_initialize() (royalnet.bots.DiscordBot method)</a>
<ul>
<li><a href="apireference.html#royalnet.bots.GenericBot._initialize">(royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot._initialize">(royalnet.bots.TelegramBot method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.DiscordBot._interface_factory">_interface_factory() (royalnet.bots.DiscordBot method)</a>
<ul>
<li><a href="apireference.html#royalnet.bots.GenericBot._interface_factory">(royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot._interface_factory">(royalnet.bots.TelegramBot method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.GenericBot._network_handler">_network_handler() (royalnet.bots.GenericBot method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.bots.DiscordBot.add_to_music_data">add_to_music_data() (royalnet.bots.DiscordBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot.advance_music_data">advance_music_data() (royalnet.bots.DiscordBot method)</a>
</li>
<li><a href="apireference.html#royalnet.database.Alchemy">Alchemy (class in royalnet.database)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.alchemy">alchemy (royalnet.commands.CommandInterface attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.Command.aliases">aliases (royalnet.commands.Command attribute)</a>
</li>
<li><a href="apireference.html#royalnet.utils.andformat">andformat() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.error.RoyalnetRequestError.args">args() (royalnet.error.RoyalnetRequestError property)</a>
</li>
<li><a href="apireference.html#royalnet.utils.asyncify">asyncify() (in module royalnet.utils)</a>
</li>
</ul></td>
</tr></table>
<h2 id="B">B</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.bot">bot (royalnet.commands.CommandInterface attribute)</a>
</li>
</ul></td>
</tr></table>
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.cdj">cdj() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Command">Command (class in royalnet.commands)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandArgs">CommandArgs (class in royalnet.commands)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandData">CommandData (class in royalnet.commands)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandError">CommandError</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface">CommandInterface (class in royalnet.commands)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkLink.connect">connect() (royalnet.network.NetworkLink method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.ConnectionClosedError">ConnectionClosedError</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.convert_to_mp3">convert_to_mp3() (royalnet.audio.YtdlMp3 method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord.convert_to_pcm">convert_to_pcm() (royalnet.audio.YtdlDiscord method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.create_and_ready_from_url">create_and_ready_from_url() (royalnet.audio.YtdlMp3 class method)</a>
</li>
<li><a href="apireference.html#royalnet.web.create_app">create_app() (in module royalnet.web)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord.create_from_url">create_from_url() (royalnet.audio.YtdlDiscord class method)</a>
<ul>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.create_from_url">(royalnet.audio.YtdlMp3 class method)</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.database.DatabaseConfig">DatabaseConfig (class in royalnet.database)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord.delete">delete() (royalnet.audio.YtdlDiscord method)</a>
<ul>
<li><a href="apireference.html#royalnet.audio.YtdlFile.delete">(royalnet.audio.YtdlFile method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.delete">(royalnet.audio.YtdlMp3 method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.commands.CommandData.delete_invoking">delete_invoking() (royalnet.commands.CommandData method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.Command.description">description (royalnet.commands.Command attribute)</a>
</li>
<li><a href="apireference.html#royalnet.utils.discord_escape">discord_escape() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot">DiscordBot (class in royalnet.bots)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlFile.download_file">download_file() (royalnet.audio.YtdlFile method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlFile.download_from_url">download_from_url() (royalnet.audio.YtdlFile class method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.audio.FileAudioSource">FileAudioSource (class in royalnet.audio)</a>
</li>
<li><a href="apireference.html#royalnet.utils.fileformat">fileformat() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkServer.find_client">find_client() (royalnet.network.NetworkServer method)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkServer.find_destination">find_destination() (royalnet.network.NetworkServer method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.Package.from_dict">from_dict() (royalnet.network.Package static method)</a>
<ul>
<li><a href="apireference.html#royalnet.network.Request.from_dict">(royalnet.network.Request static method)</a>
</li>
<li><a href="apireference.html#royalnet.network.Response.from_dict">(royalnet.network.Response class method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.network.Package.from_json_bytes">from_json_bytes() (royalnet.network.Package static method)</a>
</li>
<li><a href="apireference.html#royalnet.network.Package.from_json_string">from_json_string() (royalnet.network.Package static method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.bots.GenericBot">GenericBot (class in royalnet.bots)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandData.get_author">get_author() (royalnet.commands.CommandData method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.GenericBot.get_secret">get_secret() (royalnet.bots.GenericBot method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="H">H</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.audio.YtdlFile.has_info">has_info() (royalnet.audio.YtdlFile method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.NetworkLink.identify">identify() (royalnet.network.NetworkLink method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord.info">info() (royalnet.audio.YtdlDiscord property)</a>
<ul>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.info">(royalnet.audio.YtdlMp3 property)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.DiscordBot.interface_name">interface_name (royalnet.bots.DiscordBot attribute)</a>
<ul>
<li><a href="apireference.html#royalnet.bots.GenericBot.interface_name">(royalnet.bots.GenericBot attribute)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot.interface_name">(royalnet.bots.TelegramBot attribute)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.InvalidInputError">InvalidInputError</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlFile.is_downloaded">is_downloaded() (royalnet.audio.YtdlFile method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.FileAudioSource.is_opus">is_opus() (royalnet.audio.FileAudioSource method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="J">J</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandArgs.joined">joined() (royalnet.commands.CommandArgs method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="K">K</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandData.keyboard">keyboard() (royalnet.commands.CommandData method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.KeyboardExpiredError">KeyboardExpiredError</a>
</li>
</ul></td>
</tr></table>
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.NetworkServer.listener">listener() (royalnet.network.NetworkServer method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.loop">loop (royalnet.commands.CommandInterface attribute)</a>
</li>
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandArgs.match">match() (royalnet.commands.CommandArgs method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.NetworkHandler.message_type">message_type (royalnet.utils.NetworkHandler attribute)</a>
</li>
</ul></td>
</tr></table>
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.Command.name">name (royalnet.commands.Command attribute)</a>
<ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.name">(royalnet.commands.CommandInterface attribute)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.net_request">net_request() (royalnet.commands.CommandInterface method)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkConfig">NetworkConfig (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkError">NetworkError</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.NetworkHandler">NetworkHandler (class in royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkLink">NetworkLink (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkServer">NetworkServer (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.network.NotConnectedError">NotConnectedError</a>
</li>
<li><a href="apireference.html#royalnet.network.NotIdentifiedError">NotIdentifiedError</a>
</li>
<li><a href="apireference.html#royalnet.utils.numberemojiformat">numberemojiformat() (in module royalnet.utils)</a>
</li>
</ul></td>
</tr></table>
<h2 id="O">O</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.audio.YtdlFile.open">open() (royalnet.audio.YtdlFile method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandArgs.optional">optional() (royalnet.commands.CommandArgs method)</a>
</li>
<li><a href="apireference.html#royalnet.utils.ordinalformat">ordinalformat() (in module royalnet.utils)</a>
</li>
</ul></td>
</tr></table>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.Package">Package (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.utils.parse_5etools_entry">parse_5etools_entry() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord.pcm_available">pcm_available() (royalnet.audio.YtdlDiscord method)</a>
<ul>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.pcm_available">(royalnet.audio.YtdlMp3 method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.plusformat">plusformat() (in module royalnet.utils)</a>, <a href="apireference.html#royalnet.utils.plusformat">[1]</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.prefix">prefix (royalnet.commands.CommandInterface attribute)</a>
</li>
</ul></td>
</tr></table>
<h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.Response.raise_on_error">raise_on_error() (royalnet.network.Response method)</a>
<ul>
<li><a href="apireference.html#royalnet.network.ResponseError.raise_on_error">(royalnet.network.ResponseError method)</a>
</li>
<li><a href="apireference.html#royalnet.network.ResponseSuccess.raise_on_error">(royalnet.network.ResponseSuccess method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.audio.FileAudioSource.read">read() (royalnet.audio.FileAudioSource method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord.ready_up">ready_up() (royalnet.audio.YtdlDiscord method)</a>
<ul>
<li><a href="apireference.html#royalnet.audio.YtdlMp3.ready_up">(royalnet.audio.YtdlMp3 method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.network.NetworkLink.receive">receive() (royalnet.network.NetworkLink method)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.register_keyboard_key">register_keyboard_key() (royalnet.commands.CommandInterface method)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.register_net_handler">register_net_handler() (royalnet.commands.CommandInterface method)</a>
</li>
<li><a href="apireference.html#royalnet.database.relationshiplinkchain">relationshiplinkchain() (in module royalnet.database)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandData.reply">reply() (royalnet.commands.CommandData method)</a>
<ul>
<li><a href="apireference.html#royalnet.network.Package.reply">(royalnet.network.Package method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.network.Request">Request (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkLink.request">request() (royalnet.network.NetworkLink method)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Command.require_alchemy_tables">require_alchemy_tables (royalnet.commands.Command attribute)</a>
</li>
<li><a href="apireference.html#royalnet.network.Response">Response (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.network.ResponseError">ResponseError (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.network.ResponseSuccess">ResponseSuccess (class in royalnet.network)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlInfo.retrieve_for_url">retrieve_for_url() (royalnet.audio.YtdlInfo class method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.network.NetworkServer.route_package">route_package() (royalnet.network.NetworkServer method)</a>
</li>
<li><a href="apireference.html#module-royalnet.audio">royalnet.audio (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.bots">royalnet.bots (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.commands">royalnet.commands (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.database">royalnet.database (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.error">royalnet.error (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.network">royalnet.network (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.utils">royalnet.utils (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.web">royalnet.web (module)</a>
</li>
<li><a href="apireference.html#royalnet.error.RoyalnetRequestError">RoyalnetRequestError</a>
</li>
<li><a href="apireference.html#royalnet.error.RoyalnetResponseError">RoyalnetResponseError</a>
</li>
<li><a href="apireference.html#royalnet.web.Royalprint">Royalprint (class in royalnet.web)</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot.run">run() (royalnet.bots.DiscordBot method)</a>
<ul>
<li><a href="apireference.html#royalnet.bots.GenericBot.run">(royalnet.bots.GenericBot method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot.run">(royalnet.bots.TelegramBot method)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Command.run">(royalnet.commands.Command method)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkLink.run">(royalnet.network.NetworkLink method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.bots.GenericBot.run_blocking">run_blocking() (royalnet.bots.GenericBot method)</a>
<ul>
<li><a href="apireference.html#royalnet.network.NetworkServer.run_blocking">(royalnet.network.NetworkServer method)</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.bots.TelegramBot.safe_api_call">safe_api_call() (royalnet.bots.TelegramBot static method)</a>
</li>
<li><a href="apireference.html#royalnet.utils.safeformat">safeformat() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkLink.send">send() (royalnet.network.NetworkLink method)</a>
</li>
<li><a href="apireference.html#royalnet.network.NetworkServer.serve">serve() (royalnet.network.NetworkServer method)</a>
</li>
<li><a href="apireference.html#royalnet.database.Alchemy.session_acm">session_acm() (royalnet.database.Alchemy method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.database.Alchemy.session_cm">session_cm() (royalnet.database.Alchemy method)</a>
</li>
<li><a href="apireference.html#royalnet.bots.GenericBot.set_secret">set_secret() (royalnet.bots.GenericBot method)</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.audio.YtdlDiscord.spawn_audiosource">spawn_audiosource() (royalnet.audio.YtdlDiscord method)</a>
</li>
<li><a href="apireference.html#royalnet.utils.splitstring">splitstring() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Command.syntax">syntax (royalnet.commands.Command attribute)</a>
</li>
</ul></td>
</tr></table>
<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.telegram_escape">telegram_escape() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.bots.TelegramBot">TelegramBot (class in royalnet.bots)</a>
</li>
<li><a href="apireference.html#royalnet.network.Package.to_dict">to_dict() (royalnet.network.Package method)</a>
<ul>
<li><a href="apireference.html#royalnet.network.Request.to_dict">(royalnet.network.Request method)</a>
</li>
<li><a href="apireference.html#royalnet.network.Response.to_dict">(royalnet.network.Response method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.audio.YtdlInfo.to_discord_embed">to_discord_embed() (royalnet.audio.YtdlInfo method)</a>
</li>
<li><a href="apireference.html#royalnet.network.Package.to_json_bytes">to_json_bytes() (royalnet.network.Package method)</a>
</li>
<li><a href="apireference.html#royalnet.network.Package.to_json_string">to_json_string() (royalnet.network.Package method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="U">U</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.unregister_keyboard_key">unregister_keyboard_key() (royalnet.commands.CommandInterface method)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.unregister_net_handler">unregister_net_handler() (royalnet.commands.CommandInterface method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.UnsupportedError">UnsupportedError</a>
</li>
<li><a href="apireference.html#royalnet.bots.DiscordBot.update_activity_with_source_title">update_activity_with_source_title() (royalnet.bots.DiscordBot method)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlFile.update_info">update_info() (royalnet.audio.YtdlFile method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="Y">Y</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.ytdldateformat">ytdldateformat() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlDiscord">YtdlDiscord (class in royalnet.audio)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.audio.YtdlFile">YtdlFile (class in royalnet.audio)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlInfo">YtdlInfo (class in royalnet.audio)</a>
</li>
<li><a href="apireference.html#royalnet.audio.YtdlMp3">YtdlMp3 (class in royalnet.audio)</a>
</li>
</ul></td>
</tr></table>
</div> </div>

View file

@ -182,17 +182,7 @@
<li class="toctree-l2"><a class="reference internal" href="creatingacommand.html#comunicating-via-royalnet">Comunicating via Royalnet</a></li> <li class="toctree-l2"><a class="reference internal" href="creatingacommand.html#comunicating-via-royalnet">Comunicating via Royalnet</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a><ul> <li class="toctree-l1"><a class="reference internal" href="apireference.html">API Reference</a></li>
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.audio">Audio</a></li>
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.bots">Bots</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.database">Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.network">Network</a></li>
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.utils">Utils</a></li>
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.web">Web</a></li>
<li class="toctree-l2"><a class="reference internal" href="apireference.html#module-royalnet.error">Error</a></li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="some-useful-links"> <div class="section" id="some-useful-links">

Binary file not shown.

View file

@ -174,7 +174,7 @@ your bot. Enter a name that youll be able to remember.</p>
</pre></div> </pre></div>
</div> </div>
<p>Youll then be asked for a network password.</p> <p>Youll then be asked for a network password.</p>
<p>This password is used to connect to the rest of the <a class="reference internal" href="apireference.html#module-royalnet.network" title="royalnet.network"><code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.network</span></code></a>, or, if youre hosting a local Network, <p>This password is used to connect to the rest of the <code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.network</span></code>, or, if youre hosting a local Network,
it will be the necessary password to connect to it:</p> it will be the necessary password to connect to it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Network</span> <span class="n">password</span> <span class="p">[]:</span> <span class="n">cosafaunapesuunafoglia</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Network</span> <span class="n">password</span> <span class="p">[]:</span> <span class="n">cosafaunapesuunafoglia</span>
</pre></div> </pre></div>

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ from .generic import GenericBot
from ..utils import * from ..utils import *
from ..error import * from ..error import *
from ..audio import * from ..audio import *
from ..packs import * from ..commands import *
log = _logging.getLogger(__name__) log = _logging.getLogger(__name__)