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

Improve docs

This commit is contained in:
Steffo 2020-08-10 01:31:12 +02:00
parent 10f3126d44
commit 866e5931d2
39 changed files with 1397 additions and 502 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +1,4 @@
# Sphinx build info version 1 # 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. # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 72c039d18ea46f966a2534df3d8861fa config: 6f503147de72a3eb83d559fec1110ecd
tags: 645f666f9bcd5a90fca523b33c5a78b7 tags: 645f666f9bcd5a90fca523b33c5a78b7

View file

@ -14,5 +14,5 @@ Welcome to the documentation of Royalnet!
Some useful links Some useful links
------------------------------------ ------------------------------------
* `Royalnet on GitHub <https://github.com/royal-games/royalnet>`_ * `Royalnet on GitHub <https://github.com/Steffo99/royalnet>`_
* :ref:`genindex` * :ref:`genindex`

View file

@ -3,7 +3,7 @@
Creating a new Command Creating a new Command
==================================== ====================================
A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet interface. A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet platform.
A Command code looks like this: :: A Command code looks like this: ::
@ -14,12 +14,12 @@ A Command code looks like this: ::
description = "Play ping-pong with the bot." description = "Play ping-pong with the bot."
def __init__(self, interface): # This code is run just once, while the bot is starting
# This code is run just once, while the bot is starting def __init__(self, serf: "Serf", config):
super().__init__() super().__init__(serf=serf, config=config)
# This code is run every time the command is called
async def run(self, args: rc.CommandArgs, data: rc.CommandData): async def run(self, args: rc.CommandArgs, data: rc.CommandData):
# This code is run every time the command is called
await data.reply("Pong!") await data.reply("Pong!")
Creating a new Command Creating a new Command
@ -32,7 +32,7 @@ Try to keep the name as short as possible, while staying specific enough so no o
Next, create a new Python file with the ``name`` you have thought of. Next, create a new Python file with the ``name`` you have thought of.
The previously mentioned "spaghetti" command should have a file called ``spaghetti.py``. The previously mentioned "spaghetti" command should have a file called ``spaghetti.py``.
Then, in the first row of the file, import the :class:`Command` class from royalnet, and create a new class inheriting from it: :: Then, in the first row of the file, import the :class:`~Command` class from royalnet, and create a new class inheriting from it: ::
import royalnet.commands as rc import royalnet.commands as rc
@ -48,9 +48,9 @@ Inside the class, override the attributes ``name`` and ``description`` with resp
description = "Send a spaghetti emoji in the chat." description = "Send a spaghetti emoji in the chat."
Now override the :meth:`Command.run` method, adding the code you want the bot to run when the command is called. Now override the :meth:`~Command.run` method, adding the code you want the bot to run when the command is called.
To send a message in the chat the command was called in, you can use the :meth:`CommandData.reply` coroutine: :: To send a message in the chat the command was called in, you can use the :meth:`~CommandData.reply` coroutine: ::
import royalnet.commands as rc import royalnet.commands as rc
@ -76,13 +76,32 @@ command to the ``available_commands`` list: ::
# Don't change this, it should automatically generate __all__ # Don't change this, it should automatically generate __all__
__all__ = [command.__name__ for command in available_commands] __all__ = [command.__name__ for command in available_commands]
Formatting command replies
------------------------------------
You can use a subset of `BBCode <https://en.wikipedia.org/wiki/BBCode>`_ to format messages sent with :meth:`~CommandData.reply`: ::
async def run(self, args: rc.CommandArgs, data: rc.CommandData):
await data.reply("[b]Bold of you to assume that my code has no bugs.[/b]")
Available tags
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's a list of all tags that can be used:
- ``[b]bold[/b]``
- ``[i]italic[/i]``
- ``[c]code[/c]``
- ``[p]multiline \n code[/p]``
- ``[url=https://google.com]inline link[/url]`` (will be rendered differently on every platform)
Command arguments Command arguments
------------------------------------ ------------------------------------
A command can have some arguments passed by the user: for example, on Telegram an user may type `/spaghetti carbonara al-dente` A command can have some arguments passed by the user: for example, on Telegram an user may type `/spaghetti carbonara al-dente`
to pass the :class:`str` `"carbonara al-dente"` to the command code. to pass the :class:`str` `"carbonara al-dente"` to the command code.
These arguments can be accessed in multiple ways through the ``args`` parameter passed to the :meth:`Command.run` These arguments can be accessed in multiple ways through the ``args`` parameter passed to the :meth:`~Command.run`
method. method.
If you want your command to use arguments, override the ``syntax`` class attribute with a brief description of the If you want your command to use arguments, override the ``syntax`` class attribute with a brief description of the
@ -96,10 +115,15 @@ ones. ::
description = "Send a spaghetti emoji in the chat." description = "Send a spaghetti emoji in the chat."
syntax = "(requestedpasta)" syntax = "{first_pasta} [second_pasta]"
async def run(self, args: rc.CommandArgs, data: rc.CommandData): async def run(self, args: rc.CommandArgs, data: rc.CommandData):
await data.reply(f"🍝 Here's your {args[0]}!") first_pasta = args[0]
second_pasta = args.optional(1)
if second_pasta is None:
await data.reply(f"🍝 Here's your {first_pasta}!")
else:
await data.reply(f"🍝 Here's your {first_pasta} and your {second_pasta}!")
Direct access Direct access
@ -124,7 +148,7 @@ If you request an argument with a certain number, but the argument does not exis
Optional access Optional access
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you don't want arguments to be required, you can access them through the :meth:`CommandArgs.optional` method: it If you don't want arguments to be required, you can access them through the :meth:`~CommandArgs.optional` method: it
will return ``None`` if the argument wasn't passed, making it **optional**. :: will return ``None`` if the argument wasn't passed, making it **optional**. ::
args.optional(0) args.optional(0)
@ -144,7 +168,7 @@ You can specify a default result too, so that the method will return it instead
Full string Full string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want the full argument string, you can use the :meth:`CommandArgs.joined` method. :: If you want the full argument string, you can use the :meth:`~CommandArgs.joined` method. ::
args.joined() args.joined()
# "carbonara al-dente" # "carbonara al-dente"
@ -160,7 +184,7 @@ Regular expressions
For more complex commands, you may want to get arguments through `regular expressions <https://regexr.com/>`_. For more complex commands, you may want to get arguments through `regular expressions <https://regexr.com/>`_.
You can then use the :meth:`CommandArgs.match` method, which tries to match a pattern to the command argument string, You can then use the :meth:`~CommandArgs.match` method, which tries to match a pattern to the command argument string,
which returns a tuple of the matched groups and raises an :exc:`.InvalidInputError` if there is no match. which returns a tuple of the matched groups and raises an :exc:`.InvalidInputError` if there is no match.
To match a pattern, :func:`re.match` is used, meaning that Python will try to match only at the beginning of the string. :: To match a pattern, :func:`re.match` is used, meaning that Python will try to match only at the beginning of the string. ::
@ -180,25 +204,25 @@ To match a pattern, :func:`re.match` is used, meaning that Python will try to ma
Raising errors Raising errors
--------------------------------------------- ---------------------------------------------
If you want to display an error message to the user, you can raise a :exc:`.CommandError` using the error message as argument: :: If you want to display an error message to the user, you can raise a :exc:`~CommandError` using the error message as argument: ::
if not kitchen.is_open(): if not kitchen.is_open():
raise CommandError("The kitchen is closed. Come back later!") raise CommandError("The kitchen is closed. Come back later!")
There are some subclasses of :exc:`.CommandError` that can be used for some more specific cases: There are some subclasses of :exc:`~CommandError` that can be used for some more specific cases:
:exc:`.UserError` :exc:`.UserError`
The user did something wrong, it is not a problem with the bot. The user did something wrong, it is not a problem with the bot.
:exc:`.InvalidInputError` :exc:`.InvalidInputError`
The arguments the user passed to the command by the user are invalid. The arguments the user passed to the command by the user are invalid.
Displays the command syntax in the error message. *Additionally displays the command syntax in the error message.*
:exc:`.UnsupportedError` :exc:`.UnsupportedError`
The command is not supported on the interface it is being called. The command is not supported on the platform it is being called.
:exc:`.ConfigurationError` :exc:`.ConfigurationError`
The ``config.toml`` file was misconfigured (a value is missing or invalid). A value is missing or invalid in the ``config.toml`` section of your pack.
:exc:`.ExternalError` :exc:`.ExternalError`
An external API the command depends on is unavailable or returned an error. An external API the command depends on is unavailable or returned an error.
@ -211,7 +235,7 @@ Coroutines and slow operations
You may have noticed that in the previous examples we used ``await data.reply("🍝")`` instead of just ``data.reply("🍝")``. You may have noticed that in the previous examples we used ``await data.reply("🍝")`` instead of just ``data.reply("🍝")``.
This is because :meth:`CommandData.reply` isn't a simple method: it is a coroutine, a special kind of function that This is because :meth:`~CommandData.reply` isn't 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. can be executed separately from the rest of the code, allowing the bot to do other things in the meantime.
By adding the ``await`` keyword before the ``data.reply("🍝")``, we tell the bot that it can do other things, like By adding the ``await`` keyword before the ``data.reply("🍝")``, we tell the bot that it can do other things, like
@ -242,13 +266,13 @@ Delete the invoking message
The invoking message of a command is the message that the user sent that the bot recognized as a command; for example, The invoking message of a command is the message that the user sent that the bot recognized as a command; for example,
the message ``/spaghetti carbonara`` is the invoking message for the ``spaghetti`` command run. the message ``/spaghetti carbonara`` is the invoking message for the ``spaghetti`` command run.
You can have the bot delete the invoking message for a command by calling the :class:`CommandData.delete_invoking` You can have the bot delete the invoking message for a command by calling the :class:`~CommandData.delete_invoking`
method: :: method: ::
async def run(self, args, data): async def run(self, args, data):
await data.delete_invoking() await data.delete_invoking()
Not all interfaces support deleting messages; by default, if the interface does not support deletions, the call is Not all platforms support deleting messages; by default, if the platform does not support deletions, the call is
ignored. ignored.
You can have the method raise an error if the message can't be deleted by setting the ``error_if_unavailable`` parameter You can have the method raise an error if the message can't be deleted by setting the ``error_if_unavailable`` parameter
@ -262,10 +286,31 @@ to True: ::
else: else:
await data.reply("✅ The message was deleted!") await data.reply("✅ The message was deleted!")
Using the database Sharing data between multiple calls
------------------------------------ ------------------------------------
Bots can be connected to a PostgreSQL database through a special SQLAlchemy interface called The :class:`~Command` class is shared between multiple command calls: if you need to store some data, you may store it as a protected/private field of your command class: ::
class SpaghettiCommand(rc.Command):
name = "spaghetti"
description = "Send a spaghetti emoji in the chat."
syntax = "(requestedpasta)"
__total_spaghetti = 0
async def run(self, args: rc.CommandArgs, data: rc.CommandData):
self.__total_spaghetti += 1
await data.reply(f"🍝 Here's your {args[0]}!\n"
f"[i]Spaghetti have been served {self.__total_spaghetti} times.[/i]")
Values stored in this way persist **only until the bot is restarted**, and **won't be shared between different serfs**; if you need persistent values, it is recommended to use a database through the Alchemy service.
Using the Alchemy
------------------------------------
Royalnet can be connected to a PostgreSQL database through a special SQLAlchemy interface called
:class:`royalnet.alchemy.Alchemy`. :class:`royalnet.alchemy.Alchemy`.
If the connection is established, the ``self.alchemy`` and ``data.session`` fields will be If the connection is established, the ``self.alchemy`` and ``data.session`` fields will be
@ -344,19 +389,115 @@ You can read more about sqlalchemy at their `website <https://www.sqlalchemy.org
Calling Events Calling Events
------------------------------------ ------------------------------------
This section is not documented yet. You can **call an event** from inside a command, and receive its return value.
This may be used for example to get data from a different platform, such as getting the users online in a specific Discord server.
You can call an event with the :meth:`.Serf.call_herald_event` method: ::
result = await self.serf.call_herald_event("event_name")
You can also pass parameters to the called event: ::
result = await self.serf.call_herald_event("event_name", ..., kwarg=..., *..., **...)
Errors raised by the event will also be raised by the :meth:`.Serf.call_herald_event` method as one of the exceptions described in the :ref:`Raising errors` section.
Distinguish between platforms
------------------------------------
To see if a command is being run on a specific platform, you can check the type of the ``self.serf`` object: ::
import royalnet.serf.telegram as rst
import royalnet.serf.discord as rsd
...
if isinstance(self.serf, rst.TelegramSerf):
await data.reply("This command is being run on Telegram.")
elif isinstance(self.serf, rsd.DiscordSerf):
await data.reply("This command is being run on Discord.")
...
Displaying Keyboards Displaying Keyboards
------------------------------------ ------------------------------------
This section is not documented yet. A keyboard is a message with multiple buttons ("keys") attached which can be pressed by an user viewing the message.
Running code at the initialization of the bot Once a button is pressed, a callback function is run, which has its own :class:`~CommandData` context and can do everything a regular comment call could.
The callback function is a coroutine accepting a single ``data: CommandData`` argument: ::
async def answer(data: CommandData) -> None:
await data.reply("Spaghetti were ejected from your floppy drive!")
To create a new key, you can use the :class:`~KeyboardKey` class: ::
key = KeyboardKey(
short="⏏️", # An emoji representing the key on platforms the full message cannot be displayed
text="Eject spaghetti from the floppy drive", # The text displayed on the key
callback=answer # The coroutine to call when the key is pressed.
)
To display a keyboard and wait for a keyboard press, you can use the :meth:`~CommandData.keyboard` asynccontextmanager.
While the contextmanager is in scope, the keyboard will be valid and it will be possible to interact with it.
Any further key pressed will be answered with an error message. ::
async with data.keyboard(text="What kind of spaghetti would you want to order?", keys=keyboard):
# This will keep the keyboard valid for 10 seconds
await asyncio.sleep(10)
Replies in callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Calls to :meth:`~CommandData.reply` made with the :class:`~CommandData` of a keyboard callback won't always result in a message being sent: for example, on Telegram, replies will result in a small message being displayed on the top of the screen.
Reading data from the configuration file
--------------------------------------------- ---------------------------------------------
This section is not documented yet. You can read data from your pack's configuration section through the :attr:`~Command.config` attribute: ::
[Packs."spaghettipack"]
spaghetti = { mode="al_dente", two=true }
::
await data.reply(f"Here's your spaghetti {self.config['spaghetti']['mode']}!")
Running code on Serf start
----------------------------------------------
The code inside ``__init__`` is run only once, during the initialization step of the bot: ::
def __init__(self, serf: "Serf", config):
super().__init__(serf=serf, config=config)
# The contents of this variable will be persisted across command calls
self.persistent_variable = 0
# The text will be printed only if the config flag is set to something
if config["spaghetti"]["two"]:
print("Famme due spaghi!")
.. note:: Some methods may be unavailable during the initialization of the Serf.
Running repeating jobs Running repeating jobs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This section is not documented yet. To run a job independently from the rest of the command, you can schedule the execution of a coroutine inside ``__init__``: ::
async def mycoroutine():
while True:
print("Free spaghetti every 60 seconds!")
await asyncio.sleep(60)
def __init__(self, serf: "Serf", config):
super().__init__(serf=serf, config=config)
self.loop.create_task(mycoroutine())
As it will be executed once for every platform Royalnet is running on, you may want to run the task only on a single platform: ::
def __init__(self, serf: "Serf", config):
super().__init__(serf=serf, config=config)
if isinstance(self.serf, rst.TelegramSerf):
self.loop.create_task(mycoroutine())

View file

@ -1,10 +1,12 @@
.. currentmodule:: royalnet
Creating a new Pack Creating a new Pack
==================================== ====================================
Prerequisites 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>`_ You'll need to have `Python 3.8 <https://www.pyth1on.org/downloads/release/python-382/>`_ and `poetry <https://github.com/python-poetry/poetry>`_
to develop Royalnet Packs. to develop Royalnet Packs.
Creating the repository Creating the repository
@ -13,7 +15,7 @@ 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>`_ 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. and clone it to your workspace.
After cloning the template, run ``poetry install`` to install the dependencies for the pack, creating the ``poetry.lock`` file. After cloning the template, run ``poetry install`` to create a virtualenv and install the dependencies for the pack in it.
pyproject.toml pyproject.toml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -35,7 +37,7 @@ 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. 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: :: It should contain six folders: ::
examplepack examplepack
├── commands ├── commands
@ -43,19 +45,7 @@ It should contain a ``version.py`` file and six folders: ::
├── stars ├── stars
├── tables ├── tables
├── types ├── types
├── utils └── 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -108,13 +98,25 @@ However, its files are **forbidden from importing anything else** from the rest
Adding new dependencies to the Pack Adding new dependencies to the Pack
------------------------------------ ------------------------------------
As the Pack is actually a Python package, you can use ``poetry`` (or ``pip``) to add new dependencies! As the Pack is actually a Python package, you can use ``poetry`` to add new dependencies!
Use ``poetry add packagename`` to add and install a new dependency from the PyPI. Use ``poetry add packagename`` to add and install a new dependency from the PyPI.
Updating the dependencies
------------------------------------
You can update all your dependencies by using: ``poetry update``.
The README.md file
------------------------------------
The README.md file is the first thing that users of your pack will see!
It's recommended to describe accurately how to install and configure the pack, so other users will be able to use it too!
Publishing the pack Publishing the pack
------------------------------------ ------------------------------------
To publish your Pack on the PyPI, run ``poetry build``, then ``poetry publish``. To publish your Pack on the PyPI, run ``poetry publish --build``.
Poetry will build your Pack and upload it to the PyPI for you. Poetry will build your Pack and upload it to the PyPI for you!

View file

@ -0,0 +1,289 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg"
width="1280"
height="640"
viewBox="0 0 338.66666 169.33335"
version="1.1"
id="svg5014"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="RoyalnetOpenGraph.svg"
inkscape:export-filename="D:\Immagini\Royal Games\RoyalnetOpenGraph.png"
inkscape:export-xdpi="211.64999"
inkscape:export-ydpi="211.64999">
<defs
id="defs5008">
<inkscape:path-effect
effect="spiro"
id="path-effect4740-4-9"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4814-3-0"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4740-4-3-2"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4814-3-8-6"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4814-3-2-3"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4740-4-8-2"
is_visible="true"/>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="668.89081"
inkscape:cy="254.23617"
inkscape:document-units="px"
inkscape:current-layer="layer5"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1272"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"/>
<metadata
id="metadata5011">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Livello 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0.0932605,-127.66807)"
style="display:inline">
<rect
style="opacity:1;fill:#0d193b;fill-opacity:1;stroke:#a0cafd;stroke-width:0.06771223;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect5872"
width="338.59897"
height="169.26562"
x="-0.059404384"
y="127.7019"/>
</g>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="Livello 2"
transform="translate(0.0932605,37.040251)">
<g
transform="translate(39.454539,-188.4695)"
id="g5736">
<text
transform="scale(0.90442695,1.1056725)"
id="text4732"
y="238.2995"
x="23.705601"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:13.64452839px;line-height:1.25;font-family:Impact;-inkscape-font-specification:'Impact Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#a0cafd;fill-opacity:1;stroke:none;stroke-width:0.34111318"
xml:space="preserve"><tspan
style="font-size:65.49373627px;fill:#a0cafd;fill-opacity:1;stroke-width:0.34111318"
y="238.2995"
x="23.705601"
id="tspan4730"
sodipodi:role="line">Royalnet</tspan></text>
<g
transform="translate(-2.0864727,107.37549)"
id="g4801"
style="display:inline">
<g
transform="translate(0,-1.5472047)"
id="g4806">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4734"
d="m 72.008205,108.22192 c -1.298662,-0.12455 -2.528663,-0.16144 -4.015472,-0.0311 L 49.036385,96.196667 50.579489,94.565515 Z"
style="fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
<ellipse
ry="5.6216612"
rx="5.4344773"
cy="91.733978"
cx="44.573582"
id="path4736"
style="opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.29205444;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
<path
sodipodi:nodetypes="cccccccc"
inkscape:original-d="m 50.579488,94.565824 c -2.64e-4,2.64e-4 -0.303197,-0.388803 -0.455192,-0.582808 -0.151994,-0.194005 -0.186907,-0.584452 -0.280754,-0.87628 -0.09385,-0.291827 -1.18252,1.954034 -1.774173,2.931449 -0.591655,0.977412 0.18156,0.02148 0.271947,0.03263 0.09038,0.01114 0.463641,0.08384 0.695067,0.126156 0.231426,0.04232 1.029,-1.087698 1.543105,-1.631151 z"
inkscape:path-effect="#path-effect4740-4-9"
inkscape:connector-curvature="0"
id="path4738"
d="m 50.579488,94.565824 c -0.19561,-0.153916 -0.353242,-0.35574 -0.455192,-0.582808 -0.125746,-0.280068 -0.16588,-0.59158 -0.280754,-0.87628 -0.129281,-0.320405 -0.353925,-0.601278 -0.636711,-0.799785 -0.282786,-0.198507 -0.622572,-0.314232 -0.967619,-0.332011 -0.345046,-0.01778 -0.694281,0.06215 -0.99841,0.226092 -0.304129,0.163948 -0.56245,0.411219 -0.741612,0.706641 -0.179162,0.295422 -0.278954,0.638128 -0.288835,0.98349 -0.0099,0.345363 0.06991,0.692617 0.227397,1.000143 0.314966,0.615052 0.947156,1.051981 1.631617,1.146879 0.09044,0.01254 0.181591,0.01951 0.271947,0.03263 0.233191,0.03386 0.460094,0.108482 0.695067,0.126156 0.427171,0.03213 0.865211,-0.137278 1.159604,-0.44847 0.294394,-0.311191 0.439261,-0.757947 0.383501,-1.182681 z"
style="fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
</g>
</g>
<g
transform="translate(-41.369474,20.791663)"
id="g4849"
style="display:inline">
<path
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 156.24182,195.63617 c 0.52356,-0.68844 1.23943,-1.19659 2.1157,-1.55436 l -0.90168,-4.19832 -1.77591,-10.28568 -2.42533,0.43459 z"
id="path4808"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc"/>
<ellipse
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.08753412;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4810"
cx="153.28587"
cy="173.23436"
rx="5.5337849"
ry="5.5682526"/>
<path
sodipodi:nodetypes="cccscccc"
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.67993,179.59781 c 8.7e-4,-0.57128 0.17574,-1.14113 0.49545,-1.61457 0.12269,-0.18168 0.26704,-0.35116 0.35688,-0.55113 0.10917,-0.243 0.13066,-0.52256 0.0702,-0.782 -0.0605,-0.25945 -0.20113,-0.49812 -0.39142,-0.68455 -0.19029,-0.18643 -0.42903,-0.32114 -0.68406,-0.39812 -0.25504,-0.077 -0.52597,-0.097 -0.79092,-0.0693 -0.52991,0.0554 -1.02665,0.29884 -1.4524,0.61918 -0.42574,0.32034 -0.78783,0.71643 -1.14052,1.11579 -0.12177,0.13788 -0.24392,0.27814 -0.32933,0.44106 -0.0854,0.16292 -0.13193,0.35296 -0.0925,0.53264 0.0305,0.13914 0.11075,0.26386 0.21093,0.36514 0.10017,0.10128 0.21994,0.18096 0.3424,0.25374 0.12245,0.0728 0.24866,0.13949 0.36697,0.21884 0.1183,0.0794 0.22952,0.17245 0.31184,0.28871 0.14705,0.20767 0.1902,0.47019 0.30118,0.69917 0.12063,0.2489 0.32431,0.45666 0.57078,0.58219 0.24646,0.12554 0.53427,0.16812 0.80653,0.11934 0.27225,-0.0488 0.52737,-0.18866 0.71491,-0.39196 0.18754,-0.20331 0.30641,-0.46886 0.33311,-0.74416"
id="path4812"
inkscape:connector-curvature="0"
inkscape:path-effect="#path-effect4814-3-0"
inkscape:original-d="m 155.67993,179.59781 c 0.16078,-0.54597 0.33056,-1.07665 0.49545,-1.61457 0.16488,-0.53793 0.28228,-0.50274 0.35688,-0.55113 0.0746,-0.0484 -2.96992,0.002 -4.38913,-0.19901 -1.41921,-0.20112 -0.51799,0.47248 -0.42185,0.9737 0.0961,0.50123 1.05871,0.92708 1.23214,1.12643 0.17342,0.19934 0.20105,0.46584 0.30118,0.69917 0.10013,0.23332 1.61715,-0.28999 2.42533,-0.43459"/>
</g>
<g
transform="matrix(-1,0,0,1,224.10371,96.838062)"
id="g4801-9"
style="display:inline">
<g
transform="rotate(24.954103,74.609956,111.66802)"
id="g4806-3">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4734-0"
d="m 72.008205,108.22192 -2.297446,1.06532 -20.674374,-13.090573 1.543104,-1.631152 z"
style="fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
<ellipse
ry="5.6216612"
rx="5.4344773"
cy="91.733978"
cx="44.573582"
id="path4736-1"
style="opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.29205444;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
<path
sodipodi:nodetypes="cccccccc"
inkscape:original-d="m 50.579488,94.565824 c -2.64e-4,2.64e-4 -0.303197,-0.388803 -0.455192,-0.582808 -0.151994,-0.194005 -0.186907,-0.584452 -0.280754,-0.87628 -0.09385,-0.291827 -1.18252,1.954034 -1.774173,2.931449 -0.591655,0.977412 0.18156,0.02148 0.271947,0.03263 0.09038,0.01114 0.463641,0.08384 0.695067,0.126156 0.231426,0.04232 1.029,-1.087698 1.543105,-1.631151 z"
inkscape:path-effect="#path-effect4740-4-3-2"
inkscape:connector-curvature="0"
id="path4738-5"
d="m 50.579488,94.565824 c -0.19561,-0.153916 -0.353242,-0.35574 -0.455192,-0.582808 -0.125746,-0.280068 -0.16588,-0.59158 -0.280754,-0.87628 -0.129281,-0.320405 -0.353925,-0.601278 -0.636711,-0.799785 -0.282786,-0.198507 -0.622572,-0.314232 -0.967619,-0.332011 -0.345046,-0.01778 -0.694281,0.06215 -0.99841,0.226092 -0.304129,0.163948 -0.56245,0.411219 -0.741612,0.706641 -0.179162,0.295422 -0.278954,0.638128 -0.288835,0.98349 -0.0099,0.345363 0.06991,0.692617 0.227397,1.000143 0.314966,0.615052 0.947156,1.051981 1.631617,1.146879 0.09044,0.01254 0.181591,0.01951 0.271947,0.03263 0.233191,0.03386 0.460094,0.108482 0.695067,0.126156 0.427171,0.03213 0.865211,-0.137278 1.159604,-0.44847 0.294394,-0.311191 0.439261,-0.757947 0.383501,-1.182681 z"
style="fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
</g>
</g>
<g
inkscape:transform-center-y="-6.6298922"
inkscape:transform-center-x="-14.065358"
transform="matrix(-0.84226589,-0.53906235,-0.53906235,0.84226589,422.81566,139.44738)"
id="g4849-9"
style="display:inline">
<path
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 156.01691,195.44483 c 0,0 1.03691,-0.78683 2.34061,-1.36302 l -0.90168,-4.19832 -1.77591,-10.28568 -2.42533,0.43459 z"
id="path4808-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc"/>
<ellipse
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.08753412;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4810-9"
cx="153.28587"
cy="173.23436"
rx="5.5337849"
ry="5.5682526"/>
<path
sodipodi:nodetypes="cccscccc"
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.67993,179.59781 c 8.7e-4,-0.57128 0.17574,-1.14113 0.49545,-1.61457 0.12269,-0.18168 0.26704,-0.35116 0.35688,-0.55113 0.10917,-0.243 0.13066,-0.52256 0.0702,-0.782 -0.0605,-0.25945 -0.20113,-0.49812 -0.39142,-0.68455 -0.19029,-0.18643 -0.42903,-0.32114 -0.68406,-0.39812 -0.25504,-0.077 -0.52597,-0.097 -0.79092,-0.0693 -0.52991,0.0554 -1.02665,0.29884 -1.4524,0.61918 -0.42574,0.32034 -0.78783,0.71643 -1.14052,1.11579 -0.12177,0.13788 -0.24392,0.27814 -0.32933,0.44106 -0.0854,0.16292 -0.13193,0.35296 -0.0925,0.53264 0.0305,0.13914 0.11075,0.26386 0.21093,0.36514 0.10017,0.10128 0.21994,0.18096 0.3424,0.25374 0.12245,0.0728 0.24866,0.13949 0.36697,0.21884 0.1183,0.0794 0.22952,0.17245 0.31184,0.28871 0.14705,0.20767 0.1902,0.47019 0.30118,0.69917 0.12063,0.2489 0.32431,0.45666 0.57078,0.58219 0.24646,0.12554 0.53427,0.16812 0.80653,0.11934 0.27225,-0.0488 0.52737,-0.18866 0.71491,-0.39196 0.18754,-0.20331 0.30641,-0.46886 0.33311,-0.74416"
id="path4812-9"
inkscape:connector-curvature="0"
inkscape:path-effect="#path-effect4814-3-8-6"
inkscape:original-d="m 155.67993,179.59781 c 0.16078,-0.54597 0.33056,-1.07665 0.49545,-1.61457 0.16488,-0.53793 0.28228,-0.50274 0.35688,-0.55113 0.0746,-0.0484 -2.96992,0.002 -4.38913,-0.19901 -1.41921,-0.20112 -0.51799,0.47248 -0.42185,0.9737 0.0961,0.50123 1.05871,0.92708 1.23214,1.12643 0.17342,0.19934 0.20105,0.46584 0.30118,0.69917 0.10013,0.23332 1.61715,-0.28999 2.42533,-0.43459"/>
</g>
<g
transform="rotate(-130.0044,153.8328,239.47705)"
id="g4849-4"
style="display:inline">
<path
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 156.32889,195.84023 c 0.55471,-0.68202 1.24114,-1.24509 2.02863,-1.75842 l -0.90168,-4.19832 -1.77591,-10.28568 -2.42533,0.43459 z"
id="path4808-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc"/>
<ellipse
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.08753412;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4810-6"
cx="153.28587"
cy="173.23436"
rx="5.5337849"
ry="5.5682526"/>
<path
sodipodi:nodetypes="cccscccc"
style="display:inline;opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.67993,179.59781 c 8.7e-4,-0.57128 0.17574,-1.14113 0.49545,-1.61457 0.12269,-0.18168 0.26704,-0.35116 0.35688,-0.55113 0.10917,-0.243 0.13066,-0.52256 0.0702,-0.782 -0.0605,-0.25945 -0.20113,-0.49812 -0.39142,-0.68455 -0.19029,-0.18643 -0.42903,-0.32114 -0.68406,-0.39812 -0.25504,-0.077 -0.52597,-0.097 -0.79092,-0.0693 -0.52991,0.0554 -1.02665,0.29884 -1.4524,0.61918 -0.42574,0.32034 -0.78783,0.71643 -1.14052,1.11579 -0.12177,0.13788 -0.24392,0.27814 -0.32933,0.44106 -0.0854,0.16292 -0.13193,0.35296 -0.0925,0.53264 0.0305,0.13914 0.11075,0.26386 0.21093,0.36514 0.10017,0.10128 0.21994,0.18096 0.3424,0.25374 0.12245,0.0728 0.24866,0.13949 0.36697,0.21884 0.1183,0.0794 0.22952,0.17245 0.31184,0.28871 0.14705,0.20767 0.1902,0.47019 0.30118,0.69917 0.12063,0.2489 0.32431,0.45666 0.57078,0.58219 0.24646,0.12554 0.53427,0.16812 0.80653,0.11934 0.27225,-0.0488 0.52737,-0.18866 0.71491,-0.39196 0.18754,-0.20331 0.30641,-0.46886 0.33311,-0.74416"
id="path4812-3"
inkscape:connector-curvature="0"
inkscape:path-effect="#path-effect4814-3-2-3"
inkscape:original-d="m 155.67993,179.59781 c 0.16078,-0.54597 0.33056,-1.07665 0.49545,-1.61457 0.16488,-0.53793 0.28228,-0.50274 0.35688,-0.55113 0.0746,-0.0484 -2.96992,0.002 -4.38913,-0.19901 -1.41921,-0.20112 -0.51799,0.47248 -0.42185,0.9737 0.0961,0.50123 1.05871,0.92708 1.23214,1.12643 0.17342,0.19934 0.20105,0.46584 0.30118,0.69917 0.10013,0.23332 1.61715,-0.28999 2.42533,-0.43459"/>
</g>
<g
transform="rotate(180,116.68483,185.47497)"
id="g4801-1"
style="display:inline">
<g
transform="translate(0,-1.5472047)"
id="g4806-9">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4734-4"
d="m 72.008205,108.22192 -4.027874,0.002 -18.943946,-12.027223 1.543104,-1.631152 z"
style="fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
<ellipse
ry="5.6216612"
rx="5.4344773"
cy="91.733978"
cx="44.573582"
id="path4736-6"
style="opacity:1;fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.29205444;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
<path
sodipodi:nodetypes="cccccccc"
inkscape:original-d="m 50.579488,94.565824 c -2.64e-4,2.64e-4 -0.303197,-0.388803 -0.455192,-0.582808 -0.151994,-0.194005 -0.186907,-0.584452 -0.280754,-0.87628 -0.09385,-0.291827 -1.18252,1.954034 -1.774173,2.931449 -0.591655,0.977412 0.18156,0.02148 0.271947,0.03263 0.09038,0.01114 0.463641,0.08384 0.695067,0.126156 0.231426,0.04232 1.029,-1.087698 1.543105,-1.631151 z"
inkscape:path-effect="#path-effect4740-4-8-2"
inkscape:connector-curvature="0"
id="path4738-6"
d="m 50.579488,94.565824 c -0.19561,-0.153916 -0.353242,-0.35574 -0.455192,-0.582808 -0.125746,-0.280068 -0.16588,-0.59158 -0.280754,-0.87628 -0.129281,-0.320405 -0.353925,-0.601278 -0.636711,-0.799785 -0.282786,-0.198507 -0.622572,-0.314232 -0.967619,-0.332011 -0.345046,-0.01778 -0.694281,0.06215 -0.99841,0.226092 -0.304129,0.163948 -0.56245,0.411219 -0.741612,0.706641 -0.179162,0.295422 -0.278954,0.638128 -0.288835,0.98349 -0.0099,0.345363 0.06991,0.692617 0.227397,1.000143 0.314966,0.615052 0.947156,1.051981 1.631617,1.146879 0.09044,0.01254 0.181591,0.01951 0.271947,0.03263 0.233191,0.03386 0.460094,0.108482 0.695067,0.126156 0.427171,0.03213 0.865211,-0.137278 1.159604,-0.44847 0.294394,-0.311191 0.439261,-0.757947 0.383501,-1.182681 z"
style="fill:#a0cafd;fill-opacity:1;stroke:#a0cafd;stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -0,0 +1,319 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg"
width="1280"
height="640"
viewBox="0 0 338.66666 169.33335"
version="1.1"
id="svg5014"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="RoyalnetTemplateOpenGraph.svg"
inkscape:export-filename="D:\Immagini\Royal Games\RoyalnetOpenGraph.png"
inkscape:export-xdpi="211.64999"
inkscape:export-ydpi="211.64999">
<defs
id="defs5008">
<linearGradient
id="linearGradient2343">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2341"/>
</linearGradient>
<linearGradient
id="linearGradient2337"
osb:paint="solid">
<stop
style="stop-color:#a0cafd;stop-opacity:1;"
offset="0"
id="stop2335"/>
</linearGradient>
<inkscape:path-effect
effect="spiro"
id="path-effect4740-4-9"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4814-3-0"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4740-4-3-2"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4814-3-8-6"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4814-3-2-3"
is_visible="true"/>
<inkscape:path-effect
effect="spiro"
id="path-effect4740-4-8-2"
is_visible="true"/>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2337"
id="linearGradient2339"
x1="26.221311"
y1="215.38629"
x2="260.77929"
y2="215.38629"
gradientUnits="userSpaceOnUse"/>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="393.17652"
inkscape:cy="331.37903"
inkscape:document-units="px"
inkscape:current-layer="g5736"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1272"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"/>
<metadata
id="metadata5011">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Livello 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0.0932605,-127.66807)"
style="display:inline">
<rect
style="opacity:1;fill:#0d193b;fill-opacity:1;stroke:#a0cafd;stroke-width:0.06771223;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect5872"
width="338.59897"
height="169.26562"
x="-0.059404384"
y="127.7019"/>
</g>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="Livello 2"
transform="translate(0.0932605,37.040251)">
<g
transform="translate(39.454539,-188.4695)"
id="g5736"
style="stroke:url(#linearGradient2337)">
<text
transform="scale(0.90442695,1.1056725)"
id="text4732"
y="238.2995"
x="23.705601"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:13.64452839px;line-height:1.25;font-family:Impact;-inkscape-font-specification:'Impact Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.34111318;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:65.49373627px;fill:none;fill-opacity:1;stroke-width:0.34111318;stroke:url(#linearGradient2337);stroke-opacity:1"
y="238.2995"
x="23.705601"
id="tspan4730"
sodipodi:role="line">Royalnet</tspan></text>
<g
transform="translate(-2.0864727,107.37549)"
id="g4801"
style="display:inline;stroke:url(#linearGradient2337);fill:none">
<g
transform="translate(0,-1.5472047)"
id="g4806"
style="stroke:url(#linearGradient2337);fill:none">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4734"
d="m 72.008205,108.22192 c -1.298662,-0.12455 -2.528663,-0.16144 -4.015472,-0.0311 L 49.036385,96.196667 50.579489,94.565515 Z"
style="fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
<ellipse
ry="5.6216612"
rx="5.4344773"
cy="91.733978"
cx="44.573582"
id="path4736"
style="opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.29205444;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
<path
sodipodi:nodetypes="cccccccc"
inkscape:original-d="m 50.579488,94.565824 c -2.64e-4,2.64e-4 -0.303197,-0.388803 -0.455192,-0.582808 -0.151994,-0.194005 -0.186907,-0.584452 -0.280754,-0.87628 -0.09385,-0.291827 -1.18252,1.954034 -1.774173,2.931449 -0.591655,0.977412 0.18156,0.02148 0.271947,0.03263 0.09038,0.01114 0.463641,0.08384 0.695067,0.126156 0.231426,0.04232 1.029,-1.087698 1.543105,-1.631151 z"
inkscape:path-effect="#path-effect4740-4-9"
inkscape:connector-curvature="0"
id="path4738"
d="m 50.579488,94.565824 c -0.19561,-0.153916 -0.353242,-0.35574 -0.455192,-0.582808 -0.125746,-0.280068 -0.16588,-0.59158 -0.280754,-0.87628 -0.129281,-0.320405 -0.353925,-0.601278 -0.636711,-0.799785 -0.282786,-0.198507 -0.622572,-0.314232 -0.967619,-0.332011 -0.345046,-0.01778 -0.694281,0.06215 -0.99841,0.226092 -0.304129,0.163948 -0.56245,0.411219 -0.741612,0.706641 -0.179162,0.295422 -0.278954,0.638128 -0.288835,0.98349 -0.0099,0.345363 0.06991,0.692617 0.227397,1.000143 0.314966,0.615052 0.947156,1.051981 1.631617,1.146879 0.09044,0.01254 0.181591,0.01951 0.271947,0.03263 0.233191,0.03386 0.460094,0.108482 0.695067,0.126156 0.427171,0.03213 0.865211,-0.137278 1.159604,-0.44847 0.294394,-0.311191 0.439261,-0.757947 0.383501,-1.182681 z"
style="fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
</g>
</g>
<g
transform="translate(-41.369474,20.791663)"
id="g4849"
style="display:inline;stroke:url(#linearGradient2337);fill:none">
<path
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 156.24182,195.63617 c 0.52356,-0.68844 1.23943,-1.19659 2.1157,-1.55436 l -0.90168,-4.19832 -1.77591,-10.28568 -2.42533,0.43459 z"
id="path4808"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc"/>
<ellipse
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.08753412;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4810"
cx="153.28587"
cy="173.23436"
rx="5.5337849"
ry="5.5682526"/>
<path
sodipodi:nodetypes="cccscccc"
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.67993,179.59781 c 8.7e-4,-0.57128 0.17574,-1.14113 0.49545,-1.61457 0.12269,-0.18168 0.26704,-0.35116 0.35688,-0.55113 0.10917,-0.243 0.13066,-0.52256 0.0702,-0.782 -0.0605,-0.25945 -0.20113,-0.49812 -0.39142,-0.68455 -0.19029,-0.18643 -0.42903,-0.32114 -0.68406,-0.39812 -0.25504,-0.077 -0.52597,-0.097 -0.79092,-0.0693 -0.52991,0.0554 -1.02665,0.29884 -1.4524,0.61918 -0.42574,0.32034 -0.78783,0.71643 -1.14052,1.11579 -0.12177,0.13788 -0.24392,0.27814 -0.32933,0.44106 -0.0854,0.16292 -0.13193,0.35296 -0.0925,0.53264 0.0305,0.13914 0.11075,0.26386 0.21093,0.36514 0.10017,0.10128 0.21994,0.18096 0.3424,0.25374 0.12245,0.0728 0.24866,0.13949 0.36697,0.21884 0.1183,0.0794 0.22952,0.17245 0.31184,0.28871 0.14705,0.20767 0.1902,0.47019 0.30118,0.69917 0.12063,0.2489 0.32431,0.45666 0.57078,0.58219 0.24646,0.12554 0.53427,0.16812 0.80653,0.11934 0.27225,-0.0488 0.52737,-0.18866 0.71491,-0.39196 0.18754,-0.20331 0.30641,-0.46886 0.33311,-0.74416"
id="path4812"
inkscape:connector-curvature="0"
inkscape:path-effect="#path-effect4814-3-0"
inkscape:original-d="m 155.67993,179.59781 c 0.16078,-0.54597 0.33056,-1.07665 0.49545,-1.61457 0.16488,-0.53793 0.28228,-0.50274 0.35688,-0.55113 0.0746,-0.0484 -2.96992,0.002 -4.38913,-0.19901 -1.41921,-0.20112 -0.51799,0.47248 -0.42185,0.9737 0.0961,0.50123 1.05871,0.92708 1.23214,1.12643 0.17342,0.19934 0.20105,0.46584 0.30118,0.69917 0.10013,0.23332 1.61715,-0.28999 2.42533,-0.43459"/>
</g>
<g
transform="matrix(-1,0,0,1,224.10371,96.838062)"
id="g4801-9"
style="display:inline;stroke:url(#linearGradient2337);fill:none">
<g
transform="rotate(24.954103,74.609956,111.66802)"
id="g4806-3"
style="stroke:url(#linearGradient2337);fill:none">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4734-0"
d="m 72.008205,108.22192 -2.297446,1.06532 -20.674374,-13.090573 1.543104,-1.631152 z"
style="fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
<ellipse
ry="5.6216612"
rx="5.4344773"
cy="91.733978"
cx="44.573582"
id="path4736-1"
style="opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.29205444;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
<path
sodipodi:nodetypes="cccccccc"
inkscape:original-d="m 50.579488,94.565824 c -2.64e-4,2.64e-4 -0.303197,-0.388803 -0.455192,-0.582808 -0.151994,-0.194005 -0.186907,-0.584452 -0.280754,-0.87628 -0.09385,-0.291827 -1.18252,1.954034 -1.774173,2.931449 -0.591655,0.977412 0.18156,0.02148 0.271947,0.03263 0.09038,0.01114 0.463641,0.08384 0.695067,0.126156 0.231426,0.04232 1.029,-1.087698 1.543105,-1.631151 z"
inkscape:path-effect="#path-effect4740-4-3-2"
inkscape:connector-curvature="0"
id="path4738-5"
d="m 50.579488,94.565824 c -0.19561,-0.153916 -0.353242,-0.35574 -0.455192,-0.582808 -0.125746,-0.280068 -0.16588,-0.59158 -0.280754,-0.87628 -0.129281,-0.320405 -0.353925,-0.601278 -0.636711,-0.799785 -0.282786,-0.198507 -0.622572,-0.314232 -0.967619,-0.332011 -0.345046,-0.01778 -0.694281,0.06215 -0.99841,0.226092 -0.304129,0.163948 -0.56245,0.411219 -0.741612,0.706641 -0.179162,0.295422 -0.278954,0.638128 -0.288835,0.98349 -0.0099,0.345363 0.06991,0.692617 0.227397,1.000143 0.314966,0.615052 0.947156,1.051981 1.631617,1.146879 0.09044,0.01254 0.181591,0.01951 0.271947,0.03263 0.233191,0.03386 0.460094,0.108482 0.695067,0.126156 0.427171,0.03213 0.865211,-0.137278 1.159604,-0.44847 0.294394,-0.311191 0.439261,-0.757947 0.383501,-1.182681 z"
style="fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
</g>
</g>
<g
inkscape:transform-center-y="-6.6298922"
inkscape:transform-center-x="-14.065358"
transform="matrix(-0.84226589,-0.53906235,-0.53906235,0.84226589,422.81566,139.44738)"
id="g4849-9"
style="display:inline;stroke:url(#linearGradient2337);fill:none">
<path
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 156.01691,195.44483 c 0,0 1.03691,-0.78683 2.34061,-1.36302 l -0.90168,-4.19832 -1.77591,-10.28568 -2.42533,0.43459 z"
id="path4808-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc"/>
<ellipse
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.08753412;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4810-9"
cx="153.28587"
cy="173.23436"
rx="5.5337849"
ry="5.5682526"/>
<path
sodipodi:nodetypes="cccscccc"
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.67993,179.59781 c 8.7e-4,-0.57128 0.17574,-1.14113 0.49545,-1.61457 0.12269,-0.18168 0.26704,-0.35116 0.35688,-0.55113 0.10917,-0.243 0.13066,-0.52256 0.0702,-0.782 -0.0605,-0.25945 -0.20113,-0.49812 -0.39142,-0.68455 -0.19029,-0.18643 -0.42903,-0.32114 -0.68406,-0.39812 -0.25504,-0.077 -0.52597,-0.097 -0.79092,-0.0693 -0.52991,0.0554 -1.02665,0.29884 -1.4524,0.61918 -0.42574,0.32034 -0.78783,0.71643 -1.14052,1.11579 -0.12177,0.13788 -0.24392,0.27814 -0.32933,0.44106 -0.0854,0.16292 -0.13193,0.35296 -0.0925,0.53264 0.0305,0.13914 0.11075,0.26386 0.21093,0.36514 0.10017,0.10128 0.21994,0.18096 0.3424,0.25374 0.12245,0.0728 0.24866,0.13949 0.36697,0.21884 0.1183,0.0794 0.22952,0.17245 0.31184,0.28871 0.14705,0.20767 0.1902,0.47019 0.30118,0.69917 0.12063,0.2489 0.32431,0.45666 0.57078,0.58219 0.24646,0.12554 0.53427,0.16812 0.80653,0.11934 0.27225,-0.0488 0.52737,-0.18866 0.71491,-0.39196 0.18754,-0.20331 0.30641,-0.46886 0.33311,-0.74416"
id="path4812-9"
inkscape:connector-curvature="0"
inkscape:path-effect="#path-effect4814-3-8-6"
inkscape:original-d="m 155.67993,179.59781 c 0.16078,-0.54597 0.33056,-1.07665 0.49545,-1.61457 0.16488,-0.53793 0.28228,-0.50274 0.35688,-0.55113 0.0746,-0.0484 -2.96992,0.002 -4.38913,-0.19901 -1.41921,-0.20112 -0.51799,0.47248 -0.42185,0.9737 0.0961,0.50123 1.05871,0.92708 1.23214,1.12643 0.17342,0.19934 0.20105,0.46584 0.30118,0.69917 0.10013,0.23332 1.61715,-0.28999 2.42533,-0.43459"/>
</g>
<g
transform="rotate(-130.0044,153.8328,239.47705)"
id="g4849-4"
style="display:inline;stroke:url(#linearGradient2337);fill:none">
<path
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 156.32889,195.84023 c 0.55471,-0.68202 1.24114,-1.24509 2.02863,-1.75842 l -0.90168,-4.19832 -1.77591,-10.28568 -2.42533,0.43459 z"
id="path4808-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc"/>
<ellipse
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.08753412;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4810-6"
cx="153.28587"
cy="173.23436"
rx="5.5337849"
ry="5.5682526"/>
<path
sodipodi:nodetypes="cccscccc"
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.67993,179.59781 c 8.7e-4,-0.57128 0.17574,-1.14113 0.49545,-1.61457 0.12269,-0.18168 0.26704,-0.35116 0.35688,-0.55113 0.10917,-0.243 0.13066,-0.52256 0.0702,-0.782 -0.0605,-0.25945 -0.20113,-0.49812 -0.39142,-0.68455 -0.19029,-0.18643 -0.42903,-0.32114 -0.68406,-0.39812 -0.25504,-0.077 -0.52597,-0.097 -0.79092,-0.0693 -0.52991,0.0554 -1.02665,0.29884 -1.4524,0.61918 -0.42574,0.32034 -0.78783,0.71643 -1.14052,1.11579 -0.12177,0.13788 -0.24392,0.27814 -0.32933,0.44106 -0.0854,0.16292 -0.13193,0.35296 -0.0925,0.53264 0.0305,0.13914 0.11075,0.26386 0.21093,0.36514 0.10017,0.10128 0.21994,0.18096 0.3424,0.25374 0.12245,0.0728 0.24866,0.13949 0.36697,0.21884 0.1183,0.0794 0.22952,0.17245 0.31184,0.28871 0.14705,0.20767 0.1902,0.47019 0.30118,0.69917 0.12063,0.2489 0.32431,0.45666 0.57078,0.58219 0.24646,0.12554 0.53427,0.16812 0.80653,0.11934 0.27225,-0.0488 0.52737,-0.18866 0.71491,-0.39196 0.18754,-0.20331 0.30641,-0.46886 0.33311,-0.74416"
id="path4812-3"
inkscape:connector-curvature="0"
inkscape:path-effect="#path-effect4814-3-2-3"
inkscape:original-d="m 155.67993,179.59781 c 0.16078,-0.54597 0.33056,-1.07665 0.49545,-1.61457 0.16488,-0.53793 0.28228,-0.50274 0.35688,-0.55113 0.0746,-0.0484 -2.96992,0.002 -4.38913,-0.19901 -1.41921,-0.20112 -0.51799,0.47248 -0.42185,0.9737 0.0961,0.50123 1.05871,0.92708 1.23214,1.12643 0.17342,0.19934 0.20105,0.46584 0.30118,0.69917 0.10013,0.23332 1.61715,-0.28999 2.42533,-0.43459"/>
</g>
<g
transform="rotate(180,116.68483,185.47497)"
id="g4801-1"
style="display:inline;stroke:url(#linearGradient2337);fill:none">
<g
transform="translate(0,-1.5472047)"
id="g4806-9"
style="stroke:url(#linearGradient2337);fill:none">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4734-4"
d="m 72.008205,108.22192 -4.027874,0.002 -18.943946,-12.027223 1.543104,-1.631152 z"
style="fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
<ellipse
ry="5.6216612"
rx="5.4344773"
cy="91.733978"
cx="44.573582"
id="path4736-6"
style="opacity:1;fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.29205444;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
<path
sodipodi:nodetypes="cccccccc"
inkscape:original-d="m 50.579488,94.565824 c -2.64e-4,2.64e-4 -0.303197,-0.388803 -0.455192,-0.582808 -0.151994,-0.194005 -0.186907,-0.584452 -0.280754,-0.87628 -0.09385,-0.291827 -1.18252,1.954034 -1.774173,2.931449 -0.591655,0.977412 0.18156,0.02148 0.271947,0.03263 0.09038,0.01114 0.463641,0.08384 0.695067,0.126156 0.231426,0.04232 1.029,-1.087698 1.543105,-1.631151 z"
inkscape:path-effect="#path-effect4740-4-8-2"
inkscape:connector-curvature="0"
id="path4738-6"
d="m 50.579488,94.565824 c -0.19561,-0.153916 -0.353242,-0.35574 -0.455192,-0.582808 -0.125746,-0.280068 -0.16588,-0.59158 -0.280754,-0.87628 -0.129281,-0.320405 -0.353925,-0.601278 -0.636711,-0.799785 -0.282786,-0.198507 -0.622572,-0.314232 -0.967619,-0.332011 -0.345046,-0.01778 -0.694281,0.06215 -0.99841,0.226092 -0.304129,0.163948 -0.56245,0.411219 -0.741612,0.706641 -0.179162,0.295422 -0.278954,0.638128 -0.288835,0.98349 -0.0099,0.345363 0.06991,0.692617 0.227397,1.000143 0.314966,0.615052 0.947156,1.051981 1.631617,1.146879 0.09044,0.01254 0.181591,0.01951 0.271947,0.03263 0.233191,0.03386 0.460094,0.108482 0.695067,0.126156 0.427171,0.03213 0.865211,-0.137278 1.159604,-0.44847 0.294394,-0.311191 0.439261,-0.757947 0.383501,-1.182681 z"
style="fill:none;fill-opacity:1;stroke:url(#linearGradient2337);stroke-width:0.26406372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -4,7 +4,7 @@
* *
* Sphinx stylesheet -- basic theme. * Sphinx stylesheet -- basic theme.
* *
* :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */

View file

@ -4,7 +4,7 @@
* *
* Sphinx JavaScript utilities for all documentation. * Sphinx JavaScript utilities for all documentation.
* *
* :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */
@ -283,10 +283,11 @@ var Documentation = {
}, },
initOnKeyListeners: function() { initOnKeyListeners: function() {
$(document).keyup(function(event) { $(document).keydown(function(event) {
var activeElementType = document.activeElement.tagName; var activeElementType = document.activeElement.tagName;
// don't navigate when in search box or textarea // don't navigate when in search box or textarea
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
&& !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
switch (event.keyCode) { switch (event.keyCode) {
case 37: // left case 37: // left
var prevHref = $('link[rel="prev"]').prop('href'); var prevHref = $('link[rel="prev"]').prop('href');

View file

@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '5.6.2', VERSION: '5.10.4',
LANGUAGE: 'None', LANGUAGE: 'None',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
BUILDER: 'html', BUILDER: 'html',

View file

@ -5,7 +5,7 @@
* This script contains the language-specific data used by searchtools.js, * This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter. * namely the list of stopwords, stemmer, scorer and splitter.
* *
* :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */

View file

@ -4,7 +4,7 @@
* *
* Sphinx JavaScript utilities for the full-text search. * Sphinx JavaScript utilities for the full-text search.
* *
* :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */
@ -63,6 +63,11 @@ var Search = {
htmlElement.innerHTML = htmlString; htmlElement.innerHTML = htmlString;
$(htmlElement).find('.headerlink').remove(); $(htmlElement).find('.headerlink').remove();
docContent = $(htmlElement).find('[role=main]')[0]; docContent = $(htmlElement).find('[role=main]')[0];
if(docContent === undefined) {
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
return "";
}
return docContent.textContent || docContent.innerText; return docContent.textContent || docContent.innerText;
}, },
@ -245,6 +250,7 @@ var Search = {
if (results.length) { if (results.length) {
var item = results.pop(); var item = results.pop();
var listItem = $('<li style="display:none"></li>'); var listItem = $('<li style="display:none"></li>');
var requestUrl = "";
if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') { if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
// dirhtml builder // dirhtml builder
var dirname = item[0] + '/'; var dirname = item[0] + '/';
@ -253,15 +259,15 @@ var Search = {
} else if (dirname == 'index/') { } else if (dirname == 'index/') {
dirname = ''; dirname = '';
} }
listItem.append($('<a/>').attr('href', requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + dirname;
DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
highlightstring + item[2]).html(item[1]));
} else { } else {
// normal html builders // normal html builders
listItem.append($('<a/>').attr('href', requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
highlightstring + item[2]).html(item[1]));
} }
listItem.append($('<a/>').attr('href',
requestUrl +
highlightstring + item[2]).html(item[1]));
if (item[3]) { if (item[3]) {
listItem.append($('<span> (' + item[3] + ')</span>')); listItem.append($('<span> (' + item[3] + ')</span>'));
Search.output.append(listItem); Search.output.append(listItem);
@ -269,7 +275,7 @@ var Search = {
displayNextItem(); displayNextItem();
}); });
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX, $.ajax({url: requestUrl,
dataType: "text", dataType: "text",
complete: function(jqxhr, textstatus) { complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText; var data = jqxhr.responseText;

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Reference &mdash; Royalnet 5.6.2 documentation</title> <title>API Reference &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script> <script src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script> <script src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script>
@ -60,7 +60,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -181,8 +181,8 @@ then run:</p>
<dl class="class"> <dl class="class">
<dt id="royalnet.alchemy.Alchemy"> <dt id="royalnet.alchemy.Alchemy">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">Alchemy</code><span class="sig-paren">(</span><em class="sig-param">database_uri: str</em>, <em class="sig-param">tables: Set</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="sig-prename descclassname">royalnet.alchemy.</code><code class="sig-name descname">Alchemy</code><span class="sig-paren">(</span><em class="sig-param">database_uri: str</em>, <em class="sig-param">tables: Set</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy" title="Permalink to this definition"></a></dt>
<dd><p>A wrapper around <a class="reference external" href="https://docs.sqlalchemy.org/en/13/orm/scalar_mapping.html#module-sqlalchemy.orm" title="(in SQLAlchemy v1.3)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlalchemy.orm</span></code></a> that allows the instantiation of multiple engines at once while maintaining <dd><p>A wrapper around <code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlalchemy.orm</span></code> that allows the instantiation of multiple engines at once while
a single declarative class for all of them.</p> maintaining a single declarative class for all of them.</p>
<dl class="method"> <dl class="method">
<dt id="royalnet.alchemy.Alchemy.__init__"> <dt id="royalnet.alchemy.Alchemy.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">database_uri: str</em>, <em class="sig-param">tables: Set</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.__init__" title="Permalink to this definition"></a></dt> <code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">database_uri: str</em>, <em class="sig-param">tables: Set</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.__init__" title="Permalink to this definition"></a></dt>
@ -214,7 +214,7 @@ Check the tables submodule for more details.</p></li>
<dl class="method"> <dl class="method">
<dt id="royalnet.alchemy.Alchemy.session_acm"> <dt id="royalnet.alchemy.Alchemy.session_acm">
<code class="sig-name descname">session_acm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.session_acm" title="Permalink to this definition"></a></dt> <code class="sig-name descname">session_acm</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; AsyncIterator[sqlalchemy.orm.session.Session]<a class="headerlink" href="#royalnet.alchemy.Alchemy.session_acm" title="Permalink to this definition"></a></dt>
<dd><p>Create a Session as a async context manager (that can be used in <code class="docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code> statements).</p> <dd><p>Create a Session as a async context manager (that can be used in <code class="docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code> statements).</p>
<p>The Session will be closed safely when the context manager exits (even in case of error).</p> <p>The Session will be closed safely when the context manager exits (even in case of error).</p>
<p class="rubric">Example</p> <p class="rubric">Example</p>
@ -230,7 +230,7 @@ Check the tables submodule for more details.</p></li>
<dl class="method"> <dl class="method">
<dt id="royalnet.alchemy.Alchemy.session_cm"> <dt id="royalnet.alchemy.Alchemy.session_cm">
<code class="sig-name descname">session_cm</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.alchemy.Alchemy.session_cm" title="Permalink to this definition"></a></dt> <code class="sig-name descname">session_cm</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Iterator[sqlalchemy.orm.session.Session]<a class="headerlink" href="#royalnet.alchemy.Alchemy.session_cm" title="Permalink to this definition"></a></dt>
<dd><p>Create a Session as a context manager (that can be used in <code class="docutils literal notranslate"><span class="pre">with</span></code> statements).</p> <dd><p>Create a Session as a context manager (that can be used in <code class="docutils literal notranslate"><span class="pre">with</span></code> statements).</p>
<p>The Session will be closed safely when the context manager exits (even in case of error).</p> <p>The Session will be closed safely when the context manager exits (even in case of error).</p>
<p class="rubric">Example</p> <p class="rubric">Example</p>
@ -298,7 +298,7 @@ Check the tables submodule for more details.</p></li>
<dl class="method"> <dl class="method">
<dt id="royalnet.bard.YtdlInfo.from_url"> <dt id="royalnet.bard.YtdlInfo.from_url">
<em class="property">classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url</em>, <em class="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlinfo.YtdlInfo]<a class="headerlink" href="#royalnet.bard.YtdlInfo.from_url" title="Permalink to this definition"></a></dt> <em class="property">async classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url</em>, <em class="sig-param">loop: Optional[asyncio.events.AbstractEventLoop] = None</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlinfo.YtdlInfo]<a class="headerlink" href="#royalnet.bard.YtdlInfo.from_url" title="Permalink to this definition"></a></dt>
<dd><p>Fetch the info for an url through <code class="xref py py-class docutils literal notranslate"><span class="pre">YoutubeDL</span></code>.</p> <dd><p>Fetch the info for an url through <code class="xref py py-class docutils literal notranslate"><span class="pre">YoutubeDL</span></code>.</p>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">Returns</dt> <dt class="field-odd">Returns</dt>
@ -354,7 +354,7 @@ Check the tables submodule for more details.</p></li>
<dl class="method"> <dl class="method">
<dt id="royalnet.bard.YtdlFile.from_url"> <dt id="royalnet.bard.YtdlFile.from_url">
<em class="property">classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url: str</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlfile.YtdlFile]<a class="headerlink" href="#royalnet.bard.YtdlFile.from_url" title="Permalink to this definition"></a></dt> <em class="property">async classmethod </em><code class="sig-name descname">from_url</code><span class="sig-paren">(</span><em class="sig-param">url: str</em>, <em class="sig-param">**ytdl_args</em><span class="sig-paren">)</span> &#x2192; List[royalnet.bard.ytdlfile.YtdlFile]<a class="headerlink" href="#royalnet.bard.YtdlFile.from_url" title="Permalink to this definition"></a></dt>
<dd><p>Create a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <a class="reference internal" href="#royalnet.bard.YtdlFile" title="royalnet.bard.YtdlFile"><code class="xref py py-class docutils literal notranslate"><span class="pre">YtdlFile</span></code></a> from a URL.</p> <dd><p>Create a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <a class="reference internal" href="#royalnet.bard.YtdlFile" title="royalnet.bard.YtdlFile"><code class="xref py py-class docutils literal notranslate"><span class="pre">YtdlFile</span></code></a> from a URL.</p>
</dd></dl> </dd></dl>
@ -411,84 +411,9 @@ Check the tables submodule for more details.</p></li>
<div class="section" id="module-royalnet.commands"> <div class="section" id="module-royalnet.commands">
<span id="commands"></span><h2>Commands<a class="headerlink" href="#module-royalnet.commands" title="Permalink to this headline"></a></h2> <span id="commands"></span><h2>Commands<a class="headerlink" href="#module-royalnet.commands" title="Permalink to this headline"></a></h2>
<p>The subpackage providing all classes related to Royalnet commands.</p> <p>The subpackage providing all classes related to Royalnet commands.</p>
<dl class="class">
<dt id="royalnet.commands.CommandInterface">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandInterface</code><span class="sig-paren">(</span><em class="sig-param">config: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandInterface" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.commands.CommandInterface.alchemy">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.CommandInterface.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">serf.alchemy</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.call_herald_event">
<em class="property">async </em><code class="sig-name descname">call_herald_event</code><span class="sig-paren">(</span><em class="sig-param">destination: str</em>, <em class="sig-param">event_name: str</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.commands.CommandInterface.call_herald_event" title="Permalink to this definition"></a></dt>
<dd><p>Call an event function on a different <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a>.</p>
<p class="rubric">Example</p>
<p>You can run a function on a <code class="xref py py-class docutils literal notranslate"><span class="pre">DiscordSerf</span></code> from a
<code class="xref py py-class docutils literal notranslate"><span class="pre">TelegramSerf</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.config">
<code class="sig-name descname">config</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.CommandInterface.config" title="Permalink to this definition"></a></dt>
<dd><p>The config section for the pack of the command.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.constellation">
<code class="sig-name descname">constellation</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.CommandInterface.constellation" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the Constellation that is implementing this <a class="reference internal" href="#royalnet.commands.CommandInterface" title="royalnet.commands.CommandInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code></a>.</p>
<p class="rubric">Example</p>
<p>A reference to a <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>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.loop">
<em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.CommandInterface.loop" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">serf.loop</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.name">
<code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.CommandInterface.name" title="Permalink to this definition"></a></dt>
<dd><p>The name of the <a class="reference internal" href="#royalnet.commands.CommandInterface" title="royalnet.commands.CommandInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code></a> thats being implemented.</p>
<p class="rubric">Examples</p>
<p><code class="docutils literal notranslate"><span class="pre">telegram</span></code>, <code class="docutils literal notranslate"><span class="pre">discord</span></code>, <code class="docutils literal notranslate"><span class="pre">console</span></code></p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.prefix">
<code class="sig-name descname">prefix</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.CommandInterface.prefix" title="Permalink to this definition"></a></dt>
<dd><p>The prefix used by commands on the interface.</p>
<p class="rubric">Examples</p>
<p><code class="docutils literal notranslate"><span class="pre">/</span></code> on Telegram, <code class="docutils literal notranslate"><span class="pre">!</span></code> on Discord.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.CommandInterface.serf">
<code class="sig-name descname">serf</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.CommandInterface.serf" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a> that is implementing this <a class="reference internal" href="#royalnet.commands.CommandInterface" title="royalnet.commands.CommandInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code></a>.</p>
<p class="rubric">Example</p>
<p>A reference to a <code class="xref py py-class docutils literal notranslate"><span class="pre">TelegramSerf</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandInterface.table">
<em class="property">property </em><code class="sig-name descname">table</code><a class="headerlink" href="#royalnet.commands.CommandInterface.table" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-func docutils literal notranslate"><span class="pre">serf.alchemy.get()</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference internal" href="#royalnet.commands.UnsupportedError" title="royalnet.commands.UnsupportedError"><strong>UnsupportedError</strong></a> if <a class="reference internal" href="#royalnet.constellation.Constellation.alchemy" title="royalnet.constellation.Constellation.alchemy"><code class="xref py py-attr docutils literal notranslate"><span class="pre">alchemy</span></code></a> is <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class"> <dl class="class">
<dt id="royalnet.commands.Command"> <dt id="royalnet.commands.Command">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">Command</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.commands.Command" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">Command</code><span class="sig-paren">(</span><em class="sig-param">serf: Serf</em>, <em class="sig-param">config: ConfigDict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.Command" title="Permalink to this definition"></a></dt>
<dd><dl class="method"> <dd><dl class="method">
<dt id="royalnet.commands.Command.alchemy"> <dt id="royalnet.commands.Command.alchemy">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.Command.alchemy" title="Permalink to this definition"></a></dt> <em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.Command.alchemy" title="Permalink to this definition"></a></dt>
@ -497,21 +422,15 @@ Check the tables submodule for more details.</p></li>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.commands.Command.aliases"> <dt id="royalnet.commands.Command.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = []</em><a class="headerlink" href="#royalnet.commands.Command.aliases" title="Permalink to this definition"></a></dt> <code class="sig-name descname">aliases</code><em class="property">: List[str]</em><em class="property"> = []</em><a class="headerlink" href="#royalnet.commands.Command.aliases" title="Permalink to this definition"></a></dt>
<dd><p>A list of possible aliases for a command.</p> <dd><p>A list of possible aliases for a command.</p>
<p class="rubric">Example</p> <p class="rubric">Example</p>
<p>To be able to call <code class="docutils literal notranslate"><span class="pre">/e</span></code> as an alias for <code class="docutils literal notranslate"><span class="pre">/example</span></code>, one should set aliases to <code class="docutils literal notranslate"><span class="pre">[&quot;e&quot;]</span></code>.</p> <p>To be able to call <code class="docutils literal notranslate"><span class="pre">/e</span></code> as an alias for <code class="docutils literal notranslate"><span class="pre">/example</span></code>, one should set aliases to <code class="docutils literal notranslate"><span class="pre">[&quot;e&quot;]</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="royalnet.commands.Command.config">
<em class="property">property </em><code class="sig-name descname">config</code><a class="headerlink" href="#royalnet.commands.Command.config" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.config</span></code>.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.commands.Command.description"> <dt id="royalnet.commands.Command.description">
<code class="sig-name descname">description</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Command.description" title="Permalink to this definition"></a></dt> <code class="sig-name descname">description</code><em class="property">: str</em><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Command.description" title="Permalink to this definition"></a></dt>
<dd><p>A small description of the command, to be displayed when the command is being autocompleted.</p> <dd><p>A small description of the command, to be displayed when the command is being autocompleted.</p>
</dd></dl> </dd></dl>
@ -523,7 +442,7 @@ Check the tables submodule for more details.</p></li>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.commands.Command.name"> <dt id="royalnet.commands.Command.name">
<code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Command.name" title="Permalink to this definition"></a></dt> <code class="sig-name descname">name</code><em class="property">: str</em><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Command.name" title="Permalink to this definition"></a></dt>
<dd><p>The main name of the command.</p> <dd><p>The main name of the command.</p>
<p class="rubric">Example</p> <p class="rubric">Example</p>
<p>To be able to call <code class="docutils literal notranslate"><span class="pre">/example</span></code> on Telegram, the name should be <code class="docutils literal notranslate"><span class="pre">&quot;example&quot;</span></code>.</p> <p>To be able to call <code class="docutils literal notranslate"><span class="pre">/example</span></code> on Telegram, the name should be <code class="docutils literal notranslate"><span class="pre">&quot;example&quot;</span></code>.</p>
@ -531,18 +450,12 @@ Check the tables submodule for more details.</p></li>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.Command.run"> <dt id="royalnet.commands.Command.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">args: royalnet.commands.commandargs.CommandArgs</em>, <em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.Command.run" title="Permalink to this definition"></a></dt> <em class="property">abstract async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">args: royalnet.commands.commandargs.CommandArgs</em>, <em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.Command.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.Command.serf">
<em class="property">property </em><code class="sig-name descname">serf</code><a class="headerlink" href="#royalnet.commands.Command.serf" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.serf</span></code>.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.commands.Command.syntax"> <dt id="royalnet.commands.Command.syntax">
<code class="sig-name descname">syntax</code><em class="property"> = ''</em><a class="headerlink" href="#royalnet.commands.Command.syntax" title="Permalink to this definition"></a></dt> <code class="sig-name descname">syntax</code><em class="property">: str</em><em class="property"> = ''</em><a class="headerlink" href="#royalnet.commands.Command.syntax" title="Permalink to this definition"></a></dt>
<dd><p>The syntax of the command, to be displayed when a <a class="reference internal" href="#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> is raised, <dd><p>The syntax of the command, to be displayed when a <a class="reference internal" href="#royalnet.commands.InvalidInputError" title="royalnet.commands.InvalidInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidInputError</span></code></a> is raised,
in the format <code class="docutils literal notranslate"><span class="pre">(required_arg)</span> <span class="pre">[optional_arg]</span></code>.</p> in the format <code class="docutils literal notranslate"><span class="pre">(required_arg)</span> <span class="pre">[optional_arg]</span></code>.</p>
</dd></dl> </dd></dl>
@ -551,7 +464,7 @@ in the format <code class="docutils literal notranslate"><span class="pre">(requ
<dl class="class"> <dl class="class">
<dt id="royalnet.commands.CommandData"> <dt id="royalnet.commands.CommandData">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandData</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface</em>, <em class="sig-param">loop: asyncio.events.AbstractEventLoop</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">CommandData</code><span class="sig-paren">(</span><em class="sig-param">command</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData" title="Permalink to this definition"></a></dt>
<dd><dl class="method"> <dd><dl class="method">
<dt id="royalnet.commands.CommandData.delete_invoking"> <dt id="royalnet.commands.CommandData.delete_invoking">
<em class="property">async </em><code class="sig-name descname">delete_invoking</code><span class="sig-paren">(</span><em class="sig-param">error_if_unavailable=False</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.delete_invoking" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">delete_invoking</code><span class="sig-paren">(</span><em class="sig-param">error_if_unavailable=False</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.delete_invoking" title="Permalink to this definition"></a></dt>
@ -566,7 +479,7 @@ in the format <code class="docutils literal notranslate"><span class="pre">(requ
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.CommandData.find_user"> <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> &#x2192; Optional[User]<a class="headerlink" href="#royalnet.commands.CommandData.find_user" title="Permalink to this definition"></a></dt> <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> &#x2192; Optional[royalnet.backpack.tables.users.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> <dd><p>Find the User having a specific Alias.</p>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">Parameters</dt> <dt class="field-odd">Parameters</dt>
@ -592,6 +505,16 @@ That probably means, the database row identifying the user.</p>
<code class="sig-name descname">keyboard</code><span class="sig-paren">(</span><em class="sig-param">text, keys: List[KeyboardKey]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.keyboard" title="Permalink to this definition"></a></dt> <code class="sig-name descname">keyboard</code><span class="sig-paren">(</span><em class="sig-param">text, keys: List[KeyboardKey]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.keyboard" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.loop">
<em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.CommandData.loop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.register_keyboard_key">
<em class="property">classmethod </em><code class="sig-name descname">register_keyboard_key</code><span class="sig-paren">(</span><em class="sig-param">identifier: str</em>, <em class="sig-param">key: KeyboardKey</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.register_keyboard_key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.CommandData.reply"> <dt id="royalnet.commands.CommandData.reply">
<em class="property">async </em><code class="sig-name descname">reply</code><span class="sig-paren">(</span><em class="sig-param">text: str</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.reply" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">reply</code><span class="sig-paren">(</span><em class="sig-param">text: str</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.reply" title="Permalink to this definition"></a></dt>
@ -603,6 +526,20 @@ That probably means, the database row identifying the user.</p>
</dl> </dl>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.reply_image">
<em class="property">async </em><code class="sig-name descname">reply_image</code><span class="sig-paren">(</span><em class="sig-param">image: io.IOBase</em>, <em class="sig-param">caption: Optional[str] = None</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.commands.CommandData.reply_image" title="Permalink to this definition"></a></dt>
<dd><p>Send an image (with optionally a caption) to the channel where the call was made.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>image</strong> The bytes of the image to send.</p></li>
<li><p><strong>caption</strong> The caption to attach to the image.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.CommandData.session"> <dt id="royalnet.commands.CommandData.session">
<em class="property">property </em><code class="sig-name descname">session</code><a class="headerlink" href="#royalnet.commands.CommandData.session" title="Permalink to this definition"></a></dt> <em class="property">property </em><code class="sig-name descname">session</code><a class="headerlink" href="#royalnet.commands.CommandData.session" title="Permalink to this definition"></a></dt>
@ -611,15 +548,20 @@ That probably means, the database row identifying the user.</p>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.CommandData.session_close"> <dt id="royalnet.commands.CommandData.session_close">
<em class="property">async </em><code class="sig-name descname">session_close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.session_close" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">session_close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.session_close" title="Permalink to this definition"></a></dt>
<dd><p>Asyncronously close the <code class="xref py py-attr docutils literal notranslate"><span class="pre">session</span></code> of this object.</p> <dd><p>Asyncronously close the <a class="reference internal" href="#royalnet.commands.CommandData.session" title="royalnet.commands.CommandData.session"><code class="xref py py-attr docutils literal notranslate"><span class="pre">session</span></code></a> of this object.</p>
</dd></dl> </dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.CommandData.session_commit"> <dt id="royalnet.commands.CommandData.session_commit">
<em class="property">async </em><code class="sig-name descname">session_commit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.session_commit" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">session_commit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.session_commit" title="Permalink to this definition"></a></dt>
<dd><p>Asyncronously commit the <code class="xref py py-attr docutils literal notranslate"><span class="pre">session</span></code> of this object.</p> <dd><p>Asyncronously commit the <a class="reference internal" href="#royalnet.commands.CommandData.session" title="royalnet.commands.CommandData.session"><code class="xref py py-attr docutils literal notranslate"><span class="pre">session</span></code></a> of this object.</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="royalnet.commands.CommandData.unregister_keyboard_key">
<em class="property">classmethod </em><code class="sig-name descname">unregister_keyboard_key</code><span class="sig-paren">(</span><em class="sig-param">identifier: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.CommandData.unregister_keyboard_key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl> </dd></dl>
<dl class="class"> <dl class="class">
@ -767,61 +709,37 @@ down).</p>
</dd></dl> </dd></dl>
<dl class="class"> <dl class="class">
<dt id="royalnet.commands.Event"> <dt id="royalnet.commands.HeraldEvent">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">Event</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.commands.Event" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">HeraldEvent</code><span class="sig-paren">(</span><em class="sig-param">parent: Union[Serf, Constellation], config</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.HeraldEvent" title="Permalink to this definition"></a></dt>
<dd><p>A remote procedure call triggered by a <a class="reference internal" href="#module-royalnet.herald" title="royalnet.herald"><code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.herald</span></code></a> request.</p> <dd><p>A remote procedure call triggered by a <a class="reference internal" href="#module-royalnet.herald" title="royalnet.herald"><code class="xref py py-mod docutils literal notranslate"><span class="pre">royalnet.herald</span></code></a> request.</p>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.Event.__init__"> <dt id="royalnet.commands.HeraldEvent.alchemy">
<code class="sig-name descname">__init__</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.commands.Event.__init__" title="Permalink to this definition"></a></dt> <em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.HeraldEvent.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>Bind the event to a <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a>.</p> <dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">parent.alchemy</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.Event.alchemy"> <dt id="royalnet.commands.HeraldEvent.loop">
<em class="property">property </em><code class="sig-name descname">alchemy</code><a class="headerlink" href="#royalnet.commands.Event.alchemy" title="Permalink to this definition"></a></dt> <em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.HeraldEvent.loop" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.alchemy</span></code>.</p> <dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">parent.loop</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.Event.config">
<em class="property">property </em><code class="sig-name descname">config</code><a class="headerlink" href="#royalnet.commands.Event.config" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.config</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.commands.Event.interface"> <dt id="royalnet.commands.HeraldEvent.name">
<code class="sig-name descname">interface</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.commands.Event.interface" title="Permalink to this definition"></a></dt> <code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.HeraldEvent.name" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#royalnet.commands.CommandInterface" title="royalnet.commands.CommandInterface"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code></a> available to this <a class="reference internal" href="#royalnet.commands.Event" title="royalnet.commands.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.commands.Event.loop">
<em class="property">property </em><code class="sig-name descname">loop</code><a class="headerlink" href="#royalnet.commands.Event.loop" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.loop</span></code>.</p>
</dd></dl>
<dl class="attribute">
<dt id="royalnet.commands.Event.name">
<code class="sig-name descname">name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.commands.Event.name" title="Permalink to this definition"></a></dt>
<dd><p>The event_name that will trigger this event.</p> <dd><p>The event_name that will trigger this event.</p>
</dd></dl> </dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.commands.Event.run"> <dt id="royalnet.commands.HeraldEvent.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.Event.run" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.HeraldEvent.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method">
<dt id="royalnet.commands.Event.serf">
<em class="property">property </em><code class="sig-name descname">serf</code><a class="headerlink" href="#royalnet.commands.Event.serf" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for <code class="xref py py-attr docutils literal notranslate"><span class="pre">interface.serf</span></code>.</p>
</dd></dl>
</dd></dl> </dd></dl>
<dl class="class"> <dl class="class">
<dt id="royalnet.commands.KeyboardKey"> <dt id="royalnet.commands.KeyboardKey">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">KeyboardKey</code><span class="sig-paren">(</span><em class="sig-param">interface: royalnet.commands.commandinterface.CommandInterface, short: str, text: str, callback: Callable[[royalnet.commands.commanddata.CommandData], Awaitable[None]]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.KeyboardKey" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">KeyboardKey</code><span class="sig-paren">(</span><em class="sig-param">short: str, text: str, callback: Callable[[royalnet.commands.commanddata.CommandData], Awaitable[None]]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.KeyboardKey" title="Permalink to this definition"></a></dt>
<dd><dl class="method"> <dd><dl class="method">
<dt id="royalnet.commands.KeyboardKey.press"> <dt id="royalnet.commands.KeyboardKey.press">
<em class="property">async </em><code class="sig-name descname">press</code><span class="sig-paren">(</span><em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.KeyboardKey.press" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">press</code><span class="sig-paren">(</span><em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.KeyboardKey.press" title="Permalink to this definition"></a></dt>
@ -829,6 +747,16 @@ down).</p>
</dd></dl> </dd></dl>
<dl class="class">
<dt id="royalnet.commands.ConfigDict">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.commands.</code><code class="sig-name descname">ConfigDict</code><a class="headerlink" href="#royalnet.commands.ConfigDict" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.commands.ConfigDict.convert">
<em class="property">classmethod </em><code class="sig-name descname">convert</code><span class="sig-paren">(</span><em class="sig-param">item</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.commands.ConfigDict.convert" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div> </div>
<div class="section" id="module-royalnet.constellation"> <div class="section" id="module-royalnet.constellation">
<span id="constellation"></span><h2>Constellation<a class="headerlink" href="#module-royalnet.constellation" title="Permalink to this headline"></a></h2> <span id="constellation"></span><h2>Constellation<a class="headerlink" href="#module-royalnet.constellation" title="Permalink to this headline"></a></h2>
@ -849,15 +777,9 @@ down).</p>
<dd><p>The class that represents the webserver.</p> <dd><p>The class that represents the webserver.</p>
<p>It runs multiple <a class="reference internal" href="#royalnet.constellation.Star" title="royalnet.constellation.Star"><code class="xref py py-class docutils literal notranslate"><span class="pre">Star</span></code></a>, which represent the routes of the website.</p> <p>It runs multiple <a class="reference internal" href="#royalnet.constellation.Star" title="royalnet.constellation.Star"><code class="xref py py-class docutils literal notranslate"><span class="pre">Star</span></code></a>, which represent the routes of the website.</p>
<p>It also handles the <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> connection, and Herald connections too.</p> <p>It also handles the <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> connection, and Herald connections too.</p>
<dl class="attribute">
<dt id="royalnet.constellation.Constellation.Interface">
<code class="sig-name descname">Interface</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.Interface" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code> class of 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>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.address"> <dt id="royalnet.constellation.Constellation.address">
<code class="sig-name descname">address</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.address" title="Permalink to this definition"></a></dt> <code class="sig-name descname">address</code><em class="property">: str</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.address" title="Permalink to this definition"></a></dt>
<dd><p>The address that the <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> will bind to when run.</p> <dd><p>The address that the <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> will bind to when run.</p>
</dd></dl> </dd></dl>
@ -867,15 +789,22 @@ down).</p>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> of this Constellation.</p> <dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> of this Constellation.</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.call_herald_event">
<em class="property">async </em><code class="sig-name descname">call_herald_event</code><span class="sig-paren">(</span><em class="sig-param">destination: str</em>, <em class="sig-param">event_name: str</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span> &#x2192; Dict<a class="headerlink" href="#royalnet.constellation.Constellation.call_herald_event" title="Permalink to this definition"></a></dt>
<dd><p>Send a <code class="xref py py-class docutils literal notranslate"><span class="pre">royalherald.Request</span></code> to a specific destination, and wait for a
<code class="xref py py-class docutils literal notranslate"><span class="pre">royalherald.Response</span></code>.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.events"> <dt id="royalnet.constellation.Constellation.events">
<code class="sig-name descname">events</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.events" title="Permalink to this definition"></a></dt> <code class="sig-name descname">events</code><em class="property">: Dict[str, rc.HeraldEvent]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.events" title="Permalink to this definition"></a></dt>
<dd><p>A dictionary containing all <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code> that can be handled by 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><p>A dictionary containing all <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code> that can be handled by 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="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.herald"> <dt id="royalnet.constellation.Constellation.herald">
<code class="sig-name descname">herald</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.herald" title="Permalink to this definition"></a></dt> <code class="sig-name descname">herald</code><em class="property">: Optional[rh.Link]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.herald" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> object connecting the <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> to the rest of the herald network. <dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> object connecting the <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> to the rest of the herald network.
As is the case with the logging module, it will be started on the first request received by the As is the case with the logging module, it will be started on the first request received by the
<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>, as the event loop wont be available before that.</p> <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>, as the event loop wont be available before that.</p>
@ -883,7 +812,7 @@ As is the case with the logging module, it will be started on the first request
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.herald_task"> <dt id="royalnet.constellation.Constellation.herald_task">
<code class="sig-name descname">herald_task</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.herald_task" title="Permalink to this definition"></a></dt> <code class="sig-name descname">herald_task</code><em class="property">: Optional[aio.Task]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.herald_task" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the <code class="xref py py-class docutils literal notranslate"><span class="pre">aio.Task</span></code> that runs the <code class="xref py py-class docutils literal notranslate"><span class="pre">rh.Link</span></code>.</p> <dd><p>A reference to the <code class="xref py py-class docutils literal notranslate"><span class="pre">aio.Task</span></code> that runs the <code class="xref py py-class docutils literal notranslate"><span class="pre">rh.Link</span></code>.</p>
</dd></dl> </dd></dl>
@ -893,15 +822,9 @@ As is the case with the logging module, it will be started on the first request
<dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">rh.Link</span></code>.</p> <dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">rh.Link</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="royalnet.constellation.Constellation.interface_factory">
<code class="sig-name descname">interface_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Type[royalnet.commands.commandinterface.CommandInterface]<a class="headerlink" href="#royalnet.constellation.Constellation.interface_factory" title="Permalink to this definition"></a></dt>
<dd><p>Create the <code class="xref py py-class docutils literal notranslate"><span class="pre">rc.CommandInterface</span></code> class for the <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>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.loop"> <dt id="royalnet.constellation.Constellation.loop">
<code class="sig-name descname">loop</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.loop" title="Permalink to this definition"></a></dt> <code class="sig-name descname">loop</code><em class="property">: Optional[aio.AbstractEventLoop]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.loop" title="Permalink to this definition"></a></dt>
<dd><p>The event loop of the <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><p>The event loop of the <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>
<p>Because of how <code class="xref py py-mod docutils literal notranslate"><span class="pre">uvicorn</span></code> runs, it will stay <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code> until the first page is requested.</p> <p>Because of how <code class="xref py py-mod docutils literal notranslate"><span class="pre">uvicorn</span></code> runs, it will stay <code class="xref py py-const docutils literal notranslate"><span class="pre">None</span></code> until the first page is requested.</p>
</dd></dl> </dd></dl>
@ -913,13 +836,13 @@ As is the case with the logging module, it will be started on the first request
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.port"> <dt id="royalnet.constellation.Constellation.port">
<code class="sig-name descname">port</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.port" title="Permalink to this definition"></a></dt> <code class="sig-name descname">port</code><em class="property">: int</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.port" title="Permalink to this definition"></a></dt>
<dd><p>The port on which the <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> will listen for connection on.</p> <dd><p>The port on which the <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> will listen for connection on.</p>
</dd></dl> </dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.constellation.Constellation.register_events"> <dt id="royalnet.constellation.Constellation.register_events">
<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> <code class="sig-name descname">register_events</code><span class="sig-paren">(</span><em class="sig-param">events: List[Type[royalnet.commands.heraldevent.HeraldEvent]], 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> <dd></dd></dl>
<dl class="method"> <dl class="method">
@ -941,7 +864,7 @@ As is the case with the logging module, it will be started on the first request
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.running"> <dt id="royalnet.constellation.Constellation.running">
<code class="sig-name descname">running</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.running" title="Permalink to this definition"></a></dt> <code class="sig-name descname">running</code><em class="property">: bool</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.constellation.Constellation.running" title="Permalink to this definition"></a></dt>
<dd><p>Is the <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> server currently running?</p> <dd><p>Is the <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> server currently running?</p>
</dd></dl> </dd></dl>
@ -953,7 +876,7 @@ As is the case with the logging module, it will be started on the first request
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.Constellation.stars"> <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> <code class="sig-name descname">stars</code><em class="property">: List[PageStar]</em><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><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>
@ -961,7 +884,7 @@ As is the case with the logging module, it will be started on the first request
<dl class="class"> <dl class="class">
<dt id="royalnet.constellation.Star"> <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> <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">constellation: Constellation</em>, <em class="sig-param">config: ConfigDict</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> <dd><p>A Star is a class representing a part of the website.</p>
<p>It shouldnt 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> <p>It shouldnt 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"> <dl class="method">
@ -976,21 +899,9 @@ As is the case with the logging module, it will be started on the first request
<dd><p>A shortcut for the <a class="reference internal" href="#royalnet.alchemy.Alchemy" title="royalnet.alchemy.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code></a> of the <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><p>A shortcut for the <a class="reference internal" href="#royalnet.alchemy.Alchemy" title="royalnet.alchemy.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code></a> of the <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="method">
<dt id="royalnet.constellation.Star.config">
<em class="property">property </em><code class="sig-name descname">config</code><a class="headerlink" href="#royalnet.constellation.Star.config" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for the Pack configuration of the <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>
<dl class="method">
<dt id="royalnet.constellation.Star.constellation">
<em class="property">property </em><code class="sig-name descname">constellation</code><a class="headerlink" href="#royalnet.constellation.Star.constellation" title="Permalink to this definition"></a></dt>
<dd><p>A shortcut for the <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>
<dl class="method"> <dl class="method">
<dt id="royalnet.constellation.Star.page"> <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> &#x2192; starlette.responses.Response<a class="headerlink" href="#royalnet.constellation.Star.page" title="Permalink to this definition"></a></dt> <em class="property">abstract 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> &#x2192; 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> <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 <code class="xref py py-class docutils literal notranslate"><span class="pre">ExceptionStar</span></code> 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> </dd></dl>
@ -1005,13 +916,13 @@ As is the case with the logging module, it will be started on the first request
<dl class="class"> <dl class="class">
<dt id="royalnet.constellation.PageStar"> <dt id="royalnet.constellation.PageStar">
<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> <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">constellation: Constellation</em>, <em class="sig-param">config: ConfigDict</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> <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 <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>, <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"> <dl class="method">
<dt id="royalnet.constellation.PageStar.methods"> <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> <em class="property">classmethod </em><code class="sig-name descname">methods</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.constellation.PageStar.methods" title="Permalink to this definition"></a></dt>
<dd><p>The HTTP methods supported by the Star, in form of a list.</p> <dd><p>The HTTP methods supported by the Star, in form of a list.</p>
<p>By default, a Star only supports the <code class="docutils literal notranslate"><span class="pre">GET</span></code> method, but more can be added.</p> <p>By default, a Star only supports the <code class="docutils literal notranslate"><span class="pre">GET</span></code> method, but more can be added.</p>
<p class="rubric">Example</p> <p class="rubric">Example</p>
@ -1022,7 +933,7 @@ As is the case with the logging module, it will be started on the first request
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.constellation.PageStar.path"> <dt id="royalnet.constellation.PageStar.path">
<code class="sig-name descname">path</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.constellation.PageStar.path" title="Permalink to this definition"></a></dt> <code class="sig-name descname">path</code><em class="property">: str</em><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.constellation.PageStar.path" title="Permalink to this definition"></a></dt>
<dd><p>The route of the star.</p> <dd><p>The route of the star.</p>
<p class="rubric">Example</p> <p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;/api/user/get&#39;</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;/api/user/get&#39;</span>
@ -1337,18 +1248,12 @@ Akin to the sequence number on IP packets.</p></li>
<p>The subpackage providing all Serf implementations.</p> <p>The subpackage providing all Serf implementations.</p>
<dl class="class"> <dl class="class">
<dt id="royalnet.serf.Serf"> <dt id="royalnet.serf.Serf">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.serf.</code><code class="sig-name descname">Serf</code><span class="sig-paren">(</span><em class="sig-param">loop: asyncio.events.AbstractEventLoop, alchemy_cfg: Dict[str, Any], herald_cfg: Dict[str, Any], packs_cfg: Dict[str, Any], **_</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="sig-prename descclassname">royalnet.serf.</code><code class="sig-name descname">Serf</code><span class="sig-paren">(</span><em class="sig-param">loop: asyncio.events.AbstractEventLoop</em>, <em class="sig-param">alchemy_cfg: royalnet.commands.configdict.ConfigDict</em>, <em class="sig-param">herald_cfg: royalnet.commands.configdict.ConfigDict</em>, <em class="sig-param">packs_cfg: royalnet.commands.configdict.ConfigDict</em>, <em class="sig-param">**_</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf" title="Permalink to this definition"></a></dt>
<dd><p>An abstract class, to be used as base to implement Royalnet bots on multiple interfaces (such as Telegram or <dd><p>An abstract class, to be used as base to implement Royalnet bots on multiple interfaces (such as Telegram or
Discord).</p> Discord).</p>
<dl class="attribute">
<dt id="royalnet.serf.Serf.Interface">
<code class="sig-name descname">Interface</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.Interface" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code> class of this Serf.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.alchemy"> <dt id="royalnet.serf.Serf.alchemy">
<code class="sig-name descname">alchemy</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.alchemy" title="Permalink to this definition"></a></dt> <code class="sig-name descname">alchemy</code><em class="property">: Optional[ra.Alchemy]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.alchemy" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> object connecting this <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a> to a database.</p> <dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Alchemy</span></code> object connecting this <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a> to a database.</p>
</dd></dl> </dd></dl>
@ -1357,27 +1262,34 @@ Discord).</p>
<em class="property">async </em><code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param">command: royalnet.commands.command.Command, data: royalnet.commands.commanddata.CommandData, parameters: List[str]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.call" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param">command: royalnet.commands.command.Command, data: royalnet.commands.commanddata.CommandData, parameters: List[str]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.call" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.call_herald_event">
<em class="property">async </em><code class="sig-name descname">call_herald_event</code><span class="sig-paren">(</span><em class="sig-param">destination: str</em>, <em class="sig-param">event_name: str</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span> &#x2192; Dict<a class="headerlink" href="#royalnet.serf.Serf.call_herald_event" title="Permalink to this definition"></a></dt>
<dd><p>Send a <code class="xref py py-class docutils literal notranslate"><span class="pre">royalherald.Request</span></code> to a specific destination, and wait for a
<code class="xref py py-class docutils literal notranslate"><span class="pre">royalherald.Response</span></code>.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.commands"> <dt id="royalnet.serf.Serf.commands">
<code class="sig-name descname">commands</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.commands" title="Permalink to this definition"></a></dt> <code class="sig-name descname">commands</code><em class="property">: Dict[str, rc.Command]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.commands" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> connecting each command name to its <code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code> object.</p> <dd><p>The <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> connecting each command name to its <code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code> object.</p>
</dd></dl> </dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.events"> <dt id="royalnet.serf.Serf.events">
<code class="sig-name descname">events</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.events" title="Permalink to this definition"></a></dt> <code class="sig-name descname">events</code><em class="property">: Dict[str, rc.HeraldEvent]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.events" title="Permalink to this definition"></a></dt>
<dd><p>A dictionary containing all <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code> that can be handled by this <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a>.</p> <dd><p>A dictionary containing all <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code> that can be handled by this <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a>.</p>
</dd></dl> </dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.herald"> <dt id="royalnet.serf.Serf.herald">
<code class="sig-name descname">herald</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald" title="Permalink to this definition"></a></dt> <code class="sig-name descname">herald</code><em class="property">: Optional[rh.Link]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> object connecting the <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a> to the rest of the Herald network.</p> <dd><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> object connecting the <a class="reference internal" href="#royalnet.serf.Serf" title="royalnet.serf.Serf"><code class="xref py py-class docutils literal notranslate"><span class="pre">Serf</span></code></a> to the rest of the Herald network.</p>
</dd></dl> </dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.herald_task"> <dt id="royalnet.serf.Serf.herald_task">
<code class="sig-name descname">herald_task</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald_task" title="Permalink to this definition"></a></dt> <code class="sig-name descname">herald_task</code><em class="property">: Optional[aio.Task]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.herald_task" title="Permalink to this definition"></a></dt>
<dd><p>A reference to the <a class="reference external" href="https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Task" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Task</span></code></a> that runs the <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code>.</p> <dd><p>A reference to the <a class="reference external" href="https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Task" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Task</span></code></a> that runs the <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code>.</p>
</dd></dl> </dd></dl>
@ -1389,7 +1301,7 @@ Discord).</p>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.identity_table"> <dt id="royalnet.serf.Serf.identity_table">
<code class="sig-name descname">identity_table</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.identity_table" title="Permalink to this definition"></a></dt> <code class="sig-name descname">identity_table</code><em class="property">: Optional[Table]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.identity_table" title="Permalink to this definition"></a></dt>
<dd><p>The identity table containing the interface data (such as the Telegram user data) and that is in a <dd><p>The identity table containing the interface data (such as the Telegram user data) and that is in a
many-to-one relationship with the master table.</p> many-to-one relationship with the master table.</p>
</dd></dl> </dd></dl>
@ -1403,16 +1315,10 @@ table and the identity table.</p>
<dl class="method"> <dl class="method">
<dt id="royalnet.serf.Serf.init_herald"> <dt id="royalnet.serf.Serf.init_herald">
<code class="sig-name descname">init_herald</code><span class="sig-paren">(</span><em class="sig-param">herald_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.init_herald" title="Permalink to this definition"></a></dt> <code class="sig-name descname">init_herald</code><span class="sig-paren">(</span><em class="sig-param">herald_cfg: royalnet.commands.configdict.ConfigDict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.init_herald" title="Permalink to this definition"></a></dt>
<dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> and bind <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code>.</p> <dd><p>Create a <code class="xref py py-class docutils literal notranslate"><span class="pre">Link</span></code> and bind <code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="royalnet.serf.Serf.interface_factory">
<code class="sig-name descname">interface_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Type[royalnet.commands.commandinterface.CommandInterface]<a class="headerlink" href="#royalnet.serf.Serf.interface_factory" title="Permalink to this definition"></a></dt>
<dd><p>Create the <code class="xref py py-class docutils literal notranslate"><span class="pre">CommandInterface</span></code> class for the Serf.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.interface_name"> <dt id="royalnet.serf.Serf.interface_name">
<code class="sig-name descname">interface_name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.serf.Serf.interface_name" title="Permalink to this definition"></a></dt> <code class="sig-name descname">interface_name</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.serf.Serf.interface_name" title="Permalink to this definition"></a></dt>
@ -1420,13 +1326,13 @@ table and the identity table.</p>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.loop"> <dt id="royalnet.serf.Serf.loop">
<code class="sig-name descname">loop</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.loop" title="Permalink to this definition"></a></dt> <code class="sig-name descname">loop</code><em class="property">: Optional[aio.AbstractEventLoop]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.loop" title="Permalink to this definition"></a></dt>
<dd><p>The event loop this Serf is running on.</p> <dd><p>The event loop this Serf is running on.</p>
</dd></dl> </dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="royalnet.serf.Serf.master_table"> <dt id="royalnet.serf.Serf.master_table">
<code class="sig-name descname">master_table</code><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.master_table" title="Permalink to this definition"></a></dt> <code class="sig-name descname">master_table</code><em class="property">: Optional[Table]</em><em class="property"> = None</em><a class="headerlink" href="#royalnet.serf.Serf.master_table" title="Permalink to this definition"></a></dt>
<dd><p>The central table listing all users. It usually is <code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code>.</p> <dd><p>The central table listing all users. It usually is <code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code>.</p>
</dd></dl> </dd></dl>
@ -1435,20 +1341,25 @@ table and the identity table.</p>
<em class="property">async </em><code class="sig-name descname">network_handler</code><span class="sig-paren">(</span><em class="sig-param">message: Union[royalnet.herald.request.Request, royalnet.herald.broadcast.Broadcast]</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.response.Response<a class="headerlink" href="#royalnet.serf.Serf.network_handler" title="Permalink to this definition"></a></dt> <em class="property">async </em><code class="sig-name descname">network_handler</code><span class="sig-paren">(</span><em class="sig-param">message: Union[royalnet.herald.request.Request, royalnet.herald.broadcast.Broadcast]</em><span class="sig-paren">)</span> &#x2192; royalnet.herald.response.Response<a class="headerlink" href="#royalnet.serf.Serf.network_handler" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="attribute">
<dt id="royalnet.serf.Serf.prefix">
<code class="sig-name descname">prefix</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.serf.Serf.prefix" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.serf.Serf.press"> <dt id="royalnet.serf.Serf.press">
<em class="property">async </em><code class="sig-name descname">press</code><span class="sig-paren">(</span><em class="sig-param">key: royalnet.commands.keyboardkey.KeyboardKey</em>, <em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.press" title="Permalink to this definition"></a></dt> <em class="property">async static </em><code class="sig-name descname">press</code><span class="sig-paren">(</span><em class="sig-param">key: royalnet.commands.keyboardkey.KeyboardKey</em>, <em class="sig-param">data: royalnet.commands.commanddata.CommandData</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.press" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.serf.Serf.register_commands"> <dt id="royalnet.serf.Serf.register_commands">
<code class="sig-name descname">register_commands</code><span class="sig-paren">(</span><em class="sig-param">commands: List[Type[royalnet.commands.command.Command]], pack_cfg: Dict[str, Any]</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.serf.Serf.register_commands" title="Permalink to this definition"></a></dt> <code class="sig-name descname">register_commands</code><span class="sig-paren">(</span><em class="sig-param">commands: List[Type[royalnet.commands.command.Command]], pack_cfg: royalnet.commands.configdict.ConfigDict</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.serf.Serf.register_commands" title="Permalink to this definition"></a></dt>
<dd><p>Initialize and register all commands passed as argument.</p> <dd><p>Initialize and register all commands passed as argument.</p>
</dd></dl> </dd></dl>
<dl class="method"> <dl class="method">
<dt id="royalnet.serf.Serf.register_events"> <dt id="royalnet.serf.Serf.register_events">
<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.serf.Serf.register_events" title="Permalink to this definition"></a></dt> <code class="sig-name descname">register_events</code><span class="sig-paren">(</span><em class="sig-param">events: List[Type[royalnet.commands.heraldevent.HeraldEvent]], pack_cfg: royalnet.commands.configdict.ConfigDict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.serf.Serf.register_events" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
@ -1493,6 +1404,10 @@ table and the identity table.</p>
<p class="admonition-title">Warning</p> <p class="admonition-title">Warning</p>
<p>The called function must be thread-safe!</p> <p>The called function must be thread-safe!</p>
</div> </div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Calling a function this way might be significantly slower than calling its blocking counterpart!</p>
</div>
</dd></dl> </dd></dl>
<dl class="function"> <dl class="function">
@ -1507,12 +1422,13 @@ table and the identity table.</p>
<dl class="function"> <dl class="function">
<dt id="royalnet.utils.andformat"> <dt id="royalnet.utils.andformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">andformat</code><span class="sig-paren">(</span><em class="sig-param">l: Collection[str], middle=', ', final=' and '</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.andformat" title="Permalink to this definition"></a></dt> <code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">andformat</code><span class="sig-paren">(</span><em class="sig-param">coll: Collection[str], middle=', ', final=' and '</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.andformat" title="Permalink to this definition"></a></dt>
<dd><p>Convert a iterable (such as a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>) to a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> by adding <code class="docutils literal notranslate"><span class="pre">final</span></code> between the last two elements and <code class="docutils literal notranslate"><span class="pre">middle</span></code> between the others.</p> <dd><p>Convert a collection (such as a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>) to a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> by adding <code class="docutils literal notranslate"><span class="pre">final</span></code> between the last two
elements and <code class="docutils literal notranslate"><span class="pre">middle</span></code> between the others.</p>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">Parameters</dt> <dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple"> <dd class="field-odd"><ul class="simple">
<li><p><strong>l</strong> the input iterable.</p></li> <li><p><strong>coll</strong> the input collection.</p></li>
<li><p><strong>middle</strong> the <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> to be added between the middle elements.</p></li> <li><p><strong>middle</strong> the <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> to be added between the middle elements.</p></li>
<li><p><strong>final</strong> the <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> to be added between the last two elements.</p></li> <li><p><strong>final</strong> the <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#str" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> to be added between the last two elements.</p></li>
</ul> </ul>
@ -1549,7 +1465,7 @@ table and the identity table.</p>
</dl> </dl>
<p class="rubric">Example</p> <p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">underscorize</span><span class="p">(</span><span class="s2">&quot;LE EPIC PRANK [GONE WRONG!?!?]&quot;</span><span class="p">)</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">underscorize</span><span class="p">(</span><span class="s2">&quot;LE EPIC PRANK [GONE WRONG!?!?]&quot;</span><span class="p">)</span>
<span class="go">&quot;LE EPIC PRANK _GONE WRONG_____&quot;</span> <span class="go">&quot;LE_EPIC_PRANK__GONE_WRONG_____&quot;</span>
</pre></div> </pre></div>
</div> </div>
</dd></dl> </dd></dl>
@ -1584,11 +1500,11 @@ table and the identity table.</p>
<dl class="function"> <dl class="function">
<dt id="royalnet.utils.numberemojiformat"> <dt id="royalnet.utils.numberemojiformat">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">numberemojiformat</code><span class="sig-paren">(</span><em class="sig-param">l: List[str]</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.numberemojiformat" title="Permalink to this definition"></a></dt> <code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">numberemojiformat</code><span class="sig-paren">(</span><em class="sig-param">li: Collection[str]</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.numberemojiformat" title="Permalink to this definition"></a></dt>
<dd><p>Convert a <a class="reference external" href="https://docs.python.org/3.8/library/stdtypes.html#list" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> to a Unicode string with one item on every line numbered with emojis.</p> <dd><p>Convert a collection to a string with one item on every line numbered with emojis.</p>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">Parameters</dt> <dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>l</strong> the list to convert.</p> <dd class="field-odd"><p><strong>li</strong> the list to convert.</p>
</dd> </dd>
<dt class="field-even">Returns</dt> <dt class="field-even">Returns</dt>
<dd class="field-even"><p>The resulting Unicode string.</p> <dd class="field-even"><p>The resulting Unicode string.</p>
@ -1669,11 +1585,26 @@ table and the identity table.</p>
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">sentry_exc</code><span class="sig-paren">(</span><em class="sig-param">exc: Exception</em>, <em class="sig-param">level: str = 'ERROR'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.sentry_exc" title="Permalink to this definition"></a></dt> <code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">sentry_exc</code><span class="sig-paren">(</span><em class="sig-param">exc: Exception</em>, <em class="sig-param">level: str = 'ERROR'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.sentry_exc" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="function">
<dt id="royalnet.utils.sentry_wrap">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">sentry_wrap</code><span class="sig-paren">(</span><em class="sig-param">level: str = 'ERROR'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.sentry_wrap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="royalnet.utils.sentry_async_wrap">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">sentry_async_wrap</code><span class="sig-paren">(</span><em class="sig-param">level: str = 'ERROR'</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.sentry_async_wrap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function"> <dl class="function">
<dt id="royalnet.utils.init_logging"> <dt id="royalnet.utils.init_logging">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">init_logging</code><span class="sig-paren">(</span><em class="sig-param">logging_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.init_logging" title="Permalink to this definition"></a></dt> <code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">init_logging</code><span class="sig-paren">(</span><em class="sig-param">logging_cfg: Dict[str, Any]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.init_logging" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="function">
<dt id="royalnet.utils.strip_tabs">
<code class="sig-prename descclassname">royalnet.utils.</code><code class="sig-name descname">strip_tabs</code><span class="sig-paren">(</span><em class="sig-param">s: str</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.utils.strip_tabs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div> </div>
</div> </div>
@ -1695,7 +1626,7 @@ table and the identity table.</p>
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index &mdash; Royalnet 5.6.2 documentation</title> <title>Index &mdash; Royalnet 5.10.4 documentation</title>
@ -22,10 +22,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script> <script src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script> <script src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script>
@ -60,7 +60,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -189,8 +189,6 @@
<li><a href="apireference.html#royalnet.bard.YtdlFile.__init__">(royalnet.bard.YtdlFile method)</a> <li><a href="apireference.html#royalnet.bard.YtdlFile.__init__">(royalnet.bard.YtdlFile method)</a>
</li> </li>
<li><a href="apireference.html#royalnet.bard.YtdlInfo.__init__">(royalnet.bard.YtdlInfo method)</a> <li><a href="apireference.html#royalnet.bard.YtdlInfo.__init__">(royalnet.bard.YtdlInfo method)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Event.__init__">(royalnet.commands.Event method)</a>
</li> </li>
<li><a href="apireference.html#royalnet.herald.Package.__init__">(royalnet.herald.Package method)</a> <li><a href="apireference.html#royalnet.herald.Package.__init__">(royalnet.herald.Package method)</a>
</li> </li>
@ -214,9 +212,7 @@
<li><a href="apireference.html#royalnet.commands.Command.alchemy">alchemy() (royalnet.commands.Command property)</a> <li><a href="apireference.html#royalnet.commands.Command.alchemy">alchemy() (royalnet.commands.Command property)</a>
<ul> <ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.alchemy">(royalnet.commands.CommandInterface property)</a> <li><a href="apireference.html#royalnet.commands.HeraldEvent.alchemy">(royalnet.commands.HeraldEvent property)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Event.alchemy">(royalnet.commands.Event property)</a>
</li> </li>
<li><a href="apireference.html#royalnet.constellation.Star.alchemy">(royalnet.constellation.Star property)</a> <li><a href="apireference.html#royalnet.constellation.Star.alchemy">(royalnet.constellation.Star property)</a>
</li> </li>
@ -255,8 +251,12 @@
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.serf.Serf.call">call() (royalnet.serf.Serf method)</a> <li><a href="apireference.html#royalnet.serf.Serf.call">call() (royalnet.serf.Serf method)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.call_herald_event">call_herald_event() (royalnet.commands.CommandInterface method)</a> <li><a href="apireference.html#royalnet.constellation.Constellation.call_herald_event">call_herald_event() (royalnet.constellation.Constellation method)</a>
<ul>
<li><a href="apireference.html#royalnet.serf.Serf.call_herald_event">(royalnet.serf.Serf method)</a>
</li> </li>
</ul></li>
<li><a href="apireference.html#royalnet.commands.Command">Command (class in royalnet.commands)</a> <li><a href="apireference.html#royalnet.commands.Command">Command (class in royalnet.commands)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandArgs">CommandArgs (class in royalnet.commands)</a> <li><a href="apireference.html#royalnet.commands.CommandArgs">CommandArgs (class in royalnet.commands)</a>
@ -264,25 +264,15 @@
<li><a href="apireference.html#royalnet.commands.CommandData">CommandData (class in royalnet.commands)</a> <li><a href="apireference.html#royalnet.commands.CommandData">CommandData (class in royalnet.commands)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandError">CommandError</a> <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>
<li><a href="apireference.html#royalnet.serf.Serf.commands">commands (royalnet.serf.Serf attribute)</a> <li><a href="apireference.html#royalnet.serf.Serf.commands">commands (royalnet.serf.Serf attribute)</a>
</li>
<li><a href="apireference.html#royalnet.herald.Config">Config (class in royalnet.herald)</a>
</li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.config">config (royalnet.commands.CommandInterface attribute)</a>
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.Command.config">config() (royalnet.commands.Command property)</a> <li><a href="apireference.html#royalnet.herald.Config">Config (class in royalnet.herald)</a>
<ul>
<li><a href="apireference.html#royalnet.commands.Event.config">(royalnet.commands.Event property)</a>
</li> </li>
<li><a href="apireference.html#royalnet.constellation.Star.config">(royalnet.constellation.Star property)</a> <li><a href="apireference.html#royalnet.commands.ConfigDict">ConfigDict (class in royalnet.commands)</a>
</li> </li>
</ul></li>
<li><a href="apireference.html#royalnet.commands.ConfigurationError">ConfigurationError</a> <li><a href="apireference.html#royalnet.commands.ConfigurationError">ConfigurationError</a>
</li> </li>
<li><a href="apireference.html#royalnet.herald.Link.connect">connect() (royalnet.herald.Link method)</a> <li><a href="apireference.html#royalnet.herald.Link.connect">connect() (royalnet.herald.Link method)</a>
@ -291,9 +281,7 @@
</li> </li>
<li><a href="apireference.html#royalnet.constellation.Constellation">Constellation (class in royalnet.constellation)</a> <li><a href="apireference.html#royalnet.constellation.Constellation">Constellation (class in royalnet.constellation)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.constellation">constellation (royalnet.commands.CommandInterface attribute)</a> <li><a href="apireference.html#royalnet.commands.ConfigDict.convert">convert() (royalnet.commands.ConfigDict class method)</a>
</li>
<li><a href="apireference.html#royalnet.constellation.Star.constellation">constellation() (royalnet.constellation.Star property)</a>
</li> </li>
<li><a href="apireference.html#royalnet.herald.Config.copy">copy() (royalnet.herald.Config method)</a> <li><a href="apireference.html#royalnet.herald.Config.copy">copy() (royalnet.herald.Config method)</a>
</li> </li>
@ -321,8 +309,6 @@
<h2 id="E">E</h2> <h2 id="E">E</h2>
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<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> <li><a href="apireference.html#royalnet.constellation.Constellation.events">events (royalnet.constellation.Constellation attribute)</a>
<ul> <ul>
@ -408,6 +394,8 @@
</li> </li>
</ul></li> </ul></li>
<li><a href="apireference.html#royalnet.herald.HeraldError">HeraldError</a> <li><a href="apireference.html#royalnet.herald.HeraldError">HeraldError</a>
</li>
<li><a href="apireference.html#royalnet.commands.HeraldEvent">HeraldEvent (class in royalnet.commands)</a>
</li> </li>
</ul></td> </ul></td>
</tr></table> </tr></table>
@ -429,26 +417,12 @@
<li><a href="apireference.html#royalnet.serf.Serf.init_herald">(royalnet.serf.Serf method)</a> <li><a href="apireference.html#royalnet.serf.Serf.init_herald">(royalnet.serf.Serf method)</a>
</li> </li>
</ul></li> </ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.init_logging">init_logging() (in module royalnet.utils)</a> <li><a href="apireference.html#royalnet.utils.init_logging">init_logging() (in module royalnet.utils)</a>
</li> </li>
<li><a href="apireference.html#royalnet.utils.init_sentry">init_sentry() (in module royalnet.utils)</a> <li><a href="apireference.html#royalnet.utils.init_sentry">init_sentry() (in module royalnet.utils)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.Event.interface">interface (royalnet.commands.Event attribute)</a>
</li>
<li><a href="apireference.html#royalnet.constellation.Constellation.Interface">Interface (royalnet.constellation.Constellation attribute)</a>
<ul>
<li><a href="apireference.html#royalnet.serf.Serf.Interface">(royalnet.serf.Serf attribute)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.constellation.Constellation.interface_factory">interface_factory() (royalnet.constellation.Constellation method)</a>
<ul>
<li><a href="apireference.html#royalnet.serf.Serf.interface_factory">(royalnet.serf.Serf method)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.serf.Serf.interface_name">interface_name (royalnet.serf.Serf attribute)</a> <li><a href="apireference.html#royalnet.serf.Serf.interface_name">interface_name (royalnet.serf.Serf attribute)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.InvalidInputError">InvalidInputError</a> <li><a href="apireference.html#royalnet.commands.InvalidInputError">InvalidInputError</a>
@ -500,9 +474,9 @@
<li><a href="apireference.html#royalnet.commands.Command.loop">loop() (royalnet.commands.Command property)</a> <li><a href="apireference.html#royalnet.commands.Command.loop">loop() (royalnet.commands.Command property)</a>
<ul> <ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.loop">(royalnet.commands.CommandInterface property)</a> <li><a href="apireference.html#royalnet.commands.CommandData.loop">(royalnet.commands.CommandData property)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.Event.loop">(royalnet.commands.Event property)</a> <li><a href="apireference.html#royalnet.commands.HeraldEvent.loop">(royalnet.commands.HeraldEvent property)</a>
</li> </li>
</ul></li> </ul></li>
</ul></td> </ul></td>
@ -517,7 +491,7 @@
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.constellation.PageStar.methods">methods (royalnet.constellation.PageStar attribute)</a> <li><a href="apireference.html#royalnet.constellation.PageStar.methods">methods() (royalnet.constellation.PageStar class method)</a>
</li> </li>
<li><a href="apireference.html#royalnet.utils.MultiLock">MultiLock (class in royalnet.utils)</a> <li><a href="apireference.html#royalnet.utils.MultiLock">MultiLock (class in royalnet.utils)</a>
</li> </li>
@ -532,9 +506,7 @@
<li><a href="apireference.html#royalnet.commands.Command.name">name (royalnet.commands.Command attribute)</a> <li><a href="apireference.html#royalnet.commands.Command.name">name (royalnet.commands.Command attribute)</a>
<ul> <ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.name">(royalnet.commands.CommandInterface attribute)</a> <li><a href="apireference.html#royalnet.commands.HeraldEvent.name">(royalnet.commands.HeraldEvent attribute)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Event.name">(royalnet.commands.Event attribute)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="apireference.html#royalnet.constellation.Constellation.network_handler">network_handler() (royalnet.constellation.Constellation method)</a> <li><a href="apireference.html#royalnet.constellation.Constellation.network_handler">network_handler() (royalnet.constellation.Constellation method)</a>
@ -581,12 +553,12 @@
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.constellation.Constellation.port">port (royalnet.constellation.Constellation attribute)</a> <li><a href="apireference.html#royalnet.constellation.Constellation.port">port (royalnet.constellation.Constellation attribute)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.prefix">prefix (royalnet.commands.CommandInterface attribute)</a> <li><a href="apireference.html#royalnet.serf.Serf.prefix">prefix (royalnet.serf.Serf attribute)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.KeyboardKey.press">press() (royalnet.commands.KeyboardKey method)</a> <li><a href="apireference.html#royalnet.commands.KeyboardKey.press">press() (royalnet.commands.KeyboardKey method)</a>
<ul> <ul>
<li><a href="apireference.html#royalnet.serf.Serf.press">(royalnet.serf.Serf method)</a> <li><a href="apireference.html#royalnet.serf.Serf.press">(royalnet.serf.Serf static method)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="apireference.html#royalnet.commands.ProgramError">ProgramError</a> <li><a href="apireference.html#royalnet.commands.ProgramError">ProgramError</a>
@ -607,6 +579,8 @@
<li><a href="apireference.html#royalnet.serf.Serf.register_events">(royalnet.serf.Serf method)</a> <li><a href="apireference.html#royalnet.serf.Serf.register_events">(royalnet.serf.Serf method)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="apireference.html#royalnet.commands.CommandData.register_keyboard_key">register_keyboard_key() (royalnet.commands.CommandData class method)</a>
</li>
<li><a href="apireference.html#royalnet.constellation.Constellation.register_page_stars">register_page_stars() (royalnet.constellation.Constellation method)</a> <li><a href="apireference.html#royalnet.constellation.Constellation.register_page_stars">register_page_stars() (royalnet.constellation.Constellation method)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandData.reply">reply() (royalnet.commands.CommandData method)</a> <li><a href="apireference.html#royalnet.commands.CommandData.reply">reply() (royalnet.commands.CommandData method)</a>
@ -615,6 +589,8 @@
<li><a href="apireference.html#royalnet.herald.Package.reply">(royalnet.herald.Package method)</a> <li><a href="apireference.html#royalnet.herald.Package.reply">(royalnet.herald.Package method)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="apireference.html#royalnet.commands.CommandData.reply_image">reply_image() (royalnet.commands.CommandData method)</a>
</li>
<li><a href="apireference.html#royalnet.herald.Request">Request (class in royalnet.herald)</a> <li><a href="apireference.html#royalnet.herald.Request">Request (class in royalnet.herald)</a>
</li> </li>
<li><a href="apireference.html#royalnet.herald.Link.request">request() (royalnet.herald.Link method)</a> <li><a href="apireference.html#royalnet.herald.Link.request">request() (royalnet.herald.Link method)</a>
@ -630,11 +606,11 @@
<li><a href="apireference.html#royalnet.herald.Server.route_package">route_package() (royalnet.herald.Server method)</a> <li><a href="apireference.html#royalnet.herald.Server.route_package">route_package() (royalnet.herald.Server method)</a>
</li> </li>
<li><a href="apireference.html#module-royalnet.alchemy">royalnet.alchemy (module)</a> <li><a href="apireference.html#module-royalnet.alchemy">royalnet.alchemy (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.backpack">royalnet.backpack (module)</a>
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#module-royalnet.backpack">royalnet.backpack (module)</a>
</li>
<li><a href="apireference.html#module-royalnet.bard">royalnet.bard (module)</a> <li><a href="apireference.html#module-royalnet.bard">royalnet.bard (module)</a>
</li> </li>
<li><a href="apireference.html#module-royalnet.commands">royalnet.commands (module)</a> <li><a href="apireference.html#module-royalnet.commands">royalnet.commands (module)</a>
@ -650,7 +626,7 @@
<li><a href="apireference.html#royalnet.commands.Command.run">run() (royalnet.commands.Command method)</a> <li><a href="apireference.html#royalnet.commands.Command.run">run() (royalnet.commands.Command method)</a>
<ul> <ul>
<li><a href="apireference.html#royalnet.commands.Event.run">(royalnet.commands.Event method)</a> <li><a href="apireference.html#royalnet.commands.HeraldEvent.run">(royalnet.commands.HeraldEvent method)</a>
</li> </li>
<li><a href="apireference.html#royalnet.herald.Link.run">(royalnet.herald.Link method)</a> <li><a href="apireference.html#royalnet.herald.Link.run">(royalnet.herald.Link method)</a>
</li> </li>
@ -680,19 +656,15 @@
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.herald.Link.send">send() (royalnet.herald.Link method)</a> <li><a href="apireference.html#royalnet.herald.Link.send">send() (royalnet.herald.Link method)</a>
</li>
<li><a href="apireference.html#royalnet.utils.sentry_async_wrap">sentry_async_wrap() (in module royalnet.utils)</a>
</li> </li>
<li><a href="apireference.html#royalnet.utils.sentry_exc">sentry_exc() (in module royalnet.utils)</a> <li><a href="apireference.html#royalnet.utils.sentry_exc">sentry_exc() (in module royalnet.utils)</a>
</li>
<li><a href="apireference.html#royalnet.utils.sentry_wrap">sentry_wrap() (in module royalnet.utils)</a>
</li> </li>
<li><a href="apireference.html#royalnet.serf.Serf">Serf (class in royalnet.serf)</a> <li><a href="apireference.html#royalnet.serf.Serf">Serf (class in royalnet.serf)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandInterface.serf">serf (royalnet.commands.CommandInterface attribute)</a>
</li>
<li><a href="apireference.html#royalnet.commands.Command.serf">serf() (royalnet.commands.Command property)</a>
<ul>
<li><a href="apireference.html#royalnet.commands.Event.serf">(royalnet.commands.Event property)</a>
</li>
</ul></li>
<li><a href="apireference.html#royalnet.serf.SerfError">SerfError</a> <li><a href="apireference.html#royalnet.serf.SerfError">SerfError</a>
</li> </li>
<li><a href="apireference.html#royalnet.herald.Server.serve">serve() (royalnet.herald.Server method)</a> <li><a href="apireference.html#royalnet.herald.Server.serve">serve() (royalnet.herald.Server method)</a>
@ -703,10 +675,10 @@
</li> </li>
<li><a href="apireference.html#royalnet.commands.CommandData.session">session() (royalnet.commands.CommandData property)</a> <li><a href="apireference.html#royalnet.commands.CommandData.session">session() (royalnet.commands.CommandData property)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.constellation.Star.Session">Session() (royalnet.constellation.Star property)</a> <li><a href="apireference.html#royalnet.constellation.Star.Session">Session() (royalnet.constellation.Star property)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.alchemy.Alchemy.session_acm">session_acm() (royalnet.alchemy.Alchemy method)</a> <li><a href="apireference.html#royalnet.alchemy.Alchemy.session_acm">session_acm() (royalnet.alchemy.Alchemy method)</a>
<ul> <ul>
@ -728,6 +700,8 @@
<li><a href="apireference.html#royalnet.constellation.Constellation.starlette">starlette (royalnet.constellation.Constellation attribute)</a> <li><a href="apireference.html#royalnet.constellation.Constellation.starlette">starlette (royalnet.constellation.Constellation attribute)</a>
</li> </li>
<li><a href="apireference.html#royalnet.constellation.Constellation.stars">stars (royalnet.constellation.Constellation attribute)</a> <li><a href="apireference.html#royalnet.constellation.Constellation.stars">stars (royalnet.constellation.Constellation attribute)</a>
</li>
<li><a href="apireference.html#royalnet.utils.strip_tabs">strip_tabs() (in module royalnet.utils)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.Command.syntax">syntax (royalnet.commands.Command attribute)</a> <li><a href="apireference.html#royalnet.commands.Command.syntax">syntax (royalnet.commands.Command attribute)</a>
</li> </li>
@ -737,8 +711,6 @@
<h2 id="T">T</h2> <h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.commands.CommandInterface.table">table() (royalnet.commands.CommandInterface property)</a>
</li>
<li><a href="apireference.html#royalnet.alchemy.table_dfs">table_dfs() (in module royalnet.alchemy)</a> <li><a href="apireference.html#royalnet.alchemy.table_dfs">table_dfs() (in module royalnet.alchemy)</a>
</li> </li>
<li><a href="apireference.html#royalnet.alchemy.TableNotFoundError">TableNotFoundError</a> <li><a href="apireference.html#royalnet.alchemy.TableNotFoundError">TableNotFoundError</a>
@ -769,10 +741,12 @@
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="apireference.html#royalnet.utils.underscorize">underscorize() (in module royalnet.utils)</a> <li><a href="apireference.html#royalnet.utils.underscorize">underscorize() (in module royalnet.utils)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.UnsupportedError">UnsupportedError</a> <li><a href="apireference.html#royalnet.commands.CommandData.unregister_keyboard_key">unregister_keyboard_key() (royalnet.commands.CommandData class method)</a>
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <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.herald.Config.url">url() (royalnet.herald.Config property)</a> <li><a href="apireference.html#royalnet.herald.Config.url">url() (royalnet.herald.Config property)</a>
</li> </li>
<li><a href="apireference.html#royalnet.commands.UserError">UserError</a> <li><a href="apireference.html#royalnet.commands.UserError">UserError</a>
@ -808,7 +782,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Royalnet &mdash; Royalnet 5.6.2 documentation</title> <title>Royalnet &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script> <script src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script> <script src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script>
@ -60,7 +60,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -165,7 +165,7 @@
<div class="section" id="some-useful-links"> <div class="section" id="some-useful-links">
<h2>Some useful links<a class="headerlink" href="#some-useful-links" title="Permalink to this headline"></a></h2> <h2>Some useful links<a class="headerlink" href="#some-useful-links" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li><p><a class="reference external" href="https://github.com/royal-games/royalnet">Royalnet on GitHub</a></p></li> <li><p><a class="reference external" href="https://github.com/Steffo99/royalnet">Royalnet on GitHub</a></p></li>
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li> <li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
</ul> </ul>
</div> </div>
@ -189,7 +189,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

Binary file not shown.

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Creating a new Command &mdash; Royalnet 5.6.2 documentation</title> <title>Creating a new Command &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script> <script src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script> <script src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script> <script src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -90,6 +90,10 @@
<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="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-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="#id1">Creating a new Command</a></li>
<li class="toctree-l3"><a class="reference internal" href="#formatting-command-replies">Formatting command replies</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#available-tags">Available tags</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#command-arguments">Command arguments</a><ul> <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="#direct-access">Direct access</a></li>
<li class="toctree-l4"><a class="reference internal" href="#optional-access">Optional access</a></li> <li class="toctree-l4"><a class="reference internal" href="#optional-access">Optional access</a></li>
@ -100,7 +104,8 @@
<li class="toctree-l3"><a class="reference internal" href="#raising-errors">Raising errors</a></li> <li class="toctree-l3"><a class="reference internal" href="#raising-errors">Raising errors</a></li>
<li class="toctree-l3"><a class="reference internal" href="#coroutines-and-slow-operations">Coroutines and slow operations</a></li> <li class="toctree-l3"><a class="reference internal" href="#coroutines-and-slow-operations">Coroutines and slow operations</a></li>
<li class="toctree-l3"><a class="reference internal" href="#delete-the-invoking-message">Delete the invoking message</a></li> <li class="toctree-l3"><a class="reference internal" href="#delete-the-invoking-message">Delete the invoking message</a></li>
<li class="toctree-l3"><a class="reference internal" href="#using-the-database">Using the database</a><ul> <li class="toctree-l3"><a class="reference internal" href="#sharing-data-between-multiple-calls">Sharing data between multiple calls</a></li>
<li class="toctree-l3"><a class="reference internal" href="#using-the-alchemy">Using the Alchemy</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#querying-the-database">Querying the database</a></li> <li class="toctree-l4"><a class="reference internal" href="#querying-the-database">Querying the database</a></li>
<li class="toctree-l4"><a class="reference internal" href="#adding-filters-to-the-query">Adding filters to the query</a></li> <li class="toctree-l4"><a class="reference internal" href="#adding-filters-to-the-query">Adding filters to the query</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ordering-the-results-of-a-query">Ordering the results of a query</a></li> <li class="toctree-l4"><a class="reference internal" href="#ordering-the-results-of-a-query">Ordering the results of a query</a></li>
@ -109,8 +114,13 @@
</ul> </ul>
</li> </li>
<li class="toctree-l3"><a class="reference internal" href="#calling-events">Calling Events</a></li> <li class="toctree-l3"><a class="reference internal" href="#calling-events">Calling Events</a></li>
<li class="toctree-l3"><a class="reference internal" href="#displaying-keyboards">Displaying Keyboards</a></li> <li class="toctree-l3"><a class="reference internal" href="#distinguish-between-platforms">Distinguish between platforms</a></li>
<li class="toctree-l3"><a class="reference internal" href="#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="#displaying-keyboards">Displaying Keyboards</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#replies-in-callbacks">Replies in callbacks</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#reading-data-from-the-configuration-file">Reading data from the configuration file</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-code-on-serf-start">Running code on Serf start</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#running-repeating-jobs">Running repeating jobs</a></li> <li class="toctree-l4"><a class="reference internal" href="#running-repeating-jobs">Running repeating jobs</a></li>
</ul> </ul>
</li> </li>
@ -191,7 +201,7 @@
<div class="section" id="creating-a-new-command"> <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> <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 Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet platform.</p>
<p>A Command code looks like this:</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> <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>
@ -200,12 +210,12 @@
<span class="n">description</span> <span class="o">=</span> <span class="s2">&quot;Play ping-pong with the bot.&quot;</span> <span class="n">description</span> <span class="o">=</span> <span class="s2">&quot;Play ping-pong with the bot.&quot;</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">interface</span><span class="p">):</span> <span class="c1"># This code is run just once, while the bot is starting</span>
<span class="c1"># This code is run just once, while the bot is starting</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">serf</span><span class="p">:</span> <span class="s2">&quot;Serf&quot;</span><span class="p">,</span> <span class="n">config</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">serf</span><span class="o">=</span><span class="n">serf</span><span class="p">,</span> <span class="n">config</span><span class="o">=</span><span class="n">config</span><span class="p">)</span>
<span class="c1"># This code is run every time the command is called</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">rc</span><span class="o">.</span><span class="n">CommandArgs</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="n">rc</span><span class="o">.</span><span class="n">CommandData</span><span class="p">):</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">rc</span><span class="o">.</span><span class="n">CommandArgs</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="n">rc</span><span class="o">.</span><span class="n">CommandData</span><span class="p">):</span>
<span class="c1"># This code is run every time the command is called</span>
<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">&quot;Pong!&quot;</span><span class="p">)</span> <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">&quot;Pong!&quot;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
@ -232,8 +242,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 <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">run()</span></code></a> 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> coroutine:</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">reply()</span></code></a> coroutine:</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> <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>
<span class="k">class</span> <span class="nc">SpaghettiCommand</span><span class="p">(</span><span class="n">rc</span><span class="o">.</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">rc</span><span class="o">.</span><span class="n">Command</span><span class="p">):</span>
@ -260,11 +270,30 @@ command to the <code class="docutils literal notranslate"><span class="pre">avai
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="formatting-command-replies">
<h2>Formatting command replies<a class="headerlink" href="#formatting-command-replies" title="Permalink to this headline"></a></h2>
<p>You can use a subset of <a class="reference external" href="https://en.wikipedia.org/wiki/BBCode">BBCode</a> to format messages sent with <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">reply()</span></code></a>:</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">rc</span><span class="o">.</span><span class="n">CommandArgs</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="n">rc</span><span class="o">.</span><span class="n">CommandData</span><span class="p">):</span>
<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">&quot;[b]Bold of you to assume that my code has no bugs.[/b]&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="available-tags">
<h3>Available tags<a class="headerlink" href="#available-tags" title="Permalink to this headline"></a></h3>
<p>Heres a list of all tags that can be used:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">[b]bold[/b]</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">[i]italic[/i]</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">[c]code[/c]</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">[p]multiline</span> <span class="pre">\n</span> <span class="pre">code[/p]</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">[url=https://google.com]inline</span> <span class="pre">link[/url]</span></code> (will be rendered differently on every platform)</p></li>
</ul>
</div>
</div>
<div class="section" id="command-arguments"> <div class="section" id="command-arguments">
<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.8/library/stdtypes.html#str" title="(in Python v3.8)"><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.8/library/stdtypes.html#str" title="(in Python v3.8)"><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 <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">run()</span></code></a>
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 {curly braces} for required arguments and [square brackets] for optional syntax of your command, possibly using {curly braces} for required arguments and [square brackets] for optional
@ -276,10 +305,15 @@ ones.</p>
<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>
<span class="n">syntax</span> <span class="o">=</span> <span class="s2">&quot;(requestedpasta)&quot;</span> <span class="n">syntax</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{first_pasta}</span><span class="s2"> [second_pasta]&quot;</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">rc</span><span class="o">.</span><span class="n">CommandArgs</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="n">rc</span><span class="o">.</span><span class="n">CommandData</span><span class="p">):</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">rc</span><span class="o">.</span><span class="n">CommandArgs</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="n">rc</span><span class="o">.</span><span class="n">CommandData</span><span class="p">):</span>
<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="sa">f</span><span class="s2">&quot;🍝 Here&#39;s your </span><span class="si">{args[0]}</span><span class="s2">!&quot;</span><span class="p">)</span> <span class="n">first_pasta</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">second_pasta</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">optional</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">if</span> <span class="n">second_pasta</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<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="sa">f</span><span class="s2">&quot;🍝 Here&#39;s your </span><span class="si">{</span><span class="n">first_pasta</span><span class="si">}</span><span class="s2">!&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<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="sa">f</span><span class="s2">&quot;🍝 Here&#39;s your </span><span class="si">{</span><span class="n">first_pasta</span><span class="si">}</span><span class="s2"> and your </span><span class="si">{</span><span class="n">second_pasta</span><span class="si">}</span><span class="s2">!&quot;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
<div class="section" id="direct-access"> <div class="section" id="direct-access">
@ -301,7 +335,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 <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">optional()</span></code></a> method: it
will return <code class="docutils literal notranslate"><span class="pre">None</span></code> if the argument wasnt passed, making it <strong>optional</strong>.</p> will return <code class="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>
@ -321,7 +355,7 @@ will return <code class="docutils literal notranslate"><span class="pre">None</s
</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 <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">joined()</span></code></a> 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>
@ -336,7 +370,7 @@ 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 <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">match()</span></code></a> 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 <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>
<p>To match a pattern, <a class="reference external" href="https://docs.python.org/3.8/library/re.html#re.match" title="(in Python v3.8)"><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.8/library/re.html#re.match" title="(in Python v3.8)"><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>
@ -366,11 +400,11 @@ which returns a tuple of the matched groups and raises an <a class="reference in
<dt><a class="reference internal" href="../apireference.html#royalnet.commands.UserError" title="royalnet.commands.UserError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserError</span></code></a></dt><dd><p>The user did something wrong, it is not a problem with the bot.</p> <dt><a class="reference internal" href="../apireference.html#royalnet.commands.UserError" title="royalnet.commands.UserError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserError</span></code></a></dt><dd><p>The user did something wrong, it is not a problem with the bot.</p>
</dd> </dd>
<dt><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></dt><dd><p>The arguments the user passed to the command by the user are invalid. <dt><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></dt><dd><p>The arguments the user passed to the command by the user are invalid.
Displays the command syntax in the error message.</p> <em>Additionally displays the command syntax in the error message.</em></p>
</dd> </dd>
<dt><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></dt><dd><p>The command is not supported on the interface it is being called.</p> <dt><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></dt><dd><p>The command is not supported on the platform it is being called.</p>
</dd> </dd>
<dt><a class="reference internal" href="../apireference.html#royalnet.commands.ConfigurationError" title="royalnet.commands.ConfigurationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ConfigurationError</span></code></a></dt><dd><p>The <code class="docutils literal notranslate"><span class="pre">config.toml</span></code> file was misconfigured (a value is missing or invalid).</p> <dt><a class="reference internal" href="../apireference.html#royalnet.commands.ConfigurationError" title="royalnet.commands.ConfigurationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ConfigurationError</span></code></a></dt><dd><p>A value is missing or invalid in the <code class="docutils literal notranslate"><span class="pre">config.toml</span></code> section of your pack.</p>
</dd> </dd>
<dt><a class="reference internal" href="../apireference.html#royalnet.commands.ExternalError" title="royalnet.commands.ExternalError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExternalError</span></code></a></dt><dd><p>An external API the command depends on is unavailable or returned an error.</p> <dt><a class="reference internal" href="../apireference.html#royalnet.commands.ExternalError" title="royalnet.commands.ExternalError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExternalError</span></code></a></dt><dd><p>An external API the command depends on is unavailable or returned an error.</p>
</dd> </dd>
@ -381,7 +415,7 @@ Displays the command syntax in the error message.</p>
<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 <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">reply()</span></code></a> 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>
@ -408,13 +442,13 @@ a coroutine that does the same exact thing but in an asyncronous way.</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 <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">delete_invoking</span></code></a>
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>
</pre></div> </pre></div>
</div> </div>
<p>Not all interfaces support deleting messages; by default, if the interface does not support deletions, the call is <p>Not all platforms support deleting messages; by default, if the platform does not support deletions, the call is
ignored.</p> ignored.</p>
<p>You can have the method raise an error if the message cant be deleted by setting the <code class="docutils literal notranslate"><span class="pre">error_if_unavailable</span></code> parameter <p>You can have the method raise an error if the message cant be deleted by setting the <code class="docutils literal notranslate"><span class="pre">error_if_unavailable</span></code> parameter
to True:</p> to True:</p>
@ -428,9 +462,29 @@ to True:</p>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="using-the-database"> <div class="section" id="sharing-data-between-multiple-calls">
<h2>Using the database<a class="headerlink" href="#using-the-database" title="Permalink to this headline"></a></h2> <h2>Sharing data between multiple calls<a class="headerlink" href="#sharing-data-between-multiple-calls" title="Permalink to this headline"></a></h2>
<p>Bots can be connected to a PostgreSQL database through a special SQLAlchemy interface called <p>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 is shared between multiple command calls: if you need to store some data, you may store it as a protected/private field of your command class:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">SpaghettiCommand</span><span class="p">(</span><span class="n">rc</span><span class="o">.</span><span class="n">Command</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;spaghetti&quot;</span>
<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">syntax</span> <span class="o">=</span> <span class="s2">&quot;(requestedpasta)&quot;</span>
<span class="n">__total_spaghetti</span> <span class="o">=</span> <span class="mi">0</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">rc</span><span class="o">.</span><span class="n">CommandArgs</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="n">rc</span><span class="o">.</span><span class="n">CommandData</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">__total_spaghetti</span> <span class="o">+=</span> <span class="mi">1</span>
<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="sa">f</span><span class="s2">&quot;🍝 Here&#39;s your </span><span class="si">{</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}</span><span class="s2">!</span><span class="se">\n</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot;[i]Spaghetti have been served </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">__total_spaghetti</span><span class="si">}</span><span class="s2"> times.[/i]&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Values stored in this way persist <strong>only until the bot is restarted</strong>, and <strong>wont be shared between different serfs</strong>; if you need persistent values, it is recommended to use a database through the Alchemy service.</p>
</div>
<div class="section" id="using-the-alchemy">
<h2>Using the Alchemy<a class="headerlink" href="#using-the-alchemy" title="Permalink to this headline"></a></h2>
<p>Royalnet can be connected to a PostgreSQL database through a special SQLAlchemy interface called
<a class="reference internal" href="../apireference.html#royalnet.alchemy.Alchemy" title="royalnet.alchemy.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.alchemy.Alchemy</span></code></a>.</p> <a class="reference internal" href="../apireference.html#royalnet.alchemy.Alchemy" title="royalnet.alchemy.Alchemy"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.alchemy.Alchemy</span></code></a>.</p>
<p>If the connection is established, the <code class="docutils literal notranslate"><span class="pre">self.alchemy</span></code> and <code class="docutils literal notranslate"><span class="pre">data.session</span></code> fields will be <p>If the connection is established, the <code class="docutils literal notranslate"><span class="pre">self.alchemy</span></code> and <code class="docutils literal notranslate"><span class="pre">data.session</span></code> fields will be
available for use in commands.</p> available for use in commands.</p>
@ -501,18 +555,112 @@ if you want the command to raise an error if the number of results is greater th
</div> </div>
<div class="section" id="calling-events"> <div class="section" id="calling-events">
<h2>Calling Events<a class="headerlink" href="#calling-events" title="Permalink to this headline"></a></h2> <h2>Calling Events<a class="headerlink" href="#calling-events" title="Permalink to this headline"></a></h2>
<p>This section is not documented yet.</p> <p>You can <strong>call an event</strong> from inside a command, and receive its return value.</p>
<p>This may be used for example to get data from a different platform, such as getting the users online in a specific Discord server.</p>
<p>You can call an event with the <a class="reference internal" href="../apireference.html#royalnet.serf.Serf.call_herald_event" title="royalnet.serf.Serf.call_herald_event"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Serf.call_herald_event()</span></code></a> method:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">result</span> <span class="o">=</span> <span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">serf</span><span class="o">.</span><span class="n">call_herald_event</span><span class="p">(</span><span class="s2">&quot;event_name&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>You can also pass parameters to the called event:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">result</span> <span class="o">=</span> <span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">serf</span><span class="o">.</span><span class="n">call_herald_event</span><span class="p">(</span><span class="s2">&quot;event_name&quot;</span><span class="p">,</span> <span class="o">...</span><span class="p">,</span> <span class="n">kwarg</span><span class="o">=...</span><span class="p">,</span> <span class="o">*...</span><span class="p">,</span> <span class="o">**...</span><span class="p">)</span>
</pre></div>
</div>
<p>Errors raised by the event will also be raised by the <a class="reference internal" href="../apireference.html#royalnet.serf.Serf.call_herald_event" title="royalnet.serf.Serf.call_herald_event"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Serf.call_herald_event()</span></code></a> method as one of the exceptions described in the <span class="xref std std-ref">Raising errors</span> section.</p>
</div>
<div class="section" id="distinguish-between-platforms">
<h2>Distinguish between platforms<a class="headerlink" href="#distinguish-between-platforms" title="Permalink to this headline"></a></h2>
<p>To see if a command is being run on a specific platform, you can check the type of the <code class="docutils literal notranslate"><span class="pre">self.serf</span></code> object:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">royalnet.serf.telegram</span> <span class="k">as</span> <span class="nn">rst</span>
<span class="kn">import</span> <span class="nn">royalnet.serf.discord</span> <span class="k">as</span> <span class="nn">rsd</span>
<span class="o">...</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">serf</span><span class="p">,</span> <span class="n">rst</span><span class="o">.</span><span class="n">TelegramSerf</span><span class="p">):</span>
<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">&quot;This command is being run on Telegram.&quot;</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">serf</span><span class="p">,</span> <span class="n">rsd</span><span class="o">.</span><span class="n">DiscordSerf</span><span class="p">):</span>
<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">&quot;This command is being run on Discord.&quot;</span><span class="p">)</span>
<span class="o">...</span>
</pre></div>
</div>
</div> </div>
<div class="section" id="displaying-keyboards"> <div class="section" id="displaying-keyboards">
<h2>Displaying Keyboards<a class="headerlink" href="#displaying-keyboards" title="Permalink to this headline"></a></h2> <h2>Displaying Keyboards<a class="headerlink" href="#displaying-keyboards" title="Permalink to this headline"></a></h2>
<p>This section is not documented yet.</p> <p>A keyboard is a message with multiple buttons (“keys”) attached which can be pressed by an user viewing the message.</p>
<p>Once a button is pressed, a callback function is run, which has its own <a class="reference internal" href="../apireference.html#royalnet.commands.CommandData" title="royalnet.commands.CommandData"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandData</span></code></a> context and can do everything a regular comment call could.</p>
<p>The callback function is a coroutine accepting a single <code class="docutils literal notranslate"><span class="pre">data:</span> <span class="pre">CommandData</span></code> argument:</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">answer</span><span class="p">(</span><span class="n">data</span><span class="p">:</span> <span class="n">CommandData</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<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">&quot;Spaghetti were ejected from your floppy drive!&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>To create a new key, you can use the <a class="reference internal" href="../apireference.html#royalnet.commands.KeyboardKey" title="royalnet.commands.KeyboardKey"><code class="xref py py-class docutils literal notranslate"><span class="pre">KeyboardKey</span></code></a> class:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">key</span> <span class="o">=</span> <span class="n">KeyboardKey</span><span class="p">(</span>
<span class="n">short</span><span class="o">=</span><span class="s2">&quot;⏏️&quot;</span><span class="p">,</span> <span class="c1"># An emoji representing the key on platforms the full message cannot be displayed</span>
<span class="n">text</span><span class="o">=</span><span class="s2">&quot;Eject spaghetti from the floppy drive&quot;</span><span class="p">,</span> <span class="c1"># The text displayed on the key</span>
<span class="n">callback</span><span class="o">=</span><span class="n">answer</span> <span class="c1"># The coroutine to call when the key is pressed.</span>
<span class="p">)</span>
</pre></div>
</div>
<p>To display a keyboard and wait for a keyboard press, you can use the <a class="reference internal" href="../apireference.html#royalnet.commands.CommandData.keyboard" title="royalnet.commands.CommandData.keyboard"><code class="xref py py-meth docutils literal notranslate"><span class="pre">keyboard()</span></code></a> asynccontextmanager.
While the contextmanager is in scope, the keyboard will be valid and it will be possible to interact with it.
Any further key pressed will be answered with an error message.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">data</span><span class="o">.</span><span class="n">keyboard</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s2">&quot;What kind of spaghetti would you want to order?&quot;</span><span class="p">,</span> <span class="n">keys</span><span class="o">=</span><span class="n">keyboard</span><span class="p">):</span>
<span class="c1"># This will keep the keyboard valid for 10 seconds</span>
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="replies-in-callbacks">
<h3>Replies in callbacks<a class="headerlink" href="#replies-in-callbacks" title="Permalink to this headline"></a></h3>
<p>Calls to <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">reply()</span></code></a> made with the <a class="reference internal" href="../apireference.html#royalnet.commands.CommandData" title="royalnet.commands.CommandData"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandData</span></code></a> of a keyboard callback wont always result in a message being sent: for example, on Telegram, replies will result in a small message being displayed on the top of the screen.</p>
</div>
</div>
<div class="section" id="reading-data-from-the-configuration-file">
<h2>Reading data from the configuration file<a class="headerlink" href="#reading-data-from-the-configuration-file" title="Permalink to this headline"></a></h2>
<p>You can read data from your packs configuration section through the <code class="xref py py-attr docutils literal notranslate"><span class="pre">config</span></code> attribute:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">Packs</span><span class="o">.</span><span class="s2">&quot;spaghettipack&quot;</span><span class="p">]</span>
<span class="n">spaghetti</span> <span class="o">=</span> <span class="p">{</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;al_dente&quot;</span><span class="p">,</span> <span class="n">two</span><span class="o">=</span><span class="n">true</span> <span class="p">}</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><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="sa">f</span><span class="s2">&quot;Here&#39;s your spaghetti </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s1">&#39;spaghetti&#39;</span><span class="p">][</span><span class="s1">&#39;mode&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2">!&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="running-code-on-serf-start">
<h2>Running code on Serf start<a class="headerlink" href="#running-code-on-serf-start" title="Permalink to this headline"></a></h2>
<p>The code inside <code class="docutils literal notranslate"><span class="pre">__init__</span></code> is run only once, during the initialization step of the bot:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">serf</span><span class="p">:</span> <span class="s2">&quot;Serf&quot;</span><span class="p">,</span> <span class="n">config</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">serf</span><span class="o">=</span><span class="n">serf</span><span class="p">,</span> <span class="n">config</span><span class="o">=</span><span class="n">config</span><span class="p">)</span>
<span class="c1"># The contents of this variable will be persisted across command calls</span>
<span class="bp">self</span><span class="o">.</span><span class="n">persistent_variable</span> <span class="o">=</span> <span class="mi">0</span>
<span class="c1"># The text will be printed only if the config flag is set to something</span>
<span class="k">if</span> <span class="n">config</span><span class="p">[</span><span class="s2">&quot;spaghetti&quot;</span><span class="p">][</span><span class="s2">&quot;two&quot;</span><span class="p">]:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Famme due spaghi!&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Some methods may be unavailable during the initialization of the Serf.</p>
</div> </div>
<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>
<p>This section is not documented yet.</p>
<div class="section" id="running-repeating-jobs"> <div class="section" id="running-repeating-jobs">
<h3>Running repeating jobs<a class="headerlink" href="#running-repeating-jobs" title="Permalink to this headline"></a></h3> <h3>Running repeating jobs<a class="headerlink" href="#running-repeating-jobs" title="Permalink to this headline"></a></h3>
<p>This section is not documented yet.</p> <p>To run a job independently from the rest of the command, you can schedule the execution of a coroutine inside <code class="docutils literal notranslate"><span class="pre">__init__</span></code>:</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">mycoroutine</span><span class="p">():</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Free spaghetti every 60 seconds!&quot;</span><span class="p">)</span>
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">60</span><span class="p">)</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">serf</span><span class="p">:</span> <span class="s2">&quot;Serf&quot;</span><span class="p">,</span> <span class="n">config</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">serf</span><span class="o">=</span><span class="n">serf</span><span class="p">,</span> <span class="n">config</span><span class="o">=</span><span class="n">config</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">loop</span><span class="o">.</span><span class="n">create_task</span><span class="p">(</span><span class="n">mycoroutine</span><span class="p">())</span>
</pre></div>
</div>
<p>As it will be executed once for every platform Royalnet is running on, you may want to run the task only on a single platform:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">serf</span><span class="p">:</span> <span class="s2">&quot;Serf&quot;</span><span class="p">,</span> <span class="n">config</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">serf</span><span class="o">=</span><span class="n">serf</span><span class="p">,</span> <span class="n">config</span><span class="o">=</span><span class="n">config</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">serf</span><span class="p">,</span> <span class="n">rst</span><span class="o">.</span><span class="n">TelegramSerf</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">loop</span><span class="o">.</span><span class="n">create_task</span><span class="p">(</span><span class="n">mycoroutine</span><span class="p">())</span>
</pre></div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -537,7 +685,7 @@ if you want the command to raise an error if the number of results is greater th
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Using Events &mdash; Royalnet 5.6.2 documentation</title> <title>Using Events &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script> <script src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script> <script src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script> <script src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -187,7 +187,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Creating a new Pack &mdash; Royalnet 5.6.2 documentation</title> <title>Creating a new Pack &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script> <script src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script> <script src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script> <script src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -92,7 +92,6 @@
<li class="toctree-l3"><a class="reference internal" href="#creating-the-repository">Creating the repository</a><ul> <li class="toctree-l3"><a class="reference internal" href="#creating-the-repository">Creating the repository</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#pyproject-toml">pyproject.toml</a></li> <li class="toctree-l4"><a class="reference internal" href="#pyproject-toml">pyproject.toml</a></li>
<li class="toctree-l4"><a class="reference internal" href="#examplepack">examplepack</a></li> <li class="toctree-l4"><a class="reference internal" href="#examplepack">examplepack</a></li>
<li class="toctree-l4"><a class="reference internal" href="#version-py">version.py</a></li>
<li class="toctree-l4"><a class="reference internal" href="#the-commands-folder">The commands folder</a></li> <li class="toctree-l4"><a class="reference internal" href="#the-commands-folder">The commands folder</a></li>
<li class="toctree-l4"><a class="reference internal" href="#the-events-folder">The events folder</a></li> <li class="toctree-l4"><a class="reference internal" href="#the-events-folder">The events folder</a></li>
<li class="toctree-l4"><a class="reference internal" href="#the-stars-folder">The stars folder</a></li> <li class="toctree-l4"><a class="reference internal" href="#the-stars-folder">The stars folder</a></li>
@ -102,6 +101,8 @@
</ul> </ul>
</li> </li>
<li class="toctree-l3"><a class="reference internal" href="#adding-new-dependencies-to-the-pack">Adding new dependencies to the Pack</a></li> <li class="toctree-l3"><a class="reference internal" href="#adding-new-dependencies-to-the-pack">Adding new dependencies to the Pack</a></li>
<li class="toctree-l3"><a class="reference internal" href="#updating-the-dependencies">Updating the dependencies</a></li>
<li class="toctree-l3"><a class="reference internal" href="#the-readme-md-file">The README.md file</a></li>
<li class="toctree-l3"><a class="reference internal" href="#publishing-the-pack">Publishing the pack</a></li> <li class="toctree-l3"><a class="reference internal" href="#publishing-the-pack">Publishing the pack</a></li>
</ul> </ul>
</li> </li>
@ -183,14 +184,14 @@
<h1>Creating a new Pack<a class="headerlink" href="#creating-a-new-pack" title="Permalink to this headline"></a></h1> <h1>Creating a new Pack<a class="headerlink" href="#creating-a-new-pack" title="Permalink to this headline"></a></h1>
<div class="section" id="prerequisites"> <div class="section" id="prerequisites">
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline"></a></h2> <h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline"></a></h2>
<p>Youll need to have <a class="reference external" href="https://www.python.org/downloads/release/python-382/">Python 3.8</a> and <a class="reference external" href="https://github.com/python-poetry/poetry">poetry</a> <p>Youll need to have <a class="reference external" href="https://www.pyth1on.org/downloads/release/python-382/">Python 3.8</a> and <a class="reference external" href="https://github.com/python-poetry/poetry">poetry</a>
to develop Royalnet Packs.</p> to develop Royalnet Packs.</p>
</div> </div>
<div class="section" id="creating-the-repository"> <div class="section" id="creating-the-repository">
<h2>Creating the repository<a class="headerlink" href="#creating-the-repository" title="Permalink to this headline"></a></h2> <h2>Creating the repository<a class="headerlink" href="#creating-the-repository" title="Permalink to this headline"></a></h2>
<p>To create a new pack, create a new repository based on the <a class="reference external" href="https://github.com/Steffo99/royalnet-pack-template">Royalnet Pack template</a> <p>To create a new pack, create a new repository based on the <a class="reference external" href="https://github.com/Steffo99/royalnet-pack-template">Royalnet Pack template</a>
and clone it to your workspace.</p> and clone it to your workspace.</p>
<p>After cloning the template, run <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">install</span></code> to install the dependencies for the pack, creating the <code class="docutils literal notranslate"><span class="pre">poetry.lock</span></code> file.</p> <p>After cloning the template, run <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">install</span></code> to create a virtualenv and install the dependencies for the pack in it.</p>
<div class="section" id="pyproject-toml"> <div class="section" id="pyproject-toml">
<h3>pyproject.toml<a class="headerlink" href="#pyproject-toml" title="Permalink to this headline"></a></h3> <h3>pyproject.toml<a class="headerlink" href="#pyproject-toml" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code> file contains information about your Python project that will be read by <code class="docutils literal notranslate"><span class="pre">poetry</span></code> while building <p>The <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code> file contains information about your Python project that will be read by <code class="docutils literal notranslate"><span class="pre">poetry</span></code> while building
@ -207,24 +208,14 @@ the pack and publishing it to PyPI.</p>
<div class="section" id="examplepack"> <div class="section" id="examplepack">
<h3>examplepack<a class="headerlink" href="#examplepack" title="Permalink to this headline"></a></h3> <h3>examplepack<a class="headerlink" href="#examplepack" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">examplepack</span></code> folder contains the source code of your pack, and should be renamed to the name you set in the <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code> file.</p> <p>The <code class="docutils literal notranslate"><span class="pre">examplepack</span></code> folder contains the source code of your pack, and should be renamed to the name you set in the <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code> file.</p>
<p>It should contain a <code class="docutils literal notranslate"><span class="pre">version.py</span></code> file and six folders:</p> <p>It should contain six folders:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>examplepack <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>examplepack
├── commands ├── commands
├── events ├── events
├── stars ├── stars
├── tables ├── tables
├── types ├── types
├── utils └── utils
└── version.py
</pre></div>
</div>
</div>
<div class="section" id="version-py">
<h3>version.py<a class="headerlink" href="#version-py" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">version.py</span></code> file contains the version number of your pack.</p>
<p>If you changed the <code class="docutils literal notranslate"><span class="pre">version</span></code> field in the <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code> file, change the value of <code class="docutils literal notranslate"><span class="pre">semantic</span></code> in <code class="docutils literal notranslate"><span class="pre">version.py</span></code> to the same value.</p>
<p>Remember to use <a class="reference external" href="https://semver.org/">semantic versioning</a>!</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">semantic</span> <span class="o">=</span> <span class="s2">&quot;1.0.0&quot;</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@ -264,13 +255,22 @@ the pack and publishing it to PyPI.</p>
</div> </div>
<div class="section" id="adding-new-dependencies-to-the-pack"> <div class="section" id="adding-new-dependencies-to-the-pack">
<h2>Adding new dependencies to the Pack<a class="headerlink" href="#adding-new-dependencies-to-the-pack" title="Permalink to this headline"></a></h2> <h2>Adding new dependencies to the Pack<a class="headerlink" href="#adding-new-dependencies-to-the-pack" title="Permalink to this headline"></a></h2>
<p>As the Pack is actually a Python package, you can use <code class="docutils literal notranslate"><span class="pre">poetry</span></code> (or <code class="docutils literal notranslate"><span class="pre">pip</span></code>) to add new dependencies!</p> <p>As the Pack is actually a Python package, you can use <code class="docutils literal notranslate"><span class="pre">poetry</span></code> to add new dependencies!</p>
<p>Use <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">add</span> <span class="pre">packagename</span></code> to add and install a new dependency from the PyPI.</p> <p>Use <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">add</span> <span class="pre">packagename</span></code> to add and install a new dependency from the PyPI.</p>
</div> </div>
<div class="section" id="updating-the-dependencies">
<h2>Updating the dependencies<a class="headerlink" href="#updating-the-dependencies" title="Permalink to this headline"></a></h2>
<p>You can update all your dependencies by using: <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">update</span></code>.</p>
</div>
<div class="section" id="the-readme-md-file">
<h2>The README.md file<a class="headerlink" href="#the-readme-md-file" title="Permalink to this headline"></a></h2>
<p>The README.md file is the first thing that users of your pack will see!</p>
<p>Its recommended to describe accurately how to install and configure the pack, so other users will be able to use it too!</p>
</div>
<div class="section" id="publishing-the-pack"> <div class="section" id="publishing-the-pack">
<h2>Publishing the pack<a class="headerlink" href="#publishing-the-pack" title="Permalink to this headline"></a></h2> <h2>Publishing the pack<a class="headerlink" href="#publishing-the-pack" title="Permalink to this headline"></a></h2>
<p>To publish your Pack on the PyPI, run <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">build</span></code>, then <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">publish</span></code>.</p> <p>To publish your Pack on the PyPI, run <code class="docutils literal notranslate"><span class="pre">poetry</span> <span class="pre">publish</span> <span class="pre">--build</span></code>.</p>
<p>Poetry will build your Pack and upload it to the PyPI for you.</p> <p>Poetry will build your Pack and upload it to the PyPI for you!</p>
</div> </div>
</div> </div>
@ -294,7 +294,7 @@ the pack and publishing it to PyPI.</p>
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Royalnet Packs &mdash; Royalnet 5.6.2 documentation</title> <title>Royalnet Packs &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script> <script src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script> <script src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script> <script src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -195,7 +195,7 @@ Royalnet instance to add more features, such as more commands, more webpages and
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Adding a Star to the Pack &mdash; Royalnet 5.6.2 documentation</title> <title>Adding a Star to the Pack &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script> <script src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script> <script src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script> <script src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -187,7 +187,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Using Tables and databases &mdash; Royalnet 5.6.2 documentation</title> <title>Using Tables and databases &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script> <script src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script> <script src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script> <script src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -187,7 +187,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Module Index &mdash; Royalnet 5.6.2 documentation</title> <title>Python Module Index &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script> <script src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script> <script src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script>
@ -62,7 +62,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -220,7 +220,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random discoveries &mdash; Royalnet 5.6.2 documentation</title> <title>Random discoveries &mdash; Royalnet 5.10.4 documentation</title>
@ -21,10 +21,10 @@
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script> <script src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script> <script src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script>
@ -61,7 +61,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -206,7 +206,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

View file

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search &mdash; Royalnet 5.6.2 documentation</title> <title>Search &mdash; Royalnet 5.10.4 documentation</title>
@ -21,11 +21,11 @@
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script> <script src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script> <script src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script> <script src="_static/searchtools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script>
@ -60,7 +60,7 @@
<div class="version"> <div class="version">
5.6.2 5.10.4
</div> </div>
@ -174,7 +174,7 @@
<div role="contentinfo"> <div role="contentinfo">
<p> <p>
&copy; Copyright 2019, Stefano Pigozzi &copy; Copyright 2020, Stefano Pigozzi
</p> </p>
</div> </div>

File diff suppressed because one or more lines are too long

View file

@ -20,7 +20,7 @@ import royalnet
project = 'Royalnet' project = 'Royalnet'
# noinspection PyShadowingBuiltins # noinspection PyShadowingBuiltins
copyright = '2019, Stefano Pigozzi' copyright = '2020, Stefano Pigozzi'
author = 'Stefano Pigozzi' author = 'Stefano Pigozzi'
version = royalnet.__version__ version = royalnet.__version__
release = royalnet.__version__ release = royalnet.__version__

View file

@ -3,7 +3,7 @@
Creating a new Command Creating a new Command
==================================== ====================================
A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet interface. A Royalnet Command is a small script that is run whenever a specific message is sent to a Royalnet platform.
A Command code looks like this: :: A Command code looks like this: ::
@ -14,12 +14,12 @@ A Command code looks like this: ::
description = "Play ping-pong with the bot." description = "Play ping-pong with the bot."
# This code is run just once, while the bot is starting
def __init__(self, serf: "Serf", config): def __init__(self, serf: "Serf", config):
# This code is run just once, while the bot is starting
super().__init__(serf=serf, config=config) super().__init__(serf=serf, config=config)
# This code is run every time the command is called
async def run(self, args: rc.CommandArgs, data: rc.CommandData): async def run(self, args: rc.CommandArgs, data: rc.CommandData):
# This code is run every time the command is called
await data.reply("Pong!") await data.reply("Pong!")
Creating a new Command Creating a new Command
@ -32,7 +32,7 @@ Try to keep the name as short as possible, while staying specific enough so no o
Next, create a new Python file with the ``name`` you have thought of. Next, create a new Python file with the ``name`` you have thought of.
The previously mentioned "spaghetti" command should have a file called ``spaghetti.py``. The previously mentioned "spaghetti" command should have a file called ``spaghetti.py``.
Then, in the first row of the file, import the :class:`Command` class from royalnet, and create a new class inheriting from it: :: Then, in the first row of the file, import the :class:`~Command` class from royalnet, and create a new class inheriting from it: ::
import royalnet.commands as rc import royalnet.commands as rc
@ -48,9 +48,9 @@ Inside the class, override the attributes ``name`` and ``description`` with resp
description = "Send a spaghetti emoji in the chat." description = "Send a spaghetti emoji in the chat."
Now override the :meth:`Command.run` method, adding the code you want the bot to run when the command is called. Now override the :meth:`~Command.run` method, adding the code you want the bot to run when the command is called.
To send a message in the chat the command was called in, you can use the :meth:`CommandData.reply` coroutine: :: To send a message in the chat the command was called in, you can use the :meth:`~CommandData.reply` coroutine: ::
import royalnet.commands as rc import royalnet.commands as rc
@ -79,7 +79,7 @@ command to the ``available_commands`` list: ::
Formatting command replies Formatting command replies
------------------------------------ ------------------------------------
You can use a subset of [BBCode](https://en.wikipedia.org/wiki/BBCode) to format messages sent with :meth:`CommandData.reply`: :: You can use a subset of `BBCode <https://en.wikipedia.org/wiki/BBCode>`_ to format messages sent with :meth:`~CommandData.reply`: ::
async def run(self, args: rc.CommandArgs, data: rc.CommandData): async def run(self, args: rc.CommandArgs, data: rc.CommandData):
await data.reply("[b]Bold of you to assume that my code has no bugs.[/b]") await data.reply("[b]Bold of you to assume that my code has no bugs.[/b]")
@ -101,7 +101,7 @@ Command arguments
A command can have some arguments passed by the user: for example, on Telegram an user may type `/spaghetti carbonara al-dente` A command can have some arguments passed by the user: for example, on Telegram an user may type `/spaghetti carbonara al-dente`
to pass the :class:`str` `"carbonara al-dente"` to the command code. to pass the :class:`str` `"carbonara al-dente"` to the command code.
These arguments can be accessed in multiple ways through the ``args`` parameter passed to the :meth:`Command.run` These arguments can be accessed in multiple ways through the ``args`` parameter passed to the :meth:`~Command.run`
method. method.
If you want your command to use arguments, override the ``syntax`` class attribute with a brief description of the If you want your command to use arguments, override the ``syntax`` class attribute with a brief description of the
@ -148,7 +148,7 @@ If you request an argument with a certain number, but the argument does not exis
Optional access Optional access
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you don't want arguments to be required, you can access them through the :meth:`CommandArgs.optional` method: it If you don't want arguments to be required, you can access them through the :meth:`~CommandArgs.optional` method: it
will return ``None`` if the argument wasn't passed, making it **optional**. :: will return ``None`` if the argument wasn't passed, making it **optional**. ::
args.optional(0) args.optional(0)
@ -168,7 +168,7 @@ You can specify a default result too, so that the method will return it instead
Full string Full string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want the full argument string, you can use the :meth:`CommandArgs.joined` method. :: If you want the full argument string, you can use the :meth:`~CommandArgs.joined` method. ::
args.joined() args.joined()
# "carbonara al-dente" # "carbonara al-dente"
@ -184,7 +184,7 @@ Regular expressions
For more complex commands, you may want to get arguments through `regular expressions <https://regexr.com/>`_. For more complex commands, you may want to get arguments through `regular expressions <https://regexr.com/>`_.
You can then use the :meth:`CommandArgs.match` method, which tries to match a pattern to the command argument string, You can then use the :meth:`~CommandArgs.match` method, which tries to match a pattern to the command argument string,
which returns a tuple of the matched groups and raises an :exc:`.InvalidInputError` if there is no match. which returns a tuple of the matched groups and raises an :exc:`.InvalidInputError` if there is no match.
To match a pattern, :func:`re.match` is used, meaning that Python will try to match only at the beginning of the string. :: To match a pattern, :func:`re.match` is used, meaning that Python will try to match only at the beginning of the string. ::
@ -204,12 +204,12 @@ To match a pattern, :func:`re.match` is used, meaning that Python will try to ma
Raising errors Raising errors
--------------------------------------------- ---------------------------------------------
If you want to display an error message to the user, you can raise a :exc:`.CommandError` using the error message as argument: :: If you want to display an error message to the user, you can raise a :exc:`~CommandError` using the error message as argument: ::
if not kitchen.is_open(): if not kitchen.is_open():
raise CommandError("The kitchen is closed. Come back later!") raise CommandError("The kitchen is closed. Come back later!")
There are some subclasses of :exc:`.CommandError` that can be used for some more specific cases: There are some subclasses of :exc:`~CommandError` that can be used for some more specific cases:
:exc:`.UserError` :exc:`.UserError`
The user did something wrong, it is not a problem with the bot. The user did something wrong, it is not a problem with the bot.
@ -219,7 +219,7 @@ There are some subclasses of :exc:`.CommandError` that can be used for some more
*Additionally displays the command syntax in the error message.* *Additionally displays the command syntax in the error message.*
:exc:`.UnsupportedError` :exc:`.UnsupportedError`
The command is not supported on the interface it is being called. The command is not supported on the platform it is being called.
:exc:`.ConfigurationError` :exc:`.ConfigurationError`
A value is missing or invalid in the ``config.toml`` section of your pack. A value is missing or invalid in the ``config.toml`` section of your pack.
@ -235,7 +235,7 @@ Coroutines and slow operations
You may have noticed that in the previous examples we used ``await data.reply("🍝")`` instead of just ``data.reply("🍝")``. You may have noticed that in the previous examples we used ``await data.reply("🍝")`` instead of just ``data.reply("🍝")``.
This is because :meth:`CommandData.reply` isn't a simple method: it is a coroutine, a special kind of function that This is because :meth:`~CommandData.reply` isn't 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. can be executed separately from the rest of the code, allowing the bot to do other things in the meantime.
By adding the ``await`` keyword before the ``data.reply("🍝")``, we tell the bot that it can do other things, like By adding the ``await`` keyword before the ``data.reply("🍝")``, we tell the bot that it can do other things, like
@ -266,13 +266,13 @@ Delete the invoking message
The invoking message of a command is the message that the user sent that the bot recognized as a command; for example, The invoking message of a command is the message that the user sent that the bot recognized as a command; for example,
the message ``/spaghetti carbonara`` is the invoking message for the ``spaghetti`` command run. the message ``/spaghetti carbonara`` is the invoking message for the ``spaghetti`` command run.
You can have the bot delete the invoking message for a command by calling the :class:`CommandData.delete_invoking` You can have the bot delete the invoking message for a command by calling the :class:`~CommandData.delete_invoking`
method: :: method: ::
async def run(self, args, data): async def run(self, args, data):
await data.delete_invoking() await data.delete_invoking()
Not all interfaces support deleting messages; by default, if the interface does not support deletions, the call is Not all platforms support deleting messages; by default, if the platform does not support deletions, the call is
ignored. ignored.
You can have the method raise an error if the message can't be deleted by setting the ``error_if_unavailable`` parameter You can have the method raise an error if the message can't be deleted by setting the ``error_if_unavailable`` parameter
@ -289,7 +289,7 @@ to True: ::
Sharing data between multiple calls Sharing data between multiple calls
------------------------------------ ------------------------------------
The :class:`Command` class is shared between multiple command calls: if you need to store some data, you may store it as a protected/private field of your command class: :: The :class:`~Command` class is shared between multiple command calls: if you need to store some data, you may store it as a protected/private field of your command class: ::
class SpaghettiCommand(rc.Command): class SpaghettiCommand(rc.Command):
name = "spaghetti" name = "spaghetti"
@ -393,7 +393,7 @@ You can **call an event** from inside a command, and receive its return value.
This may be used for example to get data from a different platform, such as getting the users online in a specific Discord server. This may be used for example to get data from a different platform, such as getting the users online in a specific Discord server.
You can call an event with the :meth:`Serf.call_herald_event` method: :: You can call an event with the :meth:`.Serf.call_herald_event` method: ::
result = await self.serf.call_herald_event("event_name") result = await self.serf.call_herald_event("event_name")
@ -401,19 +401,103 @@ You can also pass parameters to the called event: ::
result = await self.serf.call_herald_event("event_name", ..., kwarg=..., *..., **...) result = await self.serf.call_herald_event("event_name", ..., kwarg=..., *..., **...)
Errors raised by the event will also be raised by the :meth:`Serf.call_herald_event` method as one of the exceptions described in the :ref:`Raising errors` section. Errors raised by the event will also be raised by the :meth:`.Serf.call_herald_event` method as one of the exceptions described in the :ref:`Raising errors` section.
Distinguish between platforms
------------------------------------
To see if a command is being run on a specific platform, you can check the type of the ``self.serf`` object: ::
import royalnet.serf.telegram as rst
import royalnet.serf.discord as rsd
...
if isinstance(self.serf, rst.TelegramSerf):
await data.reply("This command is being run on Telegram.")
elif isinstance(self.serf, rsd.DiscordSerf):
await data.reply("This command is being run on Discord.")
...
Displaying Keyboards Displaying Keyboards
------------------------------------ ------------------------------------
This section is not documented yet. A keyboard is a message with multiple buttons ("keys") attached which can be pressed by an user viewing the message.
Running code at the initialization of the bot Once a button is pressed, a callback function is run, which has its own :class:`~CommandData` context and can do everything a regular comment call could.
The callback function is a coroutine accepting a single ``data: CommandData`` argument: ::
async def answer(data: CommandData) -> None:
await data.reply("Spaghetti were ejected from your floppy drive!")
To create a new key, you can use the :class:`~KeyboardKey` class: ::
key = KeyboardKey(
short="⏏️", # An emoji representing the key on platforms the full message cannot be displayed
text="Eject spaghetti from the floppy drive", # The text displayed on the key
callback=answer # The coroutine to call when the key is pressed.
)
To display a keyboard and wait for a keyboard press, you can use the :meth:`~CommandData.keyboard` asynccontextmanager.
While the contextmanager is in scope, the keyboard will be valid and it will be possible to interact with it.
Any further key pressed will be answered with an error message. ::
async with data.keyboard(text="What kind of spaghetti would you want to order?", keys=keyboard):
# This will keep the keyboard valid for 10 seconds
await asyncio.sleep(10)
Replies in callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Calls to :meth:`~CommandData.reply` made with the :class:`~CommandData` of a keyboard callback won't always result in a message being sent: for example, on Telegram, replies will result in a small message being displayed on the top of the screen.
Reading data from the configuration file
--------------------------------------------- ---------------------------------------------
This section is not documented yet. You can read data from your pack's configuration section through the :attr:`~Command.config` attribute: ::
[Packs."spaghettipack"]
spaghetti = { mode="al_dente", two=true }
::
await data.reply(f"Here's your spaghetti {self.config['spaghetti']['mode']}!")
Running code on Serf start
----------------------------------------------
The code inside ``__init__`` is run only once, during the initialization step of the bot: ::
def __init__(self, serf: "Serf", config):
super().__init__(serf=serf, config=config)
# The contents of this variable will be persisted across command calls
self.persistent_variable = 0
# The text will be printed only if the config flag is set to something
if config["spaghetti"]["two"]:
print("Famme due spaghi!")
.. note:: Some methods may be unavailable during the initialization of the Serf.
Running repeating jobs Running repeating jobs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This section is not documented yet. To run a job independently from the rest of the command, you can schedule the execution of a coroutine inside ``__init__``: ::
async def mycoroutine():
while True:
print("Free spaghetti every 60 seconds!")
await asyncio.sleep(60)
def __init__(self, serf: "Serf", config):
super().__init__(serf=serf, config=config)
self.loop.create_task(mycoroutine())
As it will be executed once for every platform Royalnet is running on, you may want to run the task only on a single platform: ::
def __init__(self, serf: "Serf", config):
super().__init__(serf=serf, config=config)
if isinstance(self.serf, rst.TelegramSerf):
self.loop.create_task(mycoroutine())

View file

@ -39,7 +39,7 @@ class Command(metaclass=abc.ABCMeta):
return f"[c]{self.serf.prefix}{self.name}[/c]" return f"[c]{self.serf.prefix}{self.name}[/c]"
@property @property
def alchemy(self) -> Alchemy: def alchemy(self) -> "Alchemy":
"""A shortcut for :attr:`.interface.alchemy`.""" """A shortcut for :attr:`.interface.alchemy`."""
return self.serf.alchemy return self.serf.alchemy

View file

@ -28,13 +28,13 @@ class Star(metaclass=abc.ABCMeta):
raise NotImplementedError() raise NotImplementedError()
@property @property
def alchemy(self) -> Alchemy: def alchemy(self) -> "Alchemy":
"""A shortcut for the :class:`~royalnet.alchemy.Alchemy` of the :class:`Constellation`.""" """A shortcut for the :class:`~royalnet.alchemy.Alchemy` of the :class:`Constellation`."""
return self.constellation.alchemy return self.constellation.alchemy
# noinspection PyPep8Naming # noinspection PyPep8Naming
@property @property
def Session(self) -> sqlalchemy.orm.session.Session: def Session(self) -> "sqlalchemy.orm.session.Session":
"""A shortcut for the :class:`~royalnet.alchemy.Alchemy` :class:`Session` of the :class:`Constellation`.""" """A shortcut for the :class:`~royalnet.alchemy.Alchemy` :class:`Session` of the :class:`Constellation`."""
return self.constellation.alchemy.Session return self.constellation.alchemy.Session