<spanclass="target"id="module-royalnet.utils"></span><p>Miscellaneous useful functions and classes.</p>
<dlclass="function">
<dtid="royalnet.utils.asyncify">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">asyncify</code><spanclass="sig-paren">(</span><em>function: Callable</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.asyncify"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a function into a coroutine.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>The coroutine cannot be cancelled, and any attempts to do so will result in unexpected outputs.</p>
</div>
</dd></dl>
<dlclass="class">
<dtid="royalnet.utils.Call">
<emclass="property">class </em><codeclass="descclassname">royalnet.utils.</code><codeclass="descname">Call</code><spanclass="sig-paren">(</span><em>channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, loop: asyncio.events.AbstractEventLoop = None, **kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Call"title="Permalink to this definition">¶</a></dt>
<dd><p>A command call. An abstract class, sub-bots should create a new call class from this.</p>
<dlclass="attribute">
<dtid="royalnet.utils.Call.interface_name">
<codeclass="descname">interface_name</code><aclass="headerlink"href="#royalnet.utils.Call.interface_name"title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the interface that is calling the command. For example, <codeclass="docutils literal notranslate"><spanclass="pre">telegram</span></code>, or <codeclass="docutils literal notranslate"><spanclass="pre">discord</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.utils.Call.interface_obj">
<codeclass="descname">interface_obj</code><aclass="headerlink"href="#royalnet.utils.Call.interface_obj"title="Permalink to this definition">¶</a></dt>
<dd><p>The main object of the interface that is calling the command. For example, the <aclass="reference internal"href="bots.html#royalnet.bots.TelegramBot"title="royalnet.bots.TelegramBot"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.bots.TelegramBot</span></code></a> object.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.utils.Call.interface_prefix">
<codeclass="descname">interface_prefix</code><aclass="headerlink"href="#royalnet.utils.Call.interface_prefix"title="Permalink to this definition">¶</a></dt>
<dd><p>The command prefix used by the interface. For example, <codeclass="docutils literal notranslate"><spanclass="pre">/</span></code>, or <codeclass="docutils literal notranslate"><spanclass="pre">!</span></code>.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.utils.Call.alchemy">
<codeclass="descname">alchemy</code><aclass="headerlink"href="#royalnet.utils.Call.alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>The <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> object associated to this interface. May be None if the interface is not connected to any database.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.Call.__init__">
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><em>channel, command: Type[royalnet.utils.command.Command], command_args: List[str] = None, loop: asyncio.events.AbstractEventLoop = None, **kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Call.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the call.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>channel</strong>– The channel object this call was sent in.</p></li>
<li><p><strong>command</strong>– The command to be called.</p></li>
<li><p><strong>command_args</strong>– The arguments to be passed to the command</p></li>
<li><p><strong>kwargs</strong>– Additional optional keyword arguments that may be passed to the command, possibly specific to the bot.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.Call._session_init">
<codeclass="descname">_session_init</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Call._session_init"title="Permalink to this definition">¶</a></dt>
<dd><p>If the command requires database access, create a <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> session for this call, otherwise, do nothing.</p>
<codeclass="descname">get_author</code><spanclass="sig-paren">(</span><em>error_if_none=False</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Call.get_author"title="Permalink to this definition">¶</a></dt>
<dd><p>Try to find the universal identifier of the user that sent the message.
That probably means, the database row identifying the user.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>error_if_none</strong>– Raise a <aclass="reference internal"href="error.html#royalnet.error.UnregisteredError"title="royalnet.error.UnregisteredError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">royalnet.error.UnregisteredError</span></code></a> if this is True and the call has no author.</p>
<codeclass="descname">net_request</code><spanclass="sig-paren">(</span><em>message</em>, <em>destination: str</em><spanclass="sig-paren">)</span>→ dict<aclass="headerlink"href="#royalnet.utils.Call.net_request"title="Permalink to this definition">¶</a></dt>
<dd><p>Send data through 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 wait for a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.network.Reply</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>message</strong>– The data to be sent. Must be <aclass="reference external"href="https://docs.python.org/3.7/library/pickle.html#module-pickle"title="(in Python v3.7)"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">pickle</span></code></a>-able.</p></li>
<li><p><strong>destination</strong>– The destination of the request, either in UUID format or node name.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.Call.reply">
<codeclass="descname">reply</code><spanclass="sig-paren">(</span><em>text: str</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.utils.Call.reply"title="Permalink to this definition">¶</a></dt>
<dd><p>Send a text message to the channel where the call was made.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>text</strong>– The text to be sent, possibly formatted in the weird undescribed markup that I’m using.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.Call.run">
<codeclass="descname">run</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Call.run"title="Permalink to this definition">¶</a></dt>
<dd><p>Execute the called command, and return the command result.</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.Call.session_end">
<codeclass="descname">session_end</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Call.session_end"title="Permalink to this definition">¶</a></dt>
<dd><p>Close the previously created <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> session for this call (if it was created).</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.utils.Command">
<emclass="property">class </em><codeclass="descclassname">royalnet.utils.</code><codeclass="descname">Command</code><aclass="headerlink"href="#royalnet.utils.Command"title="Permalink to this definition">¶</a></dt>
<dd><p>The base class from which all commands should inherit.</p>
<dlclass="attribute">
<dtid="royalnet.utils.Command.command_name">
<codeclass="descname">command_name</code><aclass="headerlink"href="#royalnet.utils.Command.command_name"title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the command. To have <codeclass="docutils literal notranslate"><spanclass="pre">/example</span></code> on Telegram, the name should be <codeclass="docutils literal notranslate"><spanclass="pre">example</span></code>.</p>
<codeclass="descname">command_description</code><aclass="headerlink"href="#royalnet.utils.Command.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></dl>
<dlclass="attribute">
<dtid="royalnet.utils.Command.command_syntax">
<codeclass="descname">command_syntax</code><aclass="headerlink"href="#royalnet.utils.Command.command_syntax"title="Permalink to this definition">¶</a></dt>
<dd><p>The syntax of the command, to be displayed when a <aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">royalnet.error.InvalidInputError</span></code></a> is raised, in the format <codeclass="docutils literal notranslate"><spanclass="pre">(required_arg)</span><spanclass="pre">[optional_arg]</span></code>.</p>
<codeclass="descname">require_alchemy_tables</code><aclass="headerlink"href="#royalnet.utils.Command.require_alchemy_tables"title="Permalink to this definition">¶</a></dt>
<dd><p>A set of <aclass="reference internal"href="database.html#module-royalnet.database"title="royalnet.database"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">royalnet.database</span></code></a> tables, that must exist for this command to work.</p>
</dd></dl>
<dlclass="attribute">
<dtid="royalnet.utils.Command.network_handlers">
<codeclass="descname">network_handlers</code><aclass="headerlink"href="#royalnet.utils.Command.network_handlers"title="Permalink to this definition">¶</a></dt>
<dd><p>A list of :py:class:<ahref="#id1"><spanclass="problematic"id="id2">`</span></a>royalnet.utils.NetworkHandler`s that must exist for this command to work.</p>
<emclass="property">classmethod </em><codeclass="descname">common</code><spanclass="sig-paren">(</span><em>call: Call</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Command.common"title="Permalink to this definition">¶</a></dt>
<emclass="property">classmethod </em><codeclass="descname">network_handler_dict</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.Command.network_handler_dict"title="Permalink to this definition">¶</a></dt>
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">safeformat</code><spanclass="sig-paren">(</span><em>string: str</em>, <em>**words</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.safeformat"title="Permalink to this definition">¶</a></dt>
<dd><p><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">str.format()</span></code> something, but ignore missing keys instead of raising an error.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>string</strong>– The base string to be formatted.</p></li>
<li><p><strong>words</strong>– The words to format the string with.</p></li>
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">cdj</code><spanclass="sig-paren">(</span><em>class_: Any</em><spanclass="sig-paren">)</span>→ dict<aclass="headerlink"href="#royalnet.utils.cdj"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dict of the class attributes without the <codeclass="docutils literal notranslate"><spanclass="pre">__module__</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">__dict__</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">__weakref__</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">__doc__</span></code> keys, to be used while generating dynamically SQLAlchemy declarative table classes.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>class</strong>– The object that you want to dict-ify.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The class dict.</p>
</dd>
</dl>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>You can’t dict-ify classes with <codeclass="docutils literal notranslate"><spanclass="pre">__slots__</span></code>!</p>
</div>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.sleep_until">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">sleep_until</code><spanclass="sig-paren">(</span><em>dt: datetime.datetime</em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#royalnet.utils.sleep_until"title="Permalink to this definition">¶</a></dt>
<dd><p>Block the call until the specified datetime.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Accurate only to seconds.</p>
</div>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.plusformat">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">plusformat</code><spanclass="sig-paren">(</span><em>i: int</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.plusformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert an <aclass="reference external"href="https://docs.python.org/3.7/library/functions.html#int"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">int</span></code></a> to a <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#str"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a>, prepending a <codeclass="docutils literal notranslate"><spanclass="pre">+</span></code> if it’s greater than 0.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>i</strong>– the <aclass="reference external"href="https://docs.python.org/3.7/library/functions.html#int"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">int</span></code></a> to convert.</p>
<emclass="property">class </em><codeclass="descclassname">royalnet.utils.</code><codeclass="descname">CommandArgs</code><aclass="headerlink"href="#royalnet.utils.CommandArgs"title="Permalink to this definition">¶</a></dt>
<dd><p>An interface to access the arguments of a command with ease.</p>
<dlclass="method">
<dtid="royalnet.utils.CommandArgs.__getitem__">
<codeclass="descname">__getitem__</code><spanclass="sig-paren">(</span><em>item</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.CommandArgs.__getitem__"title="Permalink to this definition">¶</a></dt>
<dd><p>Arguments can be accessed with an array notation, such as <codeclass="docutils literal notranslate"><spanclass="pre">args[0]</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><strong>royalnet.error.InvalidInputError</strong></a>– if the requested argument does not exist.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.CommandArgs.joined">
<codeclass="descname">joined</code><spanclass="sig-paren">(</span><em>*</em>, <em>require_at_least=0</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.CommandArgs.joined"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the arguments as a space-joined string.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>require_at_least</strong>– the minimum amount of arguments required, will raise <aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><codeclass="xref py py-exc docutils literal notranslate"><spanclass="pre">royalnet.error.InvalidInputError</span></code></a> if the requirement is not fullfilled.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><strong>royalnet.error.InvalidInputError</strong></a>– if there are less than <codeclass="docutils literal notranslate"><spanclass="pre">require_at_least</span></code> arguments.</p>
<codeclass="descname">match</code><spanclass="sig-paren">(</span><em>pattern: Pattern[AnyStr]</em><spanclass="sig-paren">)</span>→ Sequence[AnyStr]<aclass="headerlink"href="#royalnet.utils.CommandArgs.match"title="Permalink to this definition">¶</a></dt>
<dd><p>Match the <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">royalnet.utils.commandargs.joined()</span></code> to a regex pattern.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>pattern</strong>– The regex pattern to be passed to <aclass="reference external"href="https://docs.python.org/3.7/library/re.html#re.match"title="(in Python v3.7)"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">re.match()</span></code></a>.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><aclass="reference internal"href="error.html#royalnet.error.InvalidInputError"title="royalnet.error.InvalidInputError"><strong>royalnet.error.InvalidInputError</strong></a>– if the pattern doesn’t match.</p>
</dd>
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The matched groups, as returned by <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">re.Match.groups()</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.utils.CommandArgs.optional">
<codeclass="descname">optional</code><spanclass="sig-paren">(</span><em>index: int</em>, <em>default=None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.utils.CommandArgs.optional"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the argument at a specific index, but don’t raise an error if nothing is found, instead returning the <codeclass="docutils literal notranslate"><spanclass="pre">default</span></code> value.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>index</strong>– The index of the argument you want to retrieve.</p></li>
<li><p><strong>default</strong>– The value returned if the argument is missing.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Either the argument or the <codeclass="docutils literal notranslate"><spanclass="pre">default</span></code> value, defaulting to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.utils.NetworkHandler">
<emclass="property">class </em><codeclass="descclassname">royalnet.utils.</code><codeclass="descname">NetworkHandler</code><aclass="headerlink"href="#royalnet.utils.NetworkHandler"title="Permalink to this definition">¶</a></dt>
<dd><p>The NetworkHandler functions are called when a specific Message type is received.</p>
<codeclass="descname">message_type</code><emclass="property"> = NotImplemented</em><aclass="headerlink"href="#royalnet.utils.NetworkHandler.message_type"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.andformat">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">andformat</code><spanclass="sig-paren">(</span><em>l: List[str], middle=', ', final=' and '</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.andformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#list"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">list</span></code></a> to a <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#str"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> by adding <codeclass="docutils literal notranslate"><spanclass="pre">final</span></code> between the last two elements and <codeclass="docutils literal notranslate"><spanclass="pre">middle</span></code> between the others.</p>
<li><p><strong>middle</strong>– the <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#str"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> to be added between the middle elements.</p></li>
<li><p><strong>final</strong>– the <aclass="reference external"href="https://docs.python.org/3.7/library/stdtypes.html#str"title="(in Python v3.7)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code></a> to be added between the last two elements.</p></li>
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">fileformat</code><spanclass="sig-paren">(</span><em>string: str</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.fileformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Ensure a string can be used as a filename by replacing all non-word characters with underscores.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>string</strong>– the input string.</p>
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">ytdldateformat</code><spanclass="sig-paren">(</span><em>string: Optional[str], separator: str = '-'</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.ytdldateformat"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert the weird date string returned by <codeclass="docutils literal notranslate"><spanclass="pre">youtube-dl</span></code> into the <codeclass="docutils literal notranslate"><spanclass="pre">YYYY-MM-DD</span></code> format.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>string</strong>– the input string, in the <codeclass="docutils literal notranslate"><spanclass="pre">YYYYMMDD</span></code> format.</p></li>
<li><p><strong>separator</strong>– the string to add between the years, the months and the days. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-</span></code>.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The resulting string, in the format <codeclass="docutils literal notranslate"><spanclass="pre">YYYY-MM-DD</span></code> format.</p>
</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.numberemojiformat">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">numberemojiformat</code><spanclass="sig-paren">(</span><em>l: List[str]</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.numberemojiformat"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="royalnet.utils.telegram_escape">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">telegram_escape</code><spanclass="sig-paren">(</span><em>string: str</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.telegram_escape"title="Permalink to this definition">¶</a></dt>
<dd><p>Escape a string to be sent through Telegram, and format it using RoyalCode.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Currently escapes everything, even items in code blocks.</p>
</div>
</dd></dl>
<dlclass="function">
<dtid="royalnet.utils.discord_escape">
<codeclass="descclassname">royalnet.utils.</code><codeclass="descname">discord_escape</code><spanclass="sig-paren">(</span><em>string: str</em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.utils.discord_escape"title="Permalink to this definition">¶</a></dt>
<dd><p>Escape a string to be sent through Discord, and format it using RoyalCode.</p>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>Currently escapes everything, even items in code blocks.</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>.