<dd><p>A bot that connects to <aclass="reference external"href="https://telegram.org/">Telegram</a>.</p>
<dlclass="method">
<dtid="royalnet.bots.TelegramBot._call_factory">
<codeclass="descname">_call_factory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Type[royalnet.utils.call.Call]<aclass="headerlink"href="#royalnet.bots.TelegramBot._call_factory"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the TelegramCall class, representing a command call. It should inherit from <aclass="reference internal"href="utils.html#royalnet.utils.Call"title="royalnet.utils.Call"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.utils.Call</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The created TelegramCall class.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.TelegramBot._handle_update">
<codeclass="descname">_handle_update</code><spanclass="sig-paren">(</span><em>update: telegram.update.Update</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.TelegramBot._handle_update"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.bots.TelegramBot._init_client">
<codeclass="descname">_init_client</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.TelegramBot._init_client"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the <aclass="reference external"href="https://python-telegram-bot.readthedocs.io/en/stable/telegram.bot.html#telegram.Bot"title="(in Python Telegram Bot v11.1)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">telegram.Bot</span></code></a>, and set the starting offset.</p>
<codeclass="descname">botfather_command_string</code><aclass="headerlink"href="#royalnet.bots.TelegramBot.botfather_command_string"title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a string to be pasted in the “Edit Commands” BotFather prompt.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.bots.TelegramBot.interface_name">
<codeclass="descname">interface_name</code><emclass="property"> = 'telegram'</em><aclass="headerlink"href="#royalnet.bots.TelegramBot.interface_name"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.bots.TelegramBot.run">
<codeclass="descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.TelegramBot.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></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.bots.TelegramConfig">
<emclass="property">class </em><codeclass="descclassname">royalnet.bots.</code><codeclass="descname">TelegramConfig</code><spanclass="sig-paren">(</span><em>token: str</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.TelegramConfig"title="Permalink to this definition">¶</a></dt>
<dd><p>The specific configuration to be used for <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.database.TelegramBot</span></code>.</p>
<dd><p>A bot that connects to <aclass="reference external"href="https://discordapp.com/">Discord</a>.</p>
<dlclass="method">
<dtid="royalnet.bots.DiscordBot._bot_factory">
<codeclass="descname">_bot_factory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Type[discord.client.Client]<aclass="headerlink"href="#royalnet.bots.DiscordBot._bot_factory"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a custom DiscordClient class inheriting from <aclass="reference external"href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Client"title="(in discord.py v1.3.0a)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">discord.Client</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.DiscordBot._call_factory">
<codeclass="descname">_call_factory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Type[royalnet.utils.call.Call]<aclass="headerlink"href="#royalnet.bots.DiscordBot._call_factory"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the TelegramCall class, representing a command call. It should inherit from <aclass="reference internal"href="utils.html#royalnet.utils.Call"title="royalnet.utils.Call"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.utils.Call</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The created TelegramCall class.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.DiscordBot._init_client">
<codeclass="descname">_init_client</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.DiscordBot._init_client"title="Permalink to this definition">¶</a></dt>
<dd><p>Create an instance of the DiscordClient class created in <aclass="reference internal"href="#royalnet.bots.DiscordBot._bot_factory"title="royalnet.bots.DiscordBot._bot_factory"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.bots.DiscordBot._bot_factory()</span></code></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.DiscordBot._init_voice">
<codeclass="descname">_init_voice</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.DiscordBot._init_voice"title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize the variables needed for the connection to voice chat.</p>
<codeclass="descname">add_to_music_data</code><spanclass="sig-paren">(</span><em>dfiles: List[royalnet.audio.ytdldiscord.YtdlDiscord], guild: discord.guild.Guild</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.DiscordBot.add_to_music_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a list of <aclass="reference internal"href="audio.html#royalnet.audio.YtdlDiscord"title="royalnet.audio.YtdlDiscord"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.audio.YtdlDiscord</span></code></a> to the corresponding music_data object.</p>
<codeclass="descname">advance_music_data</code><spanclass="sig-paren">(</span><em>guild: discord.guild.Guild</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.DiscordBot.advance_music_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Try to play the next song, while it exists. Otherwise, just return.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.bots.DiscordBot.interface_name">
<codeclass="descname">interface_name</code><emclass="property"> = 'discord'</em><aclass="headerlink"href="#royalnet.bots.DiscordBot.interface_name"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.bots.DiscordBot.run">
<codeclass="descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.DiscordBot.run"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">update_activity_with_source_title</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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 <codeclass="xref py py-func docutils literal notranslate"><spanclass="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>
<dlclass="class">
<dtid="royalnet.bots.DiscordConfig">
<emclass="property">class </em><codeclass="descclassname">royalnet.bots.</code><codeclass="descname">DiscordConfig</code><spanclass="sig-paren">(</span><em>token: str</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.DiscordConfig"title="Permalink to this definition">¶</a></dt>
<dd><p>The specific configuration to be used for <aclass="reference internal"href="#royalnet.bots.DiscordBot"title="royalnet.bots.DiscordBot"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.bots.DiscordBot</span></code></a>.</p>
<dd><p>A generic bot class, to be used as base for the other more specific classes, such as <spanclass="xref std std-ref">royalnet.bots.TelegramBot</span> and <spanclass="xref std std-ref">royalnet.bots.DiscordBot</span>.</p>
<dlclass="method">
<dtid="royalnet.bots.GenericBot._call_factory">
<codeclass="descname">_call_factory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ Type[royalnet.utils.call.Call]<aclass="headerlink"href="#royalnet.bots.GenericBot._call_factory"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the TelegramCall class, representing a command call. It should inherit from <aclass="reference internal"href="utils.html#royalnet.utils.Call"title="royalnet.utils.Call"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.utils.Call</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The created TelegramCall class.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.GenericBot._init_commands">
<codeclass="descname">_init_commands</code><spanclass="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><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.bots.GenericBot._init_commands"title="Permalink to this definition">¶</a></dt>
<dd><p>Generate the <codeclass="docutils literal notranslate"><spanclass="pre">commands</span></code> dictionary required to handle incoming messages, and the <codeclass="docutils literal notranslate"><spanclass="pre">network_handlers</span></code> dictionary required to handle incoming requests.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.GenericBot._init_database">
<codeclass="descname">_init_database</code><spanclass="sig-paren">(</span><em>commands: List[Type[royalnet.utils.command.Command]], database_config: royalnet.database.databaseconfig.DatabaseConfig</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.GenericBot._init_database"title="Permalink to this definition">¶</a></dt>
<dd><p>Create an <aclass="reference internal"href="database.html#royalnet.database.Alchemy"title="royalnet.database.Alchemy"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.database.Alchemy</span></code></a> with the tables required by the commands. Then, find the chain that links the <codeclass="docutils literal notranslate"><spanclass="pre">master_table</span></code> to the <codeclass="docutils literal notranslate"><spanclass="pre">identity_table</span></code>.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.GenericBot._init_royalnet">
<codeclass="descname">_init_royalnet</code><spanclass="sig-paren">(</span><em>royalnet_config: royalnet.network.royalnetconfig.RoyalnetConfig</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.GenericBot._init_royalnet"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a <aclass="reference internal"href="network.html#royalnet.network.RoyalnetLink"title="royalnet.network.RoyalnetLink"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.network.RoyalnetLink</span></code></a>, and run it as a <aclass="reference external"href="https://docs.python.org/3.7/library/asyncio-task.html#asyncio.Task"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">asyncio.Task</span></code></a>.</p>
<codeclass="descname">_network_handler</code><spanclass="sig-paren">(</span><em>request_dict: dict</em><spanclass="sig-paren">)</span>→ dict<aclass="headerlink"href="#royalnet.bots.GenericBot._network_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Handle a single <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#dict"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">dict</span></code></a> received from the <aclass="reference internal"href="network.html#royalnet.network.RoyalnetLink"title="royalnet.network.RoyalnetLink"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.network.RoyalnetLink</span></code></a>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>Another <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#dict"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">dict</span></code></a>, formatted as a <aclass="reference internal"href="network.html#royalnet.network.Response"title="royalnet.network.Response"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.network.Response</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.bots.GenericBot.call">
<codeclass="descname">call</code><spanclass="sig-paren">(</span><em>command_name: str</em>, <em>channel</em>, <em>parameters: List[str] = None</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.GenericBot.call"title="Permalink to this definition">¶</a></dt>
<dd><p>Call the command with the specified name.</p>
<p>If it doesn’t exist, call <codeclass="docutils literal notranslate"><spanclass="pre">self.missing_command</span></code>.</p>
<p>If an exception is raised during the execution of the command, call <codeclass="docutils literal notranslate"><spanclass="pre">self.error_command</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.bots.GenericBot.interface_name">
<codeclass="descname">interface_name</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.bots.GenericBot.interface_name"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.bots.GenericBot.run">
<codeclass="descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.bots.GenericBot.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>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.