mirror of
https://github.com/RYGhub/royalnet.git
synced 2025-03-19 23:13:26 +00:00
Update docs
This commit is contained in:
parent
6983d40b19
commit
576f628ab0
21 changed files with 118 additions and 177 deletions
docs
doctrees
html
docs_source
royalnet
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -335,12 +335,6 @@
|
|||
<dt id="royalnet.audio.YtdlFile">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.audio.</code><code class="descname">YtdlFile</code><span class="sig-paren">(</span><em>info: royalnet.audio.youtubedl.YtdlInfo</em>, <em>outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em>**ytdl_args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A wrapper around a youtube_dl downloaded file.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.audio.YtdlFile.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>info: royalnet.audio.youtubedl.YtdlInfo</em>, <em>outtmpl='%(title)s-%(id)s.%(ext)s'</em>, <em>**ytdl_args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.audio.YtdlFile._stop_download">
|
||||
<code class="descname">_stop_download</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.YtdlFile._stop_download" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -392,13 +386,7 @@
|
|||
<dl class="class">
|
||||
<dt id="royalnet.audio.RoyalPCMFile">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.audio.</code><code class="descname">RoyalPCMFile</code><span class="sig-paren">(</span><em>info: royalnet.audio.youtubedl.YtdlInfo</em>, <em>**ytdl_args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMFile" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="method">
|
||||
<dt id="royalnet.audio.RoyalPCMFile.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>info: royalnet.audio.youtubedl.YtdlInfo</em>, <em>**ytdl_args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.audio.RoyalPCMFile.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dd><dl class="attribute">
|
||||
<dt id="royalnet.audio.RoyalPCMFile.audio_filename">
|
||||
<code class="descname">audio_filename</code><a class="headerlink" href="#royalnet.audio.RoyalPCMFile.audio_filename" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns:
|
||||
|
|
|
@ -161,16 +161,10 @@
|
|||
<dt id="royalnet.bots.TelegramBot">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.bots.</code><code class="descname">TelegramBot</code><span class="sig-paren">(</span><em>*</em>, <em>telegram_config: royalnet.bots.telegram.TelegramConfig</em>, <em>royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None</em>, <em>database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None</em>, <em>command_prefix: str = '/'</em>, <em>commands: List[Type[royalnet.utils.command.Command]] = None</em>, <em>missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em>, <em>error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.TelegramBot" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A bot that connects to <a class="reference external" href="https://telegram.org/">Telegram</a>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.TelegramBot.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>*</em>, <em>telegram_config: royalnet.bots.telegram.TelegramConfig</em>, <em>royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None</em>, <em>database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None</em>, <em>command_prefix: str = '/'</em>, <em>commands: List[Type[royalnet.utils.command.Command]] = None</em>, <em>missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em>, <em>error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.TelegramBot.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.TelegramBot._call_factory">
|
||||
<code class="descname">_call_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → Type[royalnet.utils.call.Call]<a class="headerlink" href="#royalnet.bots.TelegramBot._call_factory" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create the Call class, representing a Call command. It should inherit from the utils.Call class.</p>
|
||||
<dd><p>Create the TelegramCall class, representing a command call. It should inherit from :py:class`royalnet.utils.Call`.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
|
@ -181,7 +175,8 @@
|
|||
<dl class="method">
|
||||
<dt id="royalnet.bots.TelegramBot._init_client">
|
||||
<code class="descname">_init_client</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.TelegramBot._init_client" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dd><p>Create the <a class="reference external" href="https://python-telegram-bot.readthedocs.io/en/stable/telegram.bot.html#telegram.Bot" title="(in Python Telegram Bot v11.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">telegram.Bot</span></code></a>, and set the starting offset.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.bots.TelegramBot.botfather_command_string">
|
||||
|
@ -204,51 +199,40 @@
|
|||
<dl class="class">
|
||||
<dt id="royalnet.bots.TelegramConfig">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.bots.</code><code class="descname">TelegramConfig</code><span class="sig-paren">(</span><em>token: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.TelegramConfig" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The specific configuration to be used for <span class="xref std std-ref">royalnet.database.TelegramBot</span>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.TelegramConfig.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>token: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.TelegramConfig.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dd><p>The specific configuration to be used for <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.TelegramBot</span></code>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="royalnet.bots.DiscordBot">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.bots.</code><code class="descname">DiscordBot</code><span class="sig-paren">(</span><em>*</em>, <em>discord_config: royalnet.bots.discord.DiscordConfig</em>, <em>royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None</em>, <em>database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None</em>, <em>command_prefix: str = '!'</em>, <em>commands: List[Type[royalnet.utils.command.Command]] = None</em>, <em>missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em>, <em>error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A bot that connects to <a class="reference external" href="https://discordapp.com/">Discord</a>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>*</em>, <em>discord_config: royalnet.bots.discord.DiscordConfig</em>, <em>royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None</em>, <em>database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None</em>, <em>command_prefix: str = '!'</em>, <em>commands: List[Type[royalnet.utils.command.Command]] = None</em>, <em>missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em>, <em>error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot._bot_factory">
|
||||
<code class="descname">_bot_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → Type[discord.client.Client]<a class="headerlink" href="#royalnet.bots.DiscordBot._bot_factory" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create a new DiscordClient class based on this DiscordBot.</p>
|
||||
<dd><p>Create a custom DiscordClient class inheriting from <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Client" title="(in discord.py v1.1.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Client</span></code></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot._call_factory">
|
||||
<code class="descname">_call_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → Type[royalnet.utils.call.Call]<a class="headerlink" href="#royalnet.bots.DiscordBot._call_factory" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create the Call class, representing a Call command. It should inherit from the utils.Call class.</p>
|
||||
<dd><p>Create the TelegramCall class, representing a command call. It should inherit from :py:class`royalnet.utils.Call`.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot._init_client">
|
||||
<code class="descname">_init_client</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot._init_client" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create a bot instance.</p>
|
||||
<dd><p>Create an instance of the DiscordClient class created in <code class="xref py py-func docutils literal notranslate"><span class="pre">royalnet.bots.discord._bot_factory()</span></code>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot._init_voice">
|
||||
<code class="descname">_init_voice</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot._init_voice" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dd><p>Initialize the variables needed for the connection to voice chat.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot.add_to_music_data">
|
||||
<code class="descname">add_to_music_data</code><span class="sig-paren">(</span><em>audio_sources: List[discord.player.AudioSource], guild: discord.guild.Guild</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot.add_to_music_data" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">add_to_music_data</code><span class="sig-paren">(</span><em>audio_sources: List[royalnet.audio.royalpcmaudio.RoyalPCMAudio], guild: discord.guild.Guild</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot.add_to_music_data" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Add a file to the corresponding music_data object.</p>
|
||||
</dd></dl>
|
||||
|
||||
|
@ -266,72 +250,64 @@
|
|||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot.run">
|
||||
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot.run" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A blocking coroutine that should make the bot start listening to commands and requests.</p>
|
||||
<dd><p>Login to Discord, then run the bot.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordBot.update_activity_with_source_title">
|
||||
<code class="descname">update_activity_with_source_title</code><span class="sig-paren">(</span><em>rpa: Optional[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot.update_activity_with_source_title" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descname">update_activity_with_source_title</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordBot.update_activity_with_source_title" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Change the bot’s presence (using <code class="xref py py-func docutils literal notranslate"><span class="pre">discord.Client.change_presence()</span></code>) to match the current listening status.</p>
|
||||
<p>If multiple guilds are using the bot, the bot will always have an empty presence.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="royalnet.bots.DiscordConfig">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.bots.</code><code class="descname">DiscordConfig</code><span class="sig-paren">(</span><em>token: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordConfig" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The specific configuration to be used for <span class="xref std std-ref">royalnet.database.DiscordBot</span>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.DiscordConfig.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>token: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.DiscordConfig.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dd><p>The specific configuration to be used for <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.database.DiscordBot</span></code>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="royalnet.bots.GenericBot">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.bots.</code><code class="descname">GenericBot</code><span class="sig-paren">(</span><em>*</em>, <em>royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None</em>, <em>database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None</em>, <em>command_prefix: str</em>, <em>commands: List[Type[royalnet.utils.command.Command]] = None</em>, <em>missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em>, <em>error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.GenericBot" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A generic bot class, to be used as base for the other more specific classes, such as <span class="xref std std-ref">royalnet.bots.TelegramBot</span> and <span class="xref std std-ref">royalnet.bots.DiscordBot</span>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>*</em>, <em>royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None</em>, <em>database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None</em>, <em>command_prefix: str</em>, <em>commands: List[Type[royalnet.utils.command.Command]] = None</em>, <em>missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em>, <em>error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.GenericBot.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot._call_factory">
|
||||
<code class="descname">_call_factory</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → Type[royalnet.utils.call.Call]<a class="headerlink" href="#royalnet.bots.GenericBot._call_factory" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create the Call class, representing a Call command. It should inherit from the utils.Call class.</p>
|
||||
<dd><p>Create the TelegramCall class, representing a command call. It should inherit from :py:class`royalnet.utils.Call`.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot._init_commands">
|
||||
<code class="descname">_init_commands</code><span class="sig-paren">(</span><em>command_prefix: str, commands: List[Type[royalnet.utils.command.Command]], missing_command: Type[royalnet.utils.command.Command], error_command: Type[royalnet.utils.command.Command]</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.GenericBot._init_commands" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Generate the commands dictionary required to handle incoming messages, and the network_handlers dictionary required to handle incoming requests.</p>
|
||||
<dd><p>Generate the <code class="docutils literal notranslate"><span class="pre">commands</span></code> dictionary required to handle incoming messages, and the <code class="docutils literal notranslate"><span class="pre">network_handlers</span></code> dictionary required to handle incoming requests.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot._init_database">
|
||||
<code class="descname">_init_database</code><span class="sig-paren">(</span><em>commands: List[Type[royalnet.utils.command.Command]], database_config: royalnet.database.databaseconfig.DatabaseConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.GenericBot._init_database" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Connect to the database, and create the missing tables required by the selected commands.</p>
|
||||
<dd><p>Create an <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.Alchemy</span></code> with the tables required by the commands. Then, find the chain that links the <code class="docutils literal notranslate"><span class="pre">master_table</span></code> to the <code class="docutils literal notranslate"><span class="pre">identity_table</span></code>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot._init_royalnet">
|
||||
<code class="descname">_init_royalnet</code><span class="sig-paren">(</span><em>royalnet_config: royalnet.network.royalnetconfig.RoyalnetConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.GenericBot._init_royalnet" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Create a RoyalnetLink, and run it as a task.</p>
|
||||
<dd><p>Create a <a class="reference internal" href="network.html#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a>, and run it as a <a class="reference external" href="https://docs.python.org/3.7/library/asyncio-task.html#asyncio.Task" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Task</span></code></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot._network_handler">
|
||||
<code class="descname">_network_handler</code><span class="sig-paren">(</span><em>message: royalnet.network.messages.Message</em><span class="sig-paren">)</span> → royalnet.network.messages.Message<a class="headerlink" href="#royalnet.bots.GenericBot._network_handler" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Handle a single Message received from the RoyalnetLink</p>
|
||||
<dd><p>Handle a single <a class="reference internal" href="network.html#royalnet.network.Message" title="royalnet.network.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.Message</span></code></a> received from the <a class="reference internal" href="network.html#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.bots.GenericBot.call">
|
||||
<code class="descname">call</code><span class="sig-paren">(</span><em>command_name: str</em>, <em>channel</em>, <em>parameters: List[str] = None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.bots.GenericBot.call" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Call a command by its string, or missing_command if it doesn’t exists, or error_command if an exception is raised during the execution.</p>
|
||||
<dd><p>Call the command with the specified name.</p>
|
||||
<p>If it doesn’t exist, call <code class="docutils literal notranslate"><span class="pre">self.missing_command</span></code>.</p>
|
||||
<p>If an exception is raised during the execution of the command, call <code class="docutils literal notranslate"><span class="pre">self.error_command</span></code>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
|
|
@ -205,12 +205,6 @@
|
|||
<dt id="royalnet.database.DatabaseConfig">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.database.</code><code class="descname">DatabaseConfig</code><span class="sig-paren">(</span><em>database_uri: str, master_table: Type[CT_co], identity_table: Type[CT_co], identity_column_name: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.database.DatabaseConfig" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The configuration to be used for the <span class="xref std std-ref">royalnet.database.Alchemy</span> component of <span class="xref std std-ref">royalnet.bots.GenericBot</span>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.database.DatabaseConfig.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>database_uri: str, master_table: Type[CT_co], identity_table: Type[CT_co], identity_column_name: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.database.DatabaseConfig.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<div class="section" id="module-royalnet.database.tables">
|
||||
|
@ -265,7 +259,7 @@
|
|||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.database.tables.Telegram.royal">
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x6fa26f0; no key></em><a class="headerlink" href="#royalnet.database.tables.Telegram.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x7a70300; no key></em><a class="headerlink" href="#royalnet.database.tables.Telegram.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -295,7 +289,7 @@
|
|||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.database.tables.Diario.creator">
|
||||
<code class="descname">creator</code><em class="property"> = <RelationshipProperty at 0x6fa2270; no key></em><a class="headerlink" href="#royalnet.database.tables.Diario.creator" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">creator</code><em class="property"> = <RelationshipProperty at 0x7a70348; no key></em><a class="headerlink" href="#royalnet.database.tables.Diario.creator" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -320,7 +314,7 @@
|
|||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.database.tables.Diario.quoted_account">
|
||||
<code class="descname">quoted_account</code><em class="property"> = <RelationshipProperty at 0x6fa2c90; no key></em><a class="headerlink" href="#royalnet.database.tables.Diario.quoted_account" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">quoted_account</code><em class="property"> = <RelationshipProperty at 0x7a70978; no key></em><a class="headerlink" href="#royalnet.database.tables.Diario.quoted_account" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -355,7 +349,7 @@
|
|||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.database.tables.Alias.royal">
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x6fa2588; no key></em><a class="headerlink" href="#royalnet.database.tables.Alias.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x7a70198; no key></em><a class="headerlink" href="#royalnet.database.tables.Alias.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -370,7 +364,7 @@
|
|||
<em class="property">class </em><code class="descclassname">royalnet.database.tables.</code><code class="descname">ActiveKvGroup</code><a class="headerlink" href="#royalnet.database.tables.ActiveKvGroup" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="attribute">
|
||||
<dt id="royalnet.database.tables.ActiveKvGroup.group">
|
||||
<code class="descname">group</code><em class="property"> = <RelationshipProperty at 0x6fa2fa8; no key></em><a class="headerlink" href="#royalnet.database.tables.ActiveKvGroup.group" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">group</code><em class="property"> = <RelationshipProperty at 0x7a701e0; no key></em><a class="headerlink" href="#royalnet.database.tables.ActiveKvGroup.group" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -380,7 +374,7 @@
|
|||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.database.tables.ActiveKvGroup.royal">
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x6fa2d20; no key></em><a class="headerlink" href="#royalnet.database.tables.ActiveKvGroup.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x7a70b70; no key></em><a class="headerlink" href="#royalnet.database.tables.ActiveKvGroup.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -395,7 +389,7 @@
|
|||
<em class="property">class </em><code class="descclassname">royalnet.database.tables.</code><code class="descname">Keyvalue</code><a class="headerlink" href="#royalnet.database.tables.Keyvalue" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="attribute">
|
||||
<dt id="royalnet.database.tables.Keyvalue.group">
|
||||
<code class="descname">group</code><em class="property"> = <RelationshipProperty at 0x6fa2270; no key></em><a class="headerlink" href="#royalnet.database.tables.Keyvalue.group" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">group</code><em class="property"> = <RelationshipProperty at 0x7a709c0; no key></em><a class="headerlink" href="#royalnet.database.tables.Keyvalue.group" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
@ -450,7 +444,7 @@
|
|||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.database.tables.Discord.royal">
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x6fa2f18; no key></em><a class="headerlink" href="#royalnet.database.tables.Discord.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descname">royal</code><em class="property"> = <RelationshipProperty at 0x7a70a08; no key></em><a class="headerlink" href="#royalnet.database.tables.Discord.royal" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
|
|
|
@ -187,46 +187,16 @@
|
|||
<li><a href="audio.html#royalnet.audio.Pool.__init__">(royalnet.audio.Pool method)</a>
|
||||
</li>
|
||||
<li><a href="audio.html#royalnet.audio.RoyalPCMAudio.__init__">(royalnet.audio.RoyalPCMAudio method)</a>
|
||||
</li>
|
||||
<li><a href="audio.html#royalnet.audio.RoyalPCMFile.__init__">(royalnet.audio.RoyalPCMFile method)</a>
|
||||
</li>
|
||||
<li><a href="audio.html#royalnet.audio.YtdlFile.__init__">(royalnet.audio.YtdlFile method)</a>
|
||||
</li>
|
||||
<li><a href="audio.html#royalnet.audio.YtdlInfo.__init__">(royalnet.audio.YtdlInfo method)</a>
|
||||
</li>
|
||||
<li><a href="bots.html#royalnet.bots.DiscordBot.__init__">(royalnet.bots.DiscordBot method)</a>
|
||||
</li>
|
||||
<li><a href="bots.html#royalnet.bots.DiscordConfig.__init__">(royalnet.bots.DiscordConfig method)</a>
|
||||
</li>
|
||||
<li><a href="bots.html#royalnet.bots.GenericBot.__init__">(royalnet.bots.GenericBot method)</a>
|
||||
</li>
|
||||
<li><a href="bots.html#royalnet.bots.TelegramBot.__init__">(royalnet.bots.TelegramBot method)</a>
|
||||
</li>
|
||||
<li><a href="bots.html#royalnet.bots.TelegramConfig.__init__">(royalnet.bots.TelegramConfig method)</a>
|
||||
</li>
|
||||
<li><a href="database.html#royalnet.database.Alchemy.__init__">(royalnet.database.Alchemy method)</a>
|
||||
</li>
|
||||
<li><a href="database.html#royalnet.database.DatabaseConfig.__init__">(royalnet.database.DatabaseConfig method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.NetworkError.__init__">(royalnet.network.NetworkError method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.Package.__init__">(royalnet.network.Package method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.RequestError.__init__">(royalnet.network.RequestError method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.RoyalnetConfig.__init__">(royalnet.network.RoyalnetConfig method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.RoyalnetLink.__init__">(royalnet.network.RoyalnetLink method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.RoyalnetServer.__init__">(royalnet.network.RoyalnetServer method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.ServerErrorMessage.__init__">(royalnet.network.ServerErrorMessage method)</a>
|
||||
</li>
|
||||
<li><a href="utils.html#royalnet.utils.Call.__init__">(royalnet.utils.Call method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="bots.html#royalnet.bots.DiscordBot._bot_factory">_bot_factory() (royalnet.bots.DiscordBot method)</a>
|
||||
</li>
|
||||
<li><a href="bots.html#royalnet.bots.DiscordBot._call_factory">_call_factory() (royalnet.bots.DiscordBot method)</a>
|
||||
|
@ -237,6 +207,8 @@
|
|||
<li><a href="bots.html#royalnet.bots.TelegramBot._call_factory">(royalnet.bots.TelegramBot method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="database.html#royalnet.database.Alchemy._create_tables">_create_tables() (royalnet.database.Alchemy method)</a>
|
||||
</li>
|
||||
<li><a href="audio.html#royalnet.audio.Playlist._generate_generator">_generate_generator() (royalnet.audio.Playlist method)</a>
|
||||
|
@ -629,9 +601,11 @@
|
|||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="commands.html#royalnet.commands.RageCommand">RageCommand (class in royalnet.commands)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.RequestError.raise_on_error">raise_on_error() (royalnet.network.RequestError method)</a>
|
||||
<li><a href="network.html#royalnet.network.Reply.raise_on_error">raise_on_error() (royalnet.network.Reply method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="network.html#royalnet.network.RequestError.raise_on_error">(royalnet.network.RequestError method)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.RequestSuccessful.raise_on_error">(royalnet.network.RequestSuccessful method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
|
@ -642,6 +616,8 @@
|
|||
<li><a href="database.html#royalnet.database.relationshiplinkchain">relationshiplinkchain() (in module royalnet.database)</a>
|
||||
</li>
|
||||
<li><a href="commands.html#royalnet.commands.ReminderCommand">ReminderCommand (class in royalnet.commands)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.Reply">Reply (class in royalnet.network)</a>
|
||||
</li>
|
||||
<li><a href="network.html#royalnet.network.Package.reply">reply() (royalnet.network.Package method)</a>
|
||||
|
||||
|
|
|
@ -167,12 +167,6 @@
|
|||
<dt id="royalnet.network.ServerErrorMessage">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.network.</code><code class="descname">ServerErrorMessage</code><span class="sig-paren">(</span><em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.ServerErrorMessage" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Something went wrong in the connection to the <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a>.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.network.ServerErrorMessage.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.ServerErrorMessage.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
|
@ -198,12 +192,6 @@
|
|||
<dt id="royalnet.network.RoyalnetLink">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.network.</code><code class="descname">RoyalnetLink</code><span class="sig-paren">(</span><em>master_uri: str</em>, <em>secret: str</em>, <em>link_type: str</em>, <em>request_handler</em>, <em>*</em>, <em>loop: asyncio.events.AbstractEventLoop = <_WindowsSelectorEventLoop running=False closed=False debug=False></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="method">
|
||||
<dt id="royalnet.network.RoyalnetLink.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>master_uri: str</em>, <em>secret: str</em>, <em>link_type: str</em>, <em>request_handler</em>, <em>*</em>, <em>loop: asyncio.events.AbstractEventLoop = <_WindowsSelectorEventLoop running=False closed=False debug=False></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.network.RoyalnetLink.connect">
|
||||
<code class="descname">connect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink.connect" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
@ -238,18 +226,13 @@
|
|||
<dl class="exception">
|
||||
<dt id="royalnet.network.NetworkError">
|
||||
<em class="property">exception </em><code class="descclassname">royalnet.network.</code><code class="descname">NetworkError</code><span class="sig-paren">(</span><em>error_msg: royalnet.network.messages.ServerErrorMessage</em>, <em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.NetworkError" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="method">
|
||||
<dt id="royalnet.network.NetworkError.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>error_msg: royalnet.network.messages.ServerErrorMessage</em>, <em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.NetworkError.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="exception">
|
||||
<dt id="royalnet.network.NotConnectedError">
|
||||
<em class="property">exception </em><code class="descclassname">royalnet.network.</code><code class="descname">NotConnectedError</code><a class="headerlink" href="#royalnet.network.NotConnectedError" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dd><p>The <a class="reference internal" href="#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a> is not connected to a <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="exception">
|
||||
<dt id="royalnet.network.NotIdentifiedError">
|
||||
|
@ -308,12 +291,6 @@
|
|||
<dt id="royalnet.network.RoyalnetServer">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.network.</code><code class="descname">RoyalnetServer</code><span class="sig-paren">(</span><em>address: str</em>, <em>port: int</em>, <em>required_secret: str</em>, <em>*</em>, <em>loop: asyncio.events.AbstractEventLoop = <_WindowsSelectorEventLoop running=False closed=False debug=False></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetServer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="method">
|
||||
<dt id="royalnet.network.RoyalnetServer.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>address: str</em>, <em>port: int</em>, <em>required_secret: str</em>, <em>*</em>, <em>loop: asyncio.events.AbstractEventLoop = <_WindowsSelectorEventLoop running=False closed=False debug=False></em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetServer.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="royalnet.network.RoyalnetServer.find_client">
|
||||
<code class="descname">find_client</code><span class="sig-paren">(</span><em>*</em>, <em>nid: str = None</em>, <em>link_type: str = None</em><span class="sig-paren">)</span> → List[royalnet.network.royalnetserver.ConnectedClient]<a class="headerlink" href="#royalnet.network.RoyalnetServer.find_client" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
@ -395,10 +372,17 @@
|
|||
<dl class="class">
|
||||
<dt id="royalnet.network.RoyalnetConfig">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.network.</code><code class="descname">RoyalnetConfig</code><span class="sig-paren">(</span><em>master_uri: str</em>, <em>master_secret: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetConfig" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="method">
|
||||
<dt id="royalnet.network.RoyalnetConfig.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>master_uri: str</em>, <em>master_secret: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetConfig.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="royalnet.network.Reply">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.network.</code><code class="descname">Reply</code><a class="headerlink" href="#royalnet.network.Reply" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A reply to a request sent through the Royalnet.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.network.Reply.raise_on_error">
|
||||
<code class="descname">raise_on_error</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#royalnet.network.Reply.raise_on_error" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>If the reply is an error, raise an error, otherwise, do nothing.</p>
|
||||
<p>:raises A <code class="xref py py-exc docutils literal notranslate"><span class="pre">RoyalnetError</span></code>, if the Reply is an error, otherwise, nothing.:</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -165,12 +165,6 @@
|
|||
<dt id="royalnet.utils.Call">
|
||||
<em class="property">class </em><code class="descclassname">royalnet.utils.</code><code class="descname">Call</code><span class="sig-paren">(</span><em>channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, **kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A command call. Still an abstract class, subbots should create a new call from this.</p>
|
||||
<dl class="method">
|
||||
<dt id="royalnet.utils.Call.__init__">
|
||||
<code class="descname">__init__</code><span class="sig-paren">(</span><em>channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, **kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.utils.Call.__init__" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="royalnet.utils.Call.alchemy">
|
||||
<code class="descname">alchemy</code><em class="property"> = NotImplemented</em><a class="headerlink" href="#royalnet.utils.Call.alchemy" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
|
@ -30,12 +30,13 @@ author = 'Stefano Pigozzi'
|
|||
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx.ext.intersphinx"]
|
||||
|
||||
intersphinx_mapping = {'python': ('https://docs.python.org/3.7', None),
|
||||
'discord': ('https://discordpy.readthedocs.io/en/latest/', None)}
|
||||
'discord': ('https://discordpy.readthedocs.io/en/latest/', None),
|
||||
"telegram": ("https://python-telegram-bot.readthedocs.io/en/stable/", None)}
|
||||
|
||||
|
||||
def skip(app, what, name, obj, would_skip, options):
|
||||
if name == "__init__":
|
||||
return False
|
||||
return not bool(obj.__doc__)
|
||||
return would_skip
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
from . import audio, bots, commands, database, network, utils
|
||||
|
||||
__all__ = ["audio", "bots", "commands", "database", "network", "utils"]
|
|
@ -6,7 +6,7 @@ from .generic import GenericBot
|
|||
from ..commands import NullCommand
|
||||
from ..utils import asyncify, Call, Command
|
||||
from ..error import UnregisteredError, NoneFoundError, TooManyFoundError, InvalidConfigError
|
||||
from ..network import Message, RoyalnetConfig
|
||||
from ..network import Message, Reply, RoyalnetConfig
|
||||
from ..database import DatabaseConfig
|
||||
from ..audio import PlayMode, Playlist, RoyalPCMAudio
|
||||
|
||||
|
@ -19,7 +19,7 @@ if not discord.opus.is_loaded():
|
|||
|
||||
|
||||
class DiscordConfig:
|
||||
"""The specific configuration to be used for :ref:`royalnet.database.DiscordBot`."""
|
||||
"""The specific configuration to be used for :py:class:`royalnet.bots.DiscordBot`."""
|
||||
def __init__(self, token: str):
|
||||
self.token = token
|
||||
|
||||
|
@ -30,6 +30,7 @@ class DiscordBot(GenericBot):
|
|||
interface_name = "discord"
|
||||
|
||||
def _init_voice(self):
|
||||
"""Initialize the variables needed for the connection to voice chat."""
|
||||
log.debug(f"Creating music_data dict")
|
||||
self.music_data: typing.Dict[discord.Guild, PlayMode] = {}
|
||||
|
||||
|
@ -64,7 +65,7 @@ class DiscordBot(GenericBot):
|
|||
async def net_request(call, message: Message, destination: str):
|
||||
if self.network is None:
|
||||
raise InvalidConfigError("Royalnet is not enabled on this bot")
|
||||
response: Message = await self.network.request(message, destination)
|
||||
response: Reply = await self.network.request(message, destination)
|
||||
response.raise_on_error()
|
||||
return response
|
||||
|
||||
|
@ -83,7 +84,7 @@ class DiscordBot(GenericBot):
|
|||
return DiscordCall
|
||||
|
||||
def _bot_factory(self) -> typing.Type[discord.Client]:
|
||||
"""Create a new DiscordClient class based on this DiscordBot."""
|
||||
"""Create a custom DiscordClient class inheriting from :py:class:`discord.Client`."""
|
||||
log.debug(f"Creating DiscordClient")
|
||||
|
||||
# noinspection PyMethodParameters
|
||||
|
@ -129,8 +130,11 @@ class DiscordBot(GenericBot):
|
|||
await cli.change_presence(status=discord.Status.online)
|
||||
|
||||
def find_guild_by_name(cli, name: str) -> discord.Guild:
|
||||
"""Find the Guild with the specified name. Case-insensitive.
|
||||
Will raise a NoneFoundError if no channels are found, or a TooManyFoundError if more than one is found."""
|
||||
"""Find the :py:class:`discord.Guild` with the specified name. Case-insensitive.
|
||||
|
||||
Raises:
|
||||
:py:exc:`NoneFoundError` if no channels are found.
|
||||
:py:exc:`TooManyFoundError` if more than one is found."""
|
||||
all_guilds: typing.List[discord.Guild] = cli.guilds
|
||||
matching_channels: typing.List[discord.Guild] = []
|
||||
for guild in all_guilds:
|
||||
|
@ -145,9 +149,9 @@ class DiscordBot(GenericBot):
|
|||
def find_channel_by_name(cli,
|
||||
name: str,
|
||||
guild: typing.Optional[discord.Guild] = None) -> discord.abc.GuildChannel:
|
||||
"""Find the TextChannel, VoiceChannel or CategoryChannel with the specified name. Case-insensitive.
|
||||
Guild is optional, but the method will raise a TooManyFoundError if none is specified and there is more than one channel with the same name.
|
||||
Will also raise a NoneFoundError if no channels are found."""
|
||||
"""Find the :py:class:`TextChannel`, :py:class:`VoiceChannel` or :py:class:`CategoryChannel` with the specified name. Case-insensitive.
|
||||
Guild is optional, but the method will raise a :py:exc:`TooManyFoundError` if none is specified and there is more than one channel with the same name.
|
||||
Will also raise a :py:exc:`NoneFoundError` if no channels are found."""
|
||||
if guild is not None:
|
||||
all_channels = guild.channels
|
||||
else:
|
||||
|
@ -167,10 +171,11 @@ class DiscordBot(GenericBot):
|
|||
return matching_channels[0]
|
||||
|
||||
def find_voice_client_by_guild(cli, guild: discord.Guild):
|
||||
"""Find the VoiceClient belonging to a specific Guild.
|
||||
Raises a NoneFoundError if the Guild currently has no VoiceClient."""
|
||||
"""Find the :py:class:`discord.VoiceClient` belonging to a specific :py:class:`discord.Guild`.
|
||||
|
||||
Raises:
|
||||
:py:exc:`NoneFoundError` if the :py:class:`discord.Guild` currently has no :py:class:`discord.VoiceClient`."""
|
||||
for voice_client in cli.voice_clients:
|
||||
voice_client: discord.VoiceClient
|
||||
if voice_client.guild == guild:
|
||||
return voice_client
|
||||
raise NoneFoundError("No voice clients found")
|
||||
|
@ -178,7 +183,7 @@ class DiscordBot(GenericBot):
|
|||
return DiscordClient
|
||||
|
||||
def _init_client(self):
|
||||
"""Create a bot instance."""
|
||||
"""Create an instance of the DiscordClient class created in :py:func:`royalnet.bots.DiscordBot._bot_factory`."""
|
||||
log.debug(f"Creating DiscordClient instance")
|
||||
self._Client = self._bot_factory()
|
||||
self.client = self._Client()
|
||||
|
@ -202,13 +207,14 @@ class DiscordBot(GenericBot):
|
|||
self._init_voice()
|
||||
|
||||
async def run(self):
|
||||
"""Login to Discord, then run the bot."""
|
||||
log.debug(f"Logging in to Discord")
|
||||
await self.client.login(self._discord_config.token)
|
||||
log.debug(f"Connecting to Discord")
|
||||
await self.client.connect()
|
||||
# TODO: how to stop?
|
||||
|
||||
async def add_to_music_data(self, audio_sources: typing.List[discord.AudioSource], guild: discord.Guild):
|
||||
async def add_to_music_data(self, audio_sources: typing.List[RoyalPCMAudio], guild: discord.Guild):
|
||||
"""Add a file to the corresponding music_data object."""
|
||||
guild_music_data = self.music_data[guild]
|
||||
for audio_source in audio_sources:
|
||||
|
@ -222,7 +228,7 @@ class DiscordBot(GenericBot):
|
|||
guild_music_data = self.music_data[guild]
|
||||
voice_client = self.client.find_voice_client_by_guild(guild)
|
||||
next_source: RoyalPCMAudio = await guild_music_data.next()
|
||||
await self.update_activity_with_source_title(next_source)
|
||||
await self.update_activity_with_source_title()
|
||||
if next_source is None:
|
||||
log.debug(f"Ending playback chain")
|
||||
return
|
||||
|
@ -235,18 +241,25 @@ class DiscordBot(GenericBot):
|
|||
log.debug(f"Starting playback of {next_source}")
|
||||
voice_client.play(next_source, after=advance)
|
||||
|
||||
async def update_activity_with_source_title(self, rpa: typing.Optional[RoyalPCMAudio] = None):
|
||||
if len(self.music_data) > 1:
|
||||
async def update_activity_with_source_title(self):
|
||||
"""Change the bot's presence (using :py:func:`discord.Client.change_presence`) to match the current listening status.
|
||||
|
||||
If multiple guilds are using the bot, the bot will always have an empty presence."""
|
||||
if len(self.music_data) != 1:
|
||||
# Multiple guilds are using the bot, do not display anything
|
||||
log.debug(f"Updating current Activity: setting to None, as multiple guilds are using the bot")
|
||||
await self.client.change_presence(status=discord.Status.online)
|
||||
return
|
||||
if rpa is None:
|
||||
# FIXME: PyCharm faulty inspection?
|
||||
# noinspection PyUnresolvedReferences
|
||||
play_mode: PlayMode = list(self.music_data.items())[0][1]
|
||||
now_playing = play_mode.now_playing
|
||||
if now_playing is None:
|
||||
# No songs are playing now
|
||||
log.debug(f"Updating current Activity: setting to None, as nothing is currently being played")
|
||||
await self.client.change_presence(status=discord.Status.online)
|
||||
return
|
||||
log.debug(f"Updating current Activity: listening to {rpa.rpf.info.title}")
|
||||
await self.client.change_presence(activity=discord.Activity(name=rpa.rpf.info.title,
|
||||
log.debug(f"Updating current Activity: listening to {now_playing.rpf.info.title}")
|
||||
await self.client.change_presence(activity=discord.Activity(name=now_playing.rpf.info.title,
|
||||
type=discord.ActivityType.listening),
|
||||
status=discord.Status.online)
|
||||
|
|
|
@ -19,8 +19,8 @@ class GenericBot:
|
|||
command_prefix: str,
|
||||
commands: typing.List[typing.Type[Command]],
|
||||
missing_command: typing.Type[Command],
|
||||
error_command: typing.Type[Command]):
|
||||
"""Generate the commands dictionary required to handle incoming messages, and the network_handlers dictionary required to handle incoming requests."""
|
||||
error_command: typing.Type[Command]) -> None:
|
||||
"""Generate the ``commands`` dictionary required to handle incoming messages, and the ``network_handlers`` dictionary required to handle incoming requests."""
|
||||
log.debug(f"Now generating commands")
|
||||
self.commands: typing.Dict[str, typing.Type[Command]] = {}
|
||||
self.network_handlers: typing.Dict[typing.Type[Message], typing.Type[NetworkHandler]] = {}
|
||||
|
@ -33,18 +33,24 @@ class GenericBot:
|
|||
log.debug(f"Successfully generated commands")
|
||||
|
||||
def _call_factory(self) -> typing.Type[Call]:
|
||||
"""Create the Call class, representing a Call command. It should inherit from the utils.Call class."""
|
||||
"""Create the TelegramCall class, representing a command call. It should inherit from :py:class:`royalnet.utils.Call`.
|
||||
|
||||
Returns:
|
||||
The created TelegramCall class."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def _init_royalnet(self, royalnet_config: RoyalnetConfig):
|
||||
"""Create a RoyalnetLink, and run it as a task."""
|
||||
"""Create a :py:class:`royalnet.network.RoyalnetLink`, and run it as a :py:class:`asyncio.Task`."""
|
||||
self.network: RoyalnetLink = RoyalnetLink(royalnet_config.master_uri, royalnet_config.master_secret, self.interface_name,
|
||||
self._network_handler)
|
||||
log.debug(f"Running RoyalnetLink {self.network}")
|
||||
loop.create_task(self.network.run())
|
||||
|
||||
async def _network_handler(self, message: Message) -> Message:
|
||||
"""Handle a single Message received from the RoyalnetLink"""
|
||||
"""Handle a single :py:class:`royalnet.network.Message` received from the :py:class:`royalnet.network.RoyalnetLink`.
|
||||
|
||||
Returns:
|
||||
Another message, to be sent as :py:class:`royalnet.network.Reply`."""
|
||||
log.debug(f"Received {message} from the RoyalnetLink")
|
||||
try:
|
||||
network_handler = self.network_handlers[message.__class__]
|
||||
|
@ -61,7 +67,7 @@ class GenericBot:
|
|||
return RequestError(exc=exc)
|
||||
|
||||
def _init_database(self, commands: typing.List[typing.Type[Command]], database_config: DatabaseConfig):
|
||||
"""Connect to the database, and create the missing tables required by the selected commands."""
|
||||
"""Create an :py:class:`royalnet.database.Alchemy` with the tables required by the commands. Then, find the chain that links the ``master_table`` to the ``identity_table``."""
|
||||
log.debug(f"Initializing database")
|
||||
required_tables = set()
|
||||
for command in commands:
|
||||
|
@ -99,7 +105,11 @@ class GenericBot:
|
|||
self._init_royalnet(royalnet_config=royalnet_config)
|
||||
|
||||
async def call(self, command_name: str, channel, parameters: typing.List[str] = None, **kwargs):
|
||||
"""Call a command by its string, or missing_command if it doesn't exists, or error_command if an exception is raised during the execution."""
|
||||
"""Call the command with the specified name.
|
||||
|
||||
If it doesn't exist, call ``self.missing_command``.
|
||||
|
||||
If an exception is raised during the execution of the command, call ``self.error_command``."""
|
||||
log.debug(f"Trying to call {command_name}")
|
||||
if parameters is None:
|
||||
parameters = []
|
||||
|
|
|
@ -14,7 +14,7 @@ log = _logging.getLogger(__name__)
|
|||
|
||||
|
||||
class TelegramConfig:
|
||||
"""The specific configuration to be used for :ref:`royalnet.database.TelegramBot`."""
|
||||
"""The specific configuration to be used for :py:class:`royalnet.database.TelegramBot`."""
|
||||
def __init__(self, token: str):
|
||||
self.token: str = token
|
||||
|
||||
|
@ -24,6 +24,7 @@ class TelegramBot(GenericBot):
|
|||
interface_name = "telegram"
|
||||
|
||||
def _init_client(self):
|
||||
"""Create the :py:class:`telegram.Bot`, and set the starting offset."""
|
||||
self.client = telegram.Bot(self._telegram_config.token)
|
||||
self._offset: int = -100
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from .messages import Message, ServerErrorMessage, InvalidSecretEM, InvalidDestinationEM, InvalidPackageEM, RequestSuccessful, RequestError
|
||||
from .messages import Message, ServerErrorMessage, InvalidSecretEM, InvalidDestinationEM, InvalidPackageEM, RequestSuccessful, RequestError, Reply
|
||||
from .packages import Package
|
||||
from .royalnetlink import RoyalnetLink, NetworkError, NotConnectedError, NotIdentifiedError
|
||||
from .royalnetserver import RoyalnetServer
|
||||
|
@ -17,4 +17,5 @@ __all__ = ["Message",
|
|||
"RoyalnetServer",
|
||||
"RequestSuccessful",
|
||||
"RequestError",
|
||||
"RoyalnetConfig"]
|
||||
"RoyalnetConfig",
|
||||
"Reply"]
|
||||
|
|
|
@ -13,7 +13,7 @@ log = _logging.getLogger(__name__)
|
|||
|
||||
|
||||
class NotConnectedError(Exception):
|
||||
pass
|
||||
"""The :py:class:`royalnet.network.RoyalnetLink` is not connected to a :py:class:`royalnet.network.RoyalnetServer`."""
|
||||
|
||||
|
||||
class NotIdentifiedError(Exception):
|
||||
|
@ -67,7 +67,7 @@ class RoyalnetLink:
|
|||
self.secret: str = secret
|
||||
self.websocket: typing.Optional[websockets.WebSocketClientProtocol] = None
|
||||
self.request_handler = request_handler
|
||||
self._pending_requests: typing.Dict[typing.Optional[Message]] = {}
|
||||
self._pending_requests: typing.Dict[str, typing.Optional[Message]] = {}
|
||||
self._loop: asyncio.AbstractEventLoop = loop
|
||||
self._connect_event: asyncio.Event = asyncio.Event(loop=self._loop)
|
||||
self.identify_event: asyncio.Event = asyncio.Event(loop=self._loop)
|
||||
|
|
Loading…
Add table
Reference in a new issue