diff options
Diffstat (limited to 'v8.0.0/output')
-rw-r--r-- | v8.0.0/output/botcore.async_stats.html | 427 | ||||
-rw-r--r-- | v8.0.0/output/botcore.exts.html | 392 | ||||
-rw-r--r-- | v8.0.0/output/botcore.html | 623 | ||||
-rw-r--r-- | v8.0.0/output/botcore.site_api.html | 563 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.caching.html | 440 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.channel.html | 440 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.commands.html | 414 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.html | 462 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.interactions.html | 473 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.logging.html | 438 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.members.html | 426 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.regex.html | 422 | ||||
-rw-r--r-- | v8.0.0/output/botcore.utils.scheduling.html | 547 |
13 files changed, 6067 insertions, 0 deletions
diff --git a/v8.0.0/output/botcore.async_stats.html b/v8.0.0/output/botcore.async_stats.html new file mode 100644 index 00000000..8630137b --- /dev/null +++ b/v8.0.0/output/botcore.async_stats.html @@ -0,0 +1,427 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="site_api" href="botcore.site_api.html" /><link rel="prev" title="scheduling" href="botcore.utils.scheduling.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>async_stats - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2 current current-page"><a class="current reference internal" href="#">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.async_stats.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.async_stats.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.async_stats.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.async_stats.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.async_stats.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.async_stats.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.async_stats.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.async_stats.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.async_stats.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.async_stats.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.async_stats.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.async_stats.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.async_stats.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.async_stats.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.async_stats.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.async_stats.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.async_stats.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.async_stats"> +<span id="async-stats"></span><h1>async_stats<a class="headerlink" href="#module-botcore.async_stats" title="Permalink to this heading">#</a></h1> +<p>An async transport method for statsd communication.</p> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.async_stats.AsyncStatsClient"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">AsyncStatsClient</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loop</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">host</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'localhost'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">8125</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/async_stats.py#L12-L55"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.async_stats.AsyncStatsClient" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://statsd.readthedocs.io/en/v3.3/reference.html#statsd.client.base.StatsClientBase" title="(in Python StatsD - Edited by Python Discord to extend statsd base objects to also allow referencing statsd.client.base.StatsClientBase v3.3)"><code class="xref py py-class docutils literal notranslate"><span class="pre">StatsClientBase</span></code></a></p> +<p>An async implementation of <a class="reference external" href="https://statsd.readthedocs.io/en/v3.3/reference.html#statsd.client.base.StatsClientBase" title="(in Python StatsD - Edited by Python Discord to extend statsd base objects to also allow referencing statsd.client.base.StatsClientBase v3.3)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">statsd.client.base.StatsClientBase</span></code></a> that supports async stat communication.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.async_stats.AsyncStatsClient.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">loop</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">host</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'localhost'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">8125</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/async_stats.py#L15-L39"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.async_stats.AsyncStatsClient.__init__" title="Permalink to this definition">#</a></dt> +<dd><p>Create a new <a class="reference internal" href="#botcore.async_stats.AsyncStatsClient" title="botcore.async_stats.AsyncStatsClient"><code class="xref py py-obj docutils literal notranslate"><span class="pre">AsyncStatsClient</span></code></a>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>loop</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop" title="(in Python v3.10)"><em>asyncio.AbstractEventLoop</em></a>) – The event loop to use when creating the +<a class="reference external" href="https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_datagram_endpoint" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">asyncio.loop.create_datagram_endpoint</span></code></a>.</p></li> +<li><p><strong>host</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The host to connect to.</p></li> +<li><p><strong>port</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The port to connect to.</p></li> +<li><p><strong>prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The prefix to use for all stats.</p></li> +</ul> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.async_stats.AsyncStatsClient.create_socket"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_socket</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/async_stats.py#L40-L47"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.async_stats.AsyncStatsClient.create_socket" title="Permalink to this definition">#</a></dt> +<dd><p>Use <a class="reference external" href="https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_datagram_endpoint" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">asyncio.loop.create_datagram_endpoint</span></code></a> from the loop given on init to create a socket.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.site_api.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">site_api</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.scheduling.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">scheduling</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.exts.html b/v8.0.0/output/botcore.exts.html new file mode 100644 index 00000000..b72d137e --- /dev/null +++ b/v8.0.0/output/botcore.exts.html @@ -0,0 +1,392 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Utils" href="botcore.utils.html" /><link rel="prev" title="Botcore" href="botcore.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>Exts - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2 current current-page"><a class="current reference internal" href="#">Exts</a></li> +<li class="toctree-l2 has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.exts.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.exts.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.exts.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.exts.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.exts.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.exts.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.exts.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.exts.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.exts.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.exts.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.exts.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.exts.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.exts.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.exts.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.exts.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.exts.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.exts.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.exts"> +<span id="exts"></span><h1>Exts<a class="headerlink" href="#module-botcore.exts" title="Permalink to this heading">#</a></h1> +<p>Reusable Discord cogs.</p> +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">Utils</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">Botcore</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.html b/v8.0.0/output/botcore.html new file mode 100644 index 00000000..09d02104 --- /dev/null +++ b/v8.0.0/output/botcore.html @@ -0,0 +1,623 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Exts" href="botcore.exts.html" /><link rel="prev" title="Bot Core Project Documentation" href="../index.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>Botcore - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children current-page"><a class="current reference internal" href="#">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore"> +<span id="botcore"></span><h1>Botcore<a class="headerlink" href="#module-botcore" title="Permalink to this heading">#</a></h1> +<p>Useful utilities and tools for Discord bot development.</p> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.BotBase"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">BotBase</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">guild_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_roles</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">http_session</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">redis_session</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">api_client</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">statsd_url</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L36-L289"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bot</span></code></a></p> +<p>A sub-class that implements many common features that Python Discord bots use.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">guild_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_roles</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">http_session</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">redis_session</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">api_client</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">statsd_url</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L39-L89"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.__init__" title="Permalink to this definition">#</a></dt> +<dd><p>Initialise the base bot instance.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>guild_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID of the guild used for <a class="reference internal" href="#botcore.BotBase.wait_until_guild_available" title="botcore.BotBase.wait_until_guild_available"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait_until_guild_available()</span></code></a>.</p></li> +<li><p><strong>allowed_roles</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>) – A list of role IDs that the bot is allowed to mention.</p></li> +<li><p><strong>http_session</strong> (<a class="reference external" href="https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession" title="(in aiohttp v3.8)"><em>aiohttp.ClientSession</em></a>) – The session to use for the bot.</p></li> +<li><p><strong>redis_session</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">RedisSession</span></code>]) – The <a class="reference external" href="https://github.com/SebastiaanZ/async-rediscache#creating-a-redissession">async_rediscache.RedisSession</a> to use for the bot.</p></li> +<li><p><strong>api_client</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference internal" href="botcore.site_api.html#botcore.site_api.APIClient" title="botcore.site_api.APIClient"><code class="xref py py-class docutils literal notranslate"><span class="pre">APIClient</span></code></a>]) – The <a class="reference internal" href="botcore.site_api.html#botcore.site_api.APIClient" title="botcore.site_api.APIClient"><code class="xref py py-obj docutils literal notranslate"><span class="pre">botcore.site_api.APIClient</span></code></a> instance to use for the bot.</p></li> +<li><p><strong>statsd_url</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The URL of the statsd server to use for the bot. If not given, +a dummy statsd client will be created.</p></li> +</ul> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.add_cog"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_cog</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cog</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L152-L156"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.add_cog" title="Permalink to this definition">#</a></dt> +<dd><p>Add the given <code class="docutils literal notranslate"><span class="pre">cog</span></code> to the bot and log the operation.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.add_command"> +<span class="sig-name descname"><span class="pre">add_command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L157-L161"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.add_command" title="Permalink to this definition">#</a></dt> +<dd><p>Add <code class="docutils literal notranslate"><span class="pre">command</span></code> as normal and then add its root aliases to the bot.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.clear"> +<span class="sig-name descname"><span class="pre">clear</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L177-L180"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.clear" title="Permalink to this definition">#</a></dt> +<dd><p>Not implemented! Re-instantiate the bot instead of attempting to re-use a closed one.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.close"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L258-L289"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.close" title="Permalink to this definition">#</a></dt> +<dd><p>Close the Discord connection, and the aiohttp session, connector, statsd client, and resolver.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.load_extensions"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">load_extensions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">module</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L119-L130"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.load_extensions" title="Permalink to this definition">#</a></dt> +<dd><p>Load all the extensions within the given module and save them to <code class="docutils literal notranslate"><span class="pre">self.all_extensions</span></code>.</p> +<p>This should be ran in a task on the event loop to avoid deadlocks caused by <code class="docutils literal notranslate"><span class="pre">wait_for</span></code> calls.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.log_to_dev_log"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">log_to_dev_log</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L205-L208"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.log_to_dev_log" title="Permalink to this definition">#</a></dt> +<dd><p>Log the given message to #dev-log.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.on_guild_available"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">on_guild_available</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">guild</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L188-L204"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.on_guild_available" title="Permalink to this definition">#</a></dt> +<dd><p>Set the internal guild available event when self.guild_id becomes available.</p> +<p>If the cache appears to still be empty (no members, no channels, or no roles), the event +will not be set and <cite>guild_available_but_cache_empty</cite> event will be emitted.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.on_guild_unavailable"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">on_guild_unavailable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">guild</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L181-L187"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.on_guild_unavailable" title="Permalink to this definition">#</a></dt> +<dd><p>Clear the internal guild available event when self.guild_id becomes unavailable.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.ping_services"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ping_services</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L254-L257"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.ping_services" title="Permalink to this definition">#</a></dt> +<dd><p>Ping all required services on setup to ensure they are up before starting.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.remove_command"> +<span class="sig-name descname"><span class="pre">remove_command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L162-L176"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.remove_command" title="Permalink to this definition">#</a></dt> +<dd><p>Remove a command/alias as normal and then remove its root aliases from the bot.</p> +<p>Individual root aliases cannot be removed by this function. +To remove them, either remove the entire command or manually edit <cite>bot.all_commands</cite>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.setup_hook"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">setup_hook</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L218-L253"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.setup_hook" title="Permalink to this definition">#</a></dt> +<dd><p>An async init to startup generic services.</p> +<p>Connects to statsd, and calls +<a class="reference internal" href="botcore.async_stats.html#botcore.async_stats.AsyncStatsClient.create_socket" title="botcore.async_stats.AsyncStatsClient.create_socket"><code class="xref py py-func docutils literal notranslate"><span class="pre">AsyncStatsClient.create_socket</span></code></a> +and <a class="reference internal" href="#botcore.BotBase.ping_services" title="botcore.BotBase.ping_services"><code class="xref py py-func docutils literal notranslate"><span class="pre">ping_services()</span></code></a>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.BotBase.wait_until_guild_available"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">wait_until_guild_available</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L209-L217"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.BotBase.wait_until_guild_available" title="Permalink to this definition">#</a></dt> +<dd><p>Wait until the guild that matches the <code class="docutils literal notranslate"><span class="pre">guild_id</span></code> given at init is available (and the cache is ready).</p> +<p>The on_ready event is inadequate because it only waits 2 seconds for a GUILD_CREATE +gateway event before giving up and thus not populating the cache for unavailable guilds.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="py exception"> +<dt class="sig sig-object py" id="botcore.StartupError"> +<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">StartupError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L28-L34"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.StartupError" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a></p> +<p>Exception class for startup errors.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.StartupError.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/_bot.py#L31-L34"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.StartupError.__init__" title="Permalink to this definition">#</a></dt> +<dd></dd></dl> + +</dd></dl> + +<section id="subpackages"> +<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this heading">#</a></h2> +<div class="toctree-wrapper compound"> +<ul> +<li class="toctree-l1"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.html">Utils</a><ul> +<li class="toctree-l2"><a class="reference internal" href="botcore.utils.html#submodules">Submodules</a><ul> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +</ul> +</li> +</ul> +</div> +</section> +<section id="submodules"> +<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading">#</a></h2> +<div class="toctree-wrapper compound"> +<ul> +<li class="toctree-l1"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</div> +</section> +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.exts.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">Exts</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="../index.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">Home</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer"> + + + <div class="toc-sticky toc-scroll"> + <div class="toc-title-container"> + <span class="toc-title"> + Contents + </span> + </div> + <div class="toc-tree-container"> + <div class="toc-tree"> + <ul> +<li><a class="reference internal" href="#">Botcore</a><ul> +<li><a class="reference internal" href="#subpackages">Subpackages</a></li> +<li><a class="reference internal" href="#submodules">Submodules</a></li> +</ul> +</li> +</ul> + + </div> + </div> + </div> + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.site_api.html b/v8.0.0/output/botcore.site_api.html new file mode 100644 index 00000000..97a4272c --- /dev/null +++ b/v8.0.0/output/botcore.site_api.html @@ -0,0 +1,563 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Local Development & Testing" href="../development.html" /><link rel="prev" title="async_stats" href="botcore.async_stats.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>site_api - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2 current current-page"><a class="current reference internal" href="#">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.site_api.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.site_api.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.site_api.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.site_api.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.site_api.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.site_api.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.site_api.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.site_api.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.site_api.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.site_api.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.site_api.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.site_api.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.site_api.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.site_api.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.site_api.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.site_api.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.site_api.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.site_api"> +<span id="site-api"></span><h1>site_api<a class="headerlink" href="#module-botcore.site_api" title="Permalink to this heading">#</a></h1> +<p>An API wrapper around the Site API.</p> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">APIClient</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">site_api_url</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site_api_token</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">session_kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L42-L155"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p> +<p>A wrapper for the Django Site API.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">site_api_url</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site_api_token</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">session_kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L48-L71"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.__init__" title="Permalink to this definition">#</a></dt> +<dd><p>Initialize a new <a class="reference internal" href="#botcore.site_api.APIClient" title="botcore.site_api.APIClient"><code class="xref py py-obj docutils literal notranslate"><span class="pre">APIClient</span></code></a> instance.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>site_api_url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The URL of the site API.</p></li> +<li><p><strong>site_api_token</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The token to use for authentication.</p></li> +<li><p><strong>session_kwargs</strong> – Keyword arguments to pass to the <a class="reference external" href="https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession" title="(in aiohttp v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">aiohttp.ClientSession</span></code></a> constructor.</p></li> +</ul> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.close"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L75-L78"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.close" title="Permalink to this definition">#</a></dt> +<dd><p>Close the aiohttp session.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.delete"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">delete</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">raise_for_status</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L137-L155"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.delete" title="Permalink to this definition">#</a></dt> +<dd><p>Send a DELETE request to the site API and return the JSON response.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>endpoint</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The endpoint to send the request to.</p></li> +<li><p><strong>raise_for_status</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether or not to raise an exception if the response is not OK.</p></li> +<li><p><strong>**kwargs</strong> – Any extra keyword arguments to pass to <a class="reference external" href="https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.request" title="(in aiohttp v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">aiohttp.request()</span></code></a>.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>]</p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p>The JSON response the API returns, or None if the response is 204 No Content.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.get"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">raise_for_status</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L121-L124"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.get" title="Permalink to this definition">#</a></dt> +<dd><p>Equivalent to <a class="reference internal" href="#botcore.site_api.APIClient.request" title="botcore.site_api.APIClient.request"><code class="xref py py-meth docutils literal notranslate"><span class="pre">APIClient.request()</span></code></a> with GET passed as the method.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.maybe_raise_for_status"> +<em class="property"><span class="pre">async</span><span class="w"> </span><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">maybe_raise_for_status</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">response</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">should_raise</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L79-L99"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.maybe_raise_for_status" title="Permalink to this definition">#</a></dt> +<dd><p>Raise <a class="reference internal" href="#botcore.site_api.ResponseCodeError" title="botcore.site_api.ResponseCodeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ResponseCodeError</span></code></a> for non-OK response if an exception should be raised.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>response</strong> (<a class="reference external" href="https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientResponse" title="(in aiohttp v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">aiohttp.ClientResponse</span></code></a>) – The response to check.</p></li> +<li><p><strong>should_raise</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether or not to raise an exception.</p></li> +</ul> +</dd> +<dt class="field-even">Raises<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference internal" href="#botcore.site_api.ResponseCodeError" title="botcore.site_api.ResponseCodeError"><strong>ResponseCodeError</strong></a> – If the response is not OK and <code class="docutils literal notranslate"><span class="pre">should_raise</span></code> is True.</p> +</dd> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.patch"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">patch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">raise_for_status</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L125-L128"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.patch" title="Permalink to this definition">#</a></dt> +<dd><p>Equivalent to <a class="reference internal" href="#botcore.site_api.APIClient.request" title="botcore.site_api.APIClient.request"><code class="xref py py-meth docutils literal notranslate"><span class="pre">APIClient.request()</span></code></a> with PATCH passed as the method.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.post"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">post</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">raise_for_status</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L129-L132"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.post" title="Permalink to this definition">#</a></dt> +<dd><p>Equivalent to <a class="reference internal" href="#botcore.site_api.APIClient.request" title="botcore.site_api.APIClient.request"><code class="xref py py-meth docutils literal notranslate"><span class="pre">APIClient.request()</span></code></a> with POST passed as the method.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.put"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">put</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">raise_for_status</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L133-L136"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.put" title="Permalink to this definition">#</a></dt> +<dd><p>Equivalent to <a class="reference internal" href="#botcore.site_api.APIClient.request" title="botcore.site_api.APIClient.request"><code class="xref py py-meth docutils literal notranslate"><span class="pre">APIClient.request()</span></code></a> with PUT passed as the method.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.APIClient.request"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">request</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">raise_for_status</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L100-L120"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.APIClient.request" title="Permalink to this definition">#</a></dt> +<dd><p>Send an HTTP request to the site API and return the JSON response.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>method</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The HTTP method to use.</p></li> +<li><p><strong>endpoint</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The endpoint to send the request to.</p></li> +<li><p><strong>raise_for_status</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether or not to raise an exception if the response is not OK.</p></li> +<li><p><strong>**kwargs</strong> – Any extra keyword arguments to pass to <a class="reference external" href="https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.request" title="(in aiohttp v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">aiohttp.request()</span></code></a>.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p>The JSON response the API returns.</p> +</dd> +<dt class="field-even">Raises<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference internal" href="#botcore.site_api.ResponseCodeError" title="botcore.site_api.ResponseCodeError"><strong>ResponseCodeError</strong></a> – If the response is not OK and <code class="docutils literal notranslate"><span class="pre">raise_for_status</span></code> is True.</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="py exception"> +<dt class="sig sig-object py" id="botcore.site_api.ResponseCodeError"> +<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ResponseCodeError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">response</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_json</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_text</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L14-L40"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.ResponseCodeError" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ValueError</span></code></a></p> +<p>Raised in <a class="reference internal" href="#botcore.site_api.APIClient.request" title="botcore.site_api.APIClient.request"><code class="xref py py-meth docutils literal notranslate"><span class="pre">APIClient.request()</span></code></a> when a non-OK HTTP response is received.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.ResponseCodeError.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">response</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_json</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_text</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L17-L35"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.ResponseCodeError.__init__" title="Permalink to this definition">#</a></dt> +<dd><p>Initialize a new <a class="reference internal" href="#botcore.site_api.ResponseCodeError" title="botcore.site_api.ResponseCodeError"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ResponseCodeError</span></code></a> instance.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>response</strong> (<a class="reference external" href="https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientResponse" title="(in aiohttp v3.8)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">aiohttp.ClientResponse</span></code></a>) – The response object from the request.</p></li> +<li><p><strong>response_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>]) – The JSON response returned from the request, if any.</p></li> +<li><p><strong>response_text</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The text of the request, if any.</p></li> +</ul> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.site_api.ResponseCodeError.__str__"> +<span class="sig-name descname"><span class="pre">__str__</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/site_api.py#L36-L40"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.site_api.ResponseCodeError.__str__" title="Permalink to this definition">#</a></dt> +<dd><p>Return a string representation of the error.</p> +</dd></dl> + +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="../development.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">Local Development & Testing</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.async_stats.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">async_stats</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.caching.html b/v8.0.0/output/botcore.utils.caching.html new file mode 100644 index 00000000..9c3929b5 --- /dev/null +++ b/v8.0.0/output/botcore.utils.caching.html @@ -0,0 +1,440 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="channel" href="botcore.utils.channel.html" /><link rel="prev" title="Utils" href="botcore.utils.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>caching - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.caching.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.caching.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.caching.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.caching.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.caching.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.caching.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.caching.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.caching.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.caching.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.caching.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.caching.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.caching.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.caching.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.caching.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.caching.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.caching.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.caching.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.caching"> +<span id="caching"></span><h1>caching<a class="headerlink" href="#module-botcore.utils.caching" title="Permalink to this heading">#</a></h1> +<p>Utilities related to custom caches.</p> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.utils.caching.AsyncCache"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">AsyncCache</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">max_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">128</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/caching.py#L8-L66"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.caching.AsyncCache" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p> +<p>LRU cache implementation for coroutines.</p> +<p>Once the cache exceeds the maximum size, keys are deleted in FIFO order.</p> +<p>An offset may be optionally provided to be applied to the coroutine’s arguments when creating the cache key.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.caching.AsyncCache.__call__"> +<span class="sig-name descname"><span class="pre">__call__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg_offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/caching.py#L27-L62"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.caching.AsyncCache.__call__" title="Permalink to this definition">#</a></dt> +<dd><p>Decorator for async cache.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>arg_offset</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The offset for the position of the key argument.</p> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Callable" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Callable</span></code></a></p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p>A decorator to wrap the target function.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.caching.AsyncCache.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">max_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">128</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/caching.py#L17-L26"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.caching.AsyncCache.__init__" title="Permalink to this definition">#</a></dt> +<dd><p>Initialise a new <a class="reference internal" href="#botcore.utils.caching.AsyncCache" title="botcore.utils.caching.AsyncCache"><code class="xref py py-obj docutils literal notranslate"><span class="pre">AsyncCache</span></code></a> instance.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>max_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – How many items to store in the cache.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.caching.AsyncCache.clear"> +<span class="sig-name descname"><span class="pre">clear</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/caching.py#L63-L66"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.caching.AsyncCache.clear" title="Permalink to this definition">#</a></dt> +<dd><p>Clear cache instance.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.channel.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">channel</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">Utils</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.channel.html b/v8.0.0/output/botcore.utils.channel.html new file mode 100644 index 00000000..6f8a655e --- /dev/null +++ b/v8.0.0/output/botcore.utils.channel.html @@ -0,0 +1,440 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="commands" href="botcore.utils.commands.html" /><link rel="prev" title="caching" href="botcore.utils.caching.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>channel - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.channel.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.channel.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.channel.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.channel.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.channel.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.channel.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.channel.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.channel.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.channel.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.channel.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.channel.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.channel.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.channel.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.channel.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.channel.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.channel.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.channel.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.channel"> +<span id="channel"></span><h1>channel<a class="headerlink" href="#module-botcore.utils.channel" title="Permalink to this heading">#</a></h1> +<p>Useful helper functions for interacting with various discord channel objects.</p> +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.channel.get_or_fetch_channel"> +<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_or_fetch_channel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bot</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel_id</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/channel.py#L25-L55"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.channel.get_or_fetch_channel" title="Permalink to this definition">#</a></dt> +<dd><p>Attempt to get or fetch the given <code class="docutils literal notranslate"><span class="pre">channel_id</span></code> from the bots cache, and return it.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>bot</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bot</span></code></a>) – The <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.ext.commands.Bot</span></code></a> instance to use for getting/fetching.</p></li> +<li><p><strong>channel_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The channel to get/fetch.</p></li> +</ul> +</dd> +<dt class="field-even">Raises<span class="colon">:</span></dt> +<dd class="field-even"><ul class="simple"> +<li><p><a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.InvalidData" title="(in discord.py v2.0.0a)"><strong>discord.InvalidData</strong></a> – An unknown channel type was received from Discord.</p></li> +<li><p><a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.HTTPException" title="(in discord.py v2.0.0a)"><strong>discord.HTTPException</strong></a> – Retrieving the channel failed.</p></li> +<li><p><a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.NotFound" title="(in discord.py v2.0.0a)"><strong>discord.NotFound</strong></a> – Invalid Channel ID.</p></li> +<li><p><a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Forbidden" title="(in discord.py v2.0.0a)"><strong>discord.Forbidden</strong></a> – You do not have permission to fetch this channel.</p></li> +</ul> +</dd> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">GuildChannel</span></code></a></p> +</dd> +<dt class="field-even">Returns<span class="colon">:</span></dt> +<dd class="field-even"><p>The channel from the ID.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.channel.is_in_category"> +<span class="sig-name descname"><span class="pre">is_in_category</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">channel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">category_id</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/channel.py#L11-L23"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.channel.is_in_category" title="Permalink to this definition">#</a></dt> +<dd><p>Return whether the given <code class="docutils literal notranslate"><span class="pre">channel</span></code> in the the category with the id <code class="docutils literal notranslate"><span class="pre">category_id</span></code>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>channel</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextChannel</span></code></a>) – The channel to check.</p></li> +<li><p><strong>category_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The category to check for.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p>A bool depending on whether the channel is in the category.</p> +</dd> +</dl> +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.commands.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">commands</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.caching.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">caching</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.commands.html b/v8.0.0/output/botcore.utils.commands.html new file mode 100644 index 00000000..21a15409 --- /dev/null +++ b/v8.0.0/output/botcore.utils.commands.html @@ -0,0 +1,414 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="interactions" href="botcore.utils.interactions.html" /><link rel="prev" title="channel" href="botcore.utils.channel.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>commands - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.commands.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.commands.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.commands.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.commands.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.commands.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.commands.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.commands.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/index.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/index.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/index.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/index.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/index.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/index.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/index.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/index.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/index.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/index.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.commands"> +<span id="commands"></span><h1>commands<a class="headerlink" href="#module-botcore.utils.commands" title="Permalink to this heading">#</a></h1> +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.commands.clean_text_or_reply"> +<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">clean_text_or_reply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/commands.py#L7-L39"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.commands.clean_text_or_reply" title="Permalink to this definition">#</a></dt> +<dd><p>Cleans a text argument or replied message’s content.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>ctx</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The command’s context</p></li> +<li><p><strong>text</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The provided text argument of the command (if given)</p></li> +</ul> +</dd> +<dt class="field-even">Raises<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BadArgument" title="(in discord.py v2.0.0a)"><strong>discord.ext.commands.BadArgument</strong></a> – <cite>text</cite> wasn’t provided and there’s no reply message / reply message content.</p> +</dd> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p> +</dd> +<dt class="field-even">Returns<span class="colon">:</span></dt> +<dd class="field-even"><p>The cleaned version of <cite>text</cite>, if given, else replied message.</p> +</dd> +</dl> +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.interactions.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">interactions</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.channel.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">channel</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.html b/v8.0.0/output/botcore.utils.html new file mode 100644 index 00000000..53ee9a19 --- /dev/null +++ b/v8.0.0/output/botcore.utils.html @@ -0,0 +1,462 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="caching" href="botcore.utils.caching.html" /><link rel="prev" title="Exts" href="botcore.exts.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>Utils - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children current-page"><a class="current reference internal" href="#">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils"> +<span id="utils"></span><h1>Utils<a class="headerlink" href="#module-botcore.utils" title="Permalink to this heading">#</a></h1> +<p>Useful utilities and tools for Discord bot development.</p> +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.apply_monkey_patches"> +<span class="sig-name descname"><span class="pre">apply_monkey_patches</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/__init__.py#L7-L21"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.apply_monkey_patches" title="Permalink to this definition">#</a></dt> +<dd><p>Applies all common monkey patches for our bots.</p> +<dl> +<dt>Patches <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.ext.commands.Command</span></code></a> and <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Group" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.ext.commands.Group</span></code></a> to support root aliases.</dt><dd><p>A <code class="docutils literal notranslate"><span class="pre">root_aliases</span></code> keyword argument is added to these two objects, which is a sequence of alias names +that will act as top-level groups rather than being aliases of the command’s group.</p> +<p>It’s stored as an attribute also named <code class="docutils literal notranslate"><span class="pre">root_aliases</span></code></p> +</dd> +<dt>Patches discord’s internal <code class="docutils literal notranslate"><span class="pre">send_typing</span></code> method so that it ignores 403 errors from Discord.</dt><dd><p>When under heavy load Discord has added a CloudFlare worker to this route, which causes 403 errors to be thrown.</p> +</dd> +</dl> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.unqualify"> +<span class="sig-name descname"><span class="pre">unqualify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/_extensions.py#L10-L21"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.unqualify" title="Permalink to this definition">#</a></dt> +<dd><p>Return an unqualified name given a qualified module/package <code class="docutils literal notranslate"><span class="pre">name</span></code>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The module name to unqualify.</p> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p>The unqualified module name.</p> +</dd> +</dl> +</dd></dl> + +<section id="submodules"> +<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading">#</a></h2> +<div class="toctree-wrapper compound"> +<ul> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l1"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</div> +</section> +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.caching.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">caching</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.exts.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">Exts</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer"> + + + <div class="toc-sticky toc-scroll"> + <div class="toc-title-container"> + <span class="toc-title"> + Contents + </span> + </div> + <div class="toc-tree-container"> + <div class="toc-tree"> + <ul> +<li><a class="reference internal" href="#">Utils</a><ul> +<li><a class="reference internal" href="#submodules">Submodules</a></li> +</ul> +</li> +</ul> + + </div> + </div> + </div> + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.interactions.html b/v8.0.0/output/botcore.utils.interactions.html new file mode 100644 index 00000000..39c201b4 --- /dev/null +++ b/v8.0.0/output/botcore.utils.interactions.html @@ -0,0 +1,473 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="logging" href="botcore.utils.logging.html" /><link rel="prev" title="commands" href="botcore.utils.commands.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>interactions - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.interactions.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.interactions.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.interactions.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.interactions.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.interactions.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.interactions.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.interactions.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.interactions.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.interactions.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.interactions.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.interactions.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/index.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/index.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/index.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/index.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/index.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/index.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.interactions"> +<span id="interactions"></span><h1>interactions<a class="headerlink" href="#module-botcore.utils.interactions" title="Permalink to this heading">#</a></h1> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.utils.interactions.DeleteMessageButton"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">DeleteMessageButton</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">style=<ButtonStyle.secondary:</span> <span class="pre">2></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">label='Delete'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">**kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L73-L99"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.DeleteMessageButton" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Button</span></code></a></p> +<p>A button that can be added to a view to delete the message containing the view on click.</p> +<p>This button itself carries out no interaction checks, these should be done by the parent view.</p> +<p>See <a class="reference internal" href="#botcore.utils.interactions.ViewWithUserAndRoleCheck" title="botcore.utils.interactions.ViewWithUserAndRoleCheck"><code class="xref py py-obj docutils literal notranslate"><span class="pre">botcore.utils.interactions.ViewWithUserAndRoleCheck</span></code></a> for a view that implements basic checks.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>style</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ButtonStyle"><code class="docutils literal notranslate"><span class="pre">ButtonStyle</span></code></a>) – The style of the button, set to <code class="docutils literal notranslate"><span class="pre">ButtonStyle.secondary</span></code> if not specified.</p></li> +<li><p><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The label of the button, set to “Delete” if not specified.</p></li> +</ul> +</dd> +</dl> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.interactions.DeleteMessageButton.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">style=<ButtonStyle.secondary:</span> <span class="pre">2></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">label='Delete'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">**kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L87-L95"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.DeleteMessageButton.__init__" title="Permalink to this definition">#</a></dt> +<dd></dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.interactions.DeleteMessageButton.callback"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">interaction</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L96-L99"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.DeleteMessageButton.callback" title="Permalink to this definition">#</a></dt> +<dd><p>Delete the original message on button click.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.utils.interactions.ViewWithUserAndRoleCheck"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ViewWithUserAndRoleCheck</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_users</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_roles</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">180.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">message</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L11-L71"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.ViewWithUserAndRoleCheck" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">View</span></code></a></p> +<p>A view that allows the original invoker and moderators to interact with it.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>allowed_users</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – A sequence of user’s ids who are allowed to interact with the view.</p></li> +<li><p><strong>allowed_roles</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – A sequence of role ids that are allowed to interact with the view.</p></li> +<li><p><strong>timeout</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – Timeout in seconds from last interaction with the UI before no longer accepting input. +If <code class="docutils literal notranslate"><span class="pre">None</span></code> then there is no timeout.</p></li> +<li><p><strong>message</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Message" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]) – The message to remove the view from on timeout. This can also be set with +<code class="docutils literal notranslate"><span class="pre">view.message</span> <span class="pre">=</span> <span class="pre">await</span> <span class="pre">ctx.send(</span> <span class="pre">...</span> <span class="pre">)`</span></code> , or similar, after the view is instantiated.</p></li> +</ul> +</dd> +</dl> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.interactions.ViewWithUserAndRoleCheck.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_users</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_roles</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">180.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">message</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L24-L36"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.ViewWithUserAndRoleCheck.__init__" title="Permalink to this definition">#</a></dt> +<dd></dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.interactions.ViewWithUserAndRoleCheck.interaction_check"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">interaction_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">interaction</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L37-L64"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.ViewWithUserAndRoleCheck.interaction_check" title="Permalink to this definition">#</a></dt> +<dd><p>Ensure the user clicking the button is the view invoker, or a moderator.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>interaction</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Interaction</span></code></a>) – The interaction that occurred.</p> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.interactions.ViewWithUserAndRoleCheck.on_timeout"> +<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">on_timeout</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/interactions.py#L65-L71"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.interactions.ViewWithUserAndRoleCheck.on_timeout" title="Permalink to this definition">#</a></dt> +<dd><p>Remove the view from <code class="docutils literal notranslate"><span class="pre">self.message</span></code> if set.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.logging.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">logging</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.commands.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">commands</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.logging.html b/v8.0.0/output/botcore.utils.logging.html new file mode 100644 index 00000000..6eabc3c9 --- /dev/null +++ b/v8.0.0/output/botcore.utils.logging.html @@ -0,0 +1,438 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="members" href="botcore.utils.members.html" /><link rel="prev" title="interactions" href="botcore.utils.interactions.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>logging - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.logging.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.logging.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.logging.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.logging.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.logging.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.logging.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.logging.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.logging.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.logging.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.logging.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.logging.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.logging.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.logging.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.logging.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.logging.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.logging.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.logging.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.logging"> +<span id="logging"></span><h1>logging<a class="headerlink" href="#module-botcore.utils.logging" title="Permalink to this heading">#</a></h1> +<p>Common logging related functions.</p> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.utils.logging.CustomLogger"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">CustomLogger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/logging.py#L14-L33"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.logging.CustomLogger" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/logging.html#logging.Logger" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Logger</span></code></a></p> +<p>Custom implementation of the <a class="reference external" href="https://docs.python.org/3/library/logging.html#logging.Logger" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">logging.Logger</span></code></a> class with an added <a class="reference internal" href="#botcore.utils.logging.CustomLogger.trace" title="botcore.utils.logging.CustomLogger.trace"><code class="xref py py-obj docutils literal notranslate"><span class="pre">trace</span></code></a> method.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.logging.CustomLogger.trace"> +<span class="sig-name descname"><span class="pre">trace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/logging.py#L17-L33"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.logging.CustomLogger.trace" title="Permalink to this definition">#</a></dt> +<dd><p>Log the given message with the severity <code class="docutils literal notranslate"><span class="pre">"TRACE"</span></code>.</p> +<p>To pass exception information, use the keyword argument exc_info with a true value:</p> +<div class="highlight-py notranslate"><div class="highlight"><pre><span></span><span class="n">logger</span><span class="o">.</span><span class="n">trace</span><span class="p">(</span><span class="s2">"Houston, we have an </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"interesting problem"</span><span class="p">,</span> <span class="n">exc_info</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> +</pre></div> +</div> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>msg</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The message to be logged.</p></li> +<li><p><strong>args</strong> – Passed to the base log function as is.</p></li> +<li><p><strong>kwargs</strong> – Passed to the base log function as is.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.logging.get_logger"> +<span class="sig-name descname"><span class="pre">get_logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/logging.py#L35-L46"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.logging.get_logger" title="Permalink to this definition">#</a></dt> +<dd><p>Utility to make mypy recognise that logger is of type <a class="reference internal" href="#botcore.utils.logging.CustomLogger" title="botcore.utils.logging.CustomLogger"><code class="xref py py-obj docutils literal notranslate"><span class="pre">CustomLogger</span></code></a>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The name given to the logger.</p> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference internal" href="#botcore.utils.logging.CustomLogger" title="botcore.utils.logging.CustomLogger"><code class="xref py py-class docutils literal notranslate"><span class="pre">CustomLogger</span></code></a></p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p>An instance of the <a class="reference internal" href="#botcore.utils.logging.CustomLogger" title="botcore.utils.logging.CustomLogger"><code class="xref py py-obj docutils literal notranslate"><span class="pre">CustomLogger</span></code></a> class.</p> +</dd> +</dl> +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.members.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">members</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.interactions.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">interactions</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.members.html b/v8.0.0/output/botcore.utils.members.html new file mode 100644 index 00000000..328804d4 --- /dev/null +++ b/v8.0.0/output/botcore.utils.members.html @@ -0,0 +1,426 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="regex" href="botcore.utils.regex.html" /><link rel="prev" title="logging" href="botcore.utils.logging.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>members - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.members.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.members.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.members.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.members.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.members.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.members.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.members.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.members.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.members.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.members.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.members.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.members.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.members.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.members.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.members.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.members.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.members.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.members"> +<span id="members"></span><h1>members<a class="headerlink" href="#module-botcore.utils.members" title="Permalink to this heading">#</a></h1> +<p>Useful helper functions for interactin with <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.Member</span></code></a> objects.</p> +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.members.get_or_fetch_member"> +<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_or_fetch_member</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">guild</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">member_id</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/members.py#L12-L29"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.members.get_or_fetch_member" title="Permalink to this definition">#</a></dt> +<dd><p>Attempt to get a member from cache; on failure fetch from the API.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a>]</p> +</dd> +<dt class="field-even">Returns<span class="colon">:</span></dt> +<dd class="field-even"><p>The <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.Member</span></code></a> or <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a> to indicate the member could not be found.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.members.handle_role_change"> +<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">handle_role_change</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">member</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coro</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">role</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/members.py#L31-L58"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.members.handle_role_change" title="Permalink to this definition">#</a></dt> +<dd><p>Await the given <code class="docutils literal notranslate"><span class="pre">coro</span></code> with <code class="docutils literal notranslate"><span class="pre">role</span></code> as the sole argument.</p> +<p>Handle errors that we expect to be raised from +<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.add_roles" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.Member.add_roles</span></code></a> and <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.remove_roles" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.Member.remove_roles</span></code></a>.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>member</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a>) – The member that is being modified for logging purposes.</p></li> +<li><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Callable" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Callable</span></code></a>[[<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Role" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Role</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Coroutine" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Coroutine</span></code></a>]) – This is intended to be <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.add_roles" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.Member.add_roles</span></code></a> or <a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.remove_roles" title="(in discord.py v2.0.0a)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">discord.Member.remove_roles</span></code></a>.</p></li> +<li><p><strong>role</strong> (<a class="reference external" href="https://discordpy.readthedocs.io/en/latest/api.html#discord.Role" title="(in discord.py v2.0.0a)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Role</span></code></a>) – The role to be passed to <code class="docutils literal notranslate"><span class="pre">coro</span></code>.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.regex.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">regex</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.logging.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">logging</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.regex.html b/v8.0.0/output/botcore.utils.regex.html new file mode 100644 index 00000000..82f38c5f --- /dev/null +++ b/v8.0.0/output/botcore.utils.regex.html @@ -0,0 +1,422 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="scheduling" href="botcore.utils.scheduling.html" /><link rel="prev" title="members" href="botcore.utils.members.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>regex - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">regex</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.scheduling.html">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.regex.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.regex.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.regex.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.regex.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.regex.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.regex.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.regex.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.regex.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.regex.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.regex.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.regex.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.regex.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.regex.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.regex.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.regex.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.regex.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.regex.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.regex"> +<span id="regex"></span><h1>regex<a class="headerlink" href="#module-botcore.utils.regex" title="Permalink to this heading">#</a></h1> +<p>Common regular expressions.</p> +<dl class="py data"> +<dt class="sig sig-object py" id="botcore.utils.regex.DISCORD_INVITE"> +<span class="sig-name descname"><span class="pre">DISCORD_INVITE</span></span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/regex.py#L5-L16"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.regex.DISCORD_INVITE" title="Permalink to this definition">#</a></dt> +<dd><p>Regex for Discord server invites.</p> +<div class="admonition warning"> +<p class="admonition-title">Warning</p> +<p>This regex pattern will capture until a whitespace, if you are to use the ‘invite’ capture group in +any HTTP requests or similar. Please ensure you sanitise the output using something +such as <a class="reference external" href="https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote" title="(in Python v3.10)"><code class="xref py py-func docutils literal notranslate"><span class="pre">urllib.parse.quote()</span></code></a>.</p> +</div> +<dl class="field-list simple"> +</dl> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="botcore.utils.regex.FORMATTED_CODE_REGEX"> +<span class="sig-name descname"><span class="pre">FORMATTED_CODE_REGEX</span></span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/regex.py#L28-L36"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.regex.FORMATTED_CODE_REGEX" title="Permalink to this definition">#</a></dt> +<dd><p>Regex for formatted code, using Discord’s code blocks.</p> +<dl class="field-list simple"> +</dl> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="botcore.utils.regex.RAW_CODE_REGEX"> +<span class="sig-name descname"><span class="pre">RAW_CODE_REGEX</span></span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/regex.py#L43-L48"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.regex.RAW_CODE_REGEX" title="Permalink to this definition">#</a></dt> +<dd><p>Regex for raw code, <em>not</em> using Discord’s code blocks.</p> +<dl class="field-list simple"> +</dl> +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.utils.scheduling.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">scheduling</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.members.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">members</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file diff --git a/v8.0.0/output/botcore.utils.scheduling.html b/v8.0.0/output/botcore.utils.scheduling.html new file mode 100644 index 00000000..b450d5b0 --- /dev/null +++ b/v8.0.0/output/botcore.utils.scheduling.html @@ -0,0 +1,547 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head><meta charset="utf-8"/> + <meta name="viewport" content="width=device-width,initial-scale=1"/> + <meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> +<link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="async_stats" href="botcore.async_stats.html" /><link rel="prev" title="regex" href="botcore.utils.regex.html" /> + + <link rel="shortcut icon" href="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg"/><meta name="generator" content="sphinx-5.1.1, furo 2022.06.21"/> + <title>scheduling - Bot Core v8.0.0</title> + <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" /> + <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" /> + <link rel="stylesheet" type="text/css" href="../_static/logo.css" /> + <link rel="stylesheet" type="text/css" href="../_static/changelog.css" /> + <link rel="stylesheet" type="text/css" href="../_static/index.css" /> + + + + +<style> + body { + --color-code-background: #f8f8f8; + --color-code-foreground: black; + --color-api-name: var(--color-link); + + } + @media not print { + body[data-theme="dark"] { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + @media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + --color-code-background: #202020; + --color-code-foreground: #d0d0d0; + + } + } + } +</style></head> + <body> + + <script> + document.body.dataset.theme = localStorage.getItem("theme") || "auto"; + </script> + + +<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="svg-toc" viewBox="0 0 24 24"> + <title>Contents</title> + <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> + <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> + </svg> + </symbol> + <symbol id="svg-menu" viewBox="0 0 24 24"> + <title>Menu</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> + <line x1="3" y1="12" x2="21" y2="12"></line> + <line x1="3" y1="6" x2="21" y2="6"></line> + <line x1="3" y1="18" x2="21" y2="18"></line> + </svg> + </symbol> + <symbol id="svg-arrow-right" viewBox="0 0 24 24"> + <title>Expand</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </symbol> + <symbol id="svg-sun" viewBox="0 0 24 24"> + <title>Light mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> + <circle cx="12" cy="12" r="5"></circle> + <line x1="12" y1="1" x2="12" y2="3"></line> + <line x1="12" y1="21" x2="12" y2="23"></line> + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> + <line x1="1" y1="12" x2="3" y2="12"></line> + <line x1="21" y1="12" x2="23" y2="12"></line> + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> + </svg> + </symbol> + <symbol id="svg-moon" viewBox="0 0 24 24"> + <title>Dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> + <path stroke="none" d="M0 0h24v24H0z" fill="none" /> + <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> + </svg> + </symbol> + <symbol id="svg-sun-half" viewBox="0 0 24 24"> + <title>Auto light/dark mode</title> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" + stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow"> + <path stroke="none" d="M0 0h24v24H0z" fill="none"/> + <circle cx="12" cy="12" r="9" /> + <path d="M13 12h5" /> + <path d="M13 15h4" /> + <path d="M13 18h1" /> + <path d="M13 9h4" /> + <path d="M13 6h1" /> + </svg> + </symbol> +</svg> + +<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> +<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> +<label class="overlay sidebar-overlay" for="__navigation"> + <div class="visually-hidden">Hide navigation sidebar</div> +</label> +<label class="overlay toc-overlay" for="__toc"> + <div class="visually-hidden">Hide table of contents sidebar</div> +</label> + + + +<div class="page"> + <header class="mobile-header"> + <div class="header-left"> + <label class="nav-overlay-icon" for="__navigation"> + <div class="visually-hidden">Toggle site navigation sidebar</div> + <i class="icon"><svg><use href="#svg-menu"></use></svg></i> + </label> + </div> + <div class="header-center"> + <a href="../index.html"><div class="brand">Bot Core v8.0.0</div></a> + </div> + <div class="header-right"> + <div class="theme-toggle-container theme-toggle-header"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + </header> + <aside class="sidebar-drawer"> + <div class="sidebar-container"> + + <div class="sidebar-sticky"><a class="sidebar-brand centered" href="../index.html"> + + <div class="sidebar-logo-container"> + <img class="sidebar-logo" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_full/logo_full.min.svg" alt="Logo"/> + </div> + + <span class="sidebar-brand-text">Bot Core v8.0.0</span> + +</a><form class="sidebar-search-container" method="get" action="../search.html" role="search"> + <input class="sidebar-search" placeholder=Search name="q" aria-label="Search"> + <input type="hidden" name="check_keywords" value="yes"> + <input type="hidden" name="area" value="default"> +</form> +<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> + <p class="caption" role="heading"><span class="caption-text">Modules:</span></p> +<ul class="current"> +<li class="toctree-l1 current has-children"><a class="reference internal" href="botcore.html">Botcore</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="botcore.exts.html">Exts</a></li> +<li class="toctree-l2 current has-children"><a class="reference internal" href="botcore.utils.html">Utils</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.caching.html">caching</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.channel.html">channel</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.commands.html">commands</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.interactions.html">interactions</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.logging.html">logging</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.members.html">members</a></li> +<li class="toctree-l3"><a class="reference internal" href="botcore.utils.regex.html">regex</a></li> +<li class="toctree-l3 current current-page"><a class="current reference internal" href="#">scheduling</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="botcore.async_stats.html">async_stats</a></li> +<li class="toctree-l2"><a class="reference internal" href="botcore.site_api.html">site_api</a></li> +</ul> +</li> +</ul> +<p class="caption" role="heading"><span class="caption-text">Other:</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../development.html">Local Development & Testing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> +</ul> + + + + + <ul> + <li class="toctree-l1 has-children "> + + <a class="reference internal" href="../versions.html">Versions</a> + <input class="toctree-checkbox" id="toctree-checkbox-versions" name="toctree-checkbox-versions" role="switch" type="checkbox"> + <label for="toctree-checkbox-versions"> + <div class="visually-hidden">Toggle child pages in navigation</div> + <i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i> + </label> + + + <ul> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../main/output/botcore.utils.scheduling.html">main</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.4/output/botcore.utils.scheduling.html">v8.0.0-beta.4</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.3/output/botcore.utils.scheduling.html">v8.0.0-beta.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.2/output/botcore.utils.scheduling.html">v8.0.0-beta.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v8.0.0-beta.1/output/botcore.utils.scheduling.html">v8.0.0-beta.1</a> + </li> + + <li class="toctree-l2 current-page"> + <a class="version_link reference internal" href="botcore.utils.scheduling.html">v8.0.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.5.0/output/botcore.utils.scheduling.html">v7.5.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0-beta1/output/botcore.utils.scheduling.html">v7.4.0-beta1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.4.0/output/botcore.utils.scheduling.html">v7.4.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.1/output/botcore.utils.scheduling.html">v7.3.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.3.0/output/botcore.utils.scheduling.html">v7.3.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.2/output/botcore.utils.scheduling.html">v7.2.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.1/output/botcore.utils.scheduling.html">v7.2.1</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.2.0/output/botcore.utils.scheduling.html">v7.2.0</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.3/output/botcore.utils.scheduling.html">v7.1.3</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.2/output/botcore.utils.scheduling.html">v7.1.2</a> + </li> + + <li class="toctree-l2 "> + <a class="version_link reference internal" href="../../v7.1.1/output/botcore.utils.scheduling.html">v7.1.1</a> + </li> + + + <script> + // Make sure we keep any hyperlinked resources when switching version + function updateHash() { + for (let tag of document.getElementsByClassName("version_link")) { + // Extract the original URL + let destination = tag.getAttribute("href"); + if (destination.indexOf("#") !== -1) { + destination = destination.slice(0, destination.indexOf("#")); + } + + // Update the url with the current hash + tag.setAttribute("href", destination + document.location.hash); + } + } + + updateHash(); + addEventListener("hashchange", _ => { updateHash() }); + </script> + </ul> + </li> + </ul> + +</div> +</div> + + </div> + + </div> + </aside> + <div class="main"> + <div class="content"> + <div class="article-container"> + <a href="#" class="back-to-top muted-link"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> + <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> + </svg> + <span>Back to top</span> + </a> + <div class="content-icon-container"> + <div class="theme-toggle-container theme-toggle-content"> + <button class="theme-toggle"> + <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> + <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg> + <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> + <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> + </button> + </div> + <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> + <div class="visually-hidden">Toggle table of contents sidebar</div> + <i class="icon"><svg><use href="#svg-toc"></use></svg></i> + </label> + </div> + <article role="main"> + <section id="module-botcore.utils.scheduling"> +<span id="scheduling"></span><h1>scheduling<a class="headerlink" href="#module-botcore.utils.scheduling" title="Permalink to this heading">#</a></h1> +<p>Generic python scheduler.</p> +<dl class="py class"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler"> +<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Scheduler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L14-L210"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler" title="Permalink to this definition">#</a></dt> +<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p> +<p>Schedule the execution of coroutines and keep track of them.</p> +<p>When instantiating a <a class="reference internal" href="#botcore.utils.scheduling.Scheduler" title="botcore.utils.scheduling.Scheduler"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Scheduler</span></code></a>, a name must be provided. This name is used to distinguish the +instance’s log messages from other instances. Using the name of the class or module containing +the instance is suggested.</p> +<p>Coroutines can be scheduled immediately with <a class="reference internal" href="#botcore.utils.scheduling.Scheduler.schedule" title="botcore.utils.scheduling.Scheduler.schedule"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schedule</span></code></a> or in the future with <a class="reference internal" href="#botcore.utils.scheduling.Scheduler.schedule_at" title="botcore.utils.scheduling.Scheduler.schedule_at"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schedule_at</span></code></a> +or <a class="reference internal" href="#botcore.utils.scheduling.Scheduler.schedule_later" title="botcore.utils.scheduling.Scheduler.schedule_later"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schedule_later</span></code></a>. A unique ID is required to be given in order to keep track of the +resulting Tasks. Any scheduled task can be cancelled prematurely using <a class="reference internal" href="#botcore.utils.scheduling.Scheduler.cancel" title="botcore.utils.scheduling.Scheduler.cancel"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cancel</span></code></a> by providing +the same ID used to schedule it.</p> +<p>The <code class="docutils literal notranslate"><span class="pre">in</span></code> operator is supported for checking if a task with a given ID is currently scheduled.</p> +<p>Any exception raised in a scheduled task is logged when the task is done.</p> +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.__contains__"> +<span class="sig-name descname"><span class="pre">__contains__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_id</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L44-L55"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.__contains__" title="Permalink to this definition">#</a></dt> +<dd><p>Return <a class="reference external" href="https://docs.python.org/3/library/constants.html#True" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code></a> if a task with the given <code class="docutils literal notranslate"><span class="pre">task_id</span></code> is currently scheduled.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>task_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Hashable" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Hashable</span></code></a>) – The task to look for.</p> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p> +</dd> +<dt class="field-odd">Returns<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#True" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code></a> if the task was found.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.__init__"> +<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L32-L43"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.__init__" title="Permalink to this definition">#</a></dt> +<dd><p>Initialize a new <a class="reference internal" href="#botcore.utils.scheduling.Scheduler" title="botcore.utils.scheduling.Scheduler"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Scheduler</span></code></a> instance.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the <a class="reference internal" href="#botcore.utils.scheduling.Scheduler" title="botcore.utils.scheduling.Scheduler"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Scheduler</span></code></a>. Used in logging, and namespacing.</p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.cancel"> +<span class="sig-name descname"><span class="pre">cancel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_id</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L126-L143"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.cancel" title="Permalink to this definition">#</a></dt> +<dd><p>Unschedule the task identified by <code class="docutils literal notranslate"><span class="pre">task_id</span></code>. Log a warning if the task doesn’t exist.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><p><strong>task_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Hashable" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Hashable</span></code></a>) – The task’s unique ID.</p> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.cancel_all"> +<span class="sig-name descname"><span class="pre">cancel_all</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L144-L150"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.cancel_all" title="Permalink to this definition">#</a></dt> +<dd><p>Unschedule all known tasks.</p> +<dl class="field-list simple"> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.schedule"> +<span class="sig-name descname"><span class="pre">schedule</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coroutine</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L56-L82"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.schedule" title="Permalink to this definition">#</a></dt> +<dd><p>Schedule the execution of a <code class="docutils literal notranslate"><span class="pre">coroutine</span></code>.</p> +<p>If a task with <code class="docutils literal notranslate"><span class="pre">task_id</span></code> already exists, close <code class="docutils literal notranslate"><span class="pre">coroutine</span></code> instead of scheduling it. This +prevents unawaited coroutine warnings. Don’t pass a coroutine that’ll be re-used elsewhere.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>task_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Hashable" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Hashable</span></code></a>) – A unique ID to create the task with.</p></li> +<li><p><strong>coroutine</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Coroutine" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Coroutine</span></code></a>) – The function to be called.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.schedule_at"> +<span class="sig-name descname"><span class="pre">schedule_at</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">time</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">task_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coroutine</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L83-L106"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.schedule_at" title="Permalink to this definition">#</a></dt> +<dd><p>Schedule <code class="docutils literal notranslate"><span class="pre">coroutine</span></code> to be executed at the given <code class="docutils literal notranslate"><span class="pre">time</span></code>.</p> +<p>If <code class="docutils literal notranslate"><span class="pre">time</span></code> is timezone aware, then use that timezone to calculate now() when subtracting. +If <code class="docutils literal notranslate"><span class="pre">time</span></code> is naïve, then use UTC.</p> +<p>If <code class="docutils literal notranslate"><span class="pre">time</span></code> is in the past, schedule <code class="docutils literal notranslate"><span class="pre">coroutine</span></code> immediately.</p> +<p>If a task with <code class="docutils literal notranslate"><span class="pre">task_id</span></code> already exists, close <code class="docutils literal notranslate"><span class="pre">coroutine</span></code> instead of scheduling it. This +prevents unawaited coroutine warnings. Don’t pass a coroutine that’ll be re-used elsewhere.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>time</strong> (<a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime</span></code></a>) – The time to start the task.</p></li> +<li><p><strong>task_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Hashable" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Hashable</span></code></a>) – A unique ID to create the task with.</p></li> +<li><p><strong>coroutine</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Coroutine" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Coroutine</span></code></a>) – The function to be called.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +<dl class="py method"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.Scheduler.schedule_later"> +<span class="sig-name descname"><span class="pre">schedule_later</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">delay</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">task_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coroutine</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L107-L125"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.Scheduler.schedule_later" title="Permalink to this definition">#</a></dt> +<dd><p>Schedule <code class="docutils literal notranslate"><span class="pre">coroutine</span></code> to be executed after <code class="docutils literal notranslate"><span class="pre">delay</span></code> seconds.</p> +<p>If a task with <code class="docutils literal notranslate"><span class="pre">task_id</span></code> already exists, close <code class="docutils literal notranslate"><span class="pre">coroutine</span></code> instead of scheduling it. This +prevents unawaited coroutine warnings. Don’t pass a coroutine that’ll be re-used elsewhere.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>delay</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – How long to wait before starting the task.</p></li> +<li><p><strong>task_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Hashable" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Hashable</span></code></a>) – A unique ID to create the task with.</p></li> +<li><p><strong>coroutine</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Coroutine" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Coroutine</span></code></a>) – The function to be called.</p></li> +</ul> +</dd> +<dt class="field-even">Return type<span class="colon">:</span></dt> +<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a></p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="py function"> +<dt class="sig sig-object py" id="botcore.utils.scheduling.create_task"> +<span class="sig-name descname"><span class="pre">create_task</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coro</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">suppressed_exceptions</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">event_loop</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/python-discord/bot-core/blob/db0ff48a574f5b466f3e8dc25cc32c3a9bfc1370/botcore/utils/scheduling.py#L215-L243"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#botcore.utils.scheduling.create_task" title="Permalink to this definition">#</a></dt> +<dd><p>Wrapper for creating an <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#asyncio.Task" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">asyncio.Task</span></code></a> which logs exceptions raised in the task.</p> +<p>If the <code class="docutils literal notranslate"><span class="pre">event_loop</span></code> kwarg is provided, the task is created from that event loop, +otherwise the running loop is used.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters<span class="colon">:</span></dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Coroutine" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Coroutine</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.TypeVar" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeVar</span></code></a>(<code class="docutils literal notranslate"><span class="pre">TASK_RETURN</span></code>)]) – The function to call.</p></li> +<li><p><strong>suppressed_exceptions</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#type" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/constants.html#Ellipsis" title="(in Python v3.10)"><code class="xref py py-data docutils literal notranslate"><span class="pre">...</span></code></a>]) – Exceptions to be handled by the task.</p></li> +<li><p><strong>event_loop</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop" title="(in Python v3.10)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">asyncio.AbstractEventLoop</span></code></a>) – The loop to create the task from.</p></li> +<li><p><strong>kwargs</strong> – Passed to <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task" title="(in Python v3.10)"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.create_task()</span></code></a>.</p></li> +</ul> +</dd> +<dt class="field-even">Returns<span class="colon">:</span></dt> +<dd class="field-even"><p>The wrapped task.</p> +</dd> +<dt class="field-odd">Return type<span class="colon">:</span></dt> +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#asyncio.Task" title="(in Python v3.10)">asyncio.Task</a></p> +</dd> +</dl> +</dd></dl> + +</section> + + </article> + </div> + <footer> + + <div class="related-pages"> + <a class="next-page" href="botcore.async_stats.html"> + <div class="page-info"> + <div class="context"> + <span>Next</span> + </div> + <div class="title">async_stats</div> + </div> + <svg><use href="#svg-arrow-right"></use></svg> + </a> + <a class="prev-page" href="botcore.utils.regex.html"> + <svg><use href="#svg-arrow-right"></use></svg> + <div class="page-info"> + <div class="context"> + <span>Previous</span> + </div> + + <div class="title">regex</div> + + </div> + </a> + </div> + <div class="bottom-of-page"> + <div class="left-details"> + <div class="copyright"> + Copyright © 2021, Python Discord + </div> + Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s + + <a href="https://github.com/pradyunsg/furo">Furo</a> + + </div> + <div class="right-details"> + <div class="icons"> + + </div> + </div> + </div> + + </footer> + </div> + <aside class="toc-drawer no-toc"> + + + + </aside> + </div> +</div><script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> + <script src="../_static/jquery.js"></script> + <script src="../_static/underscore.js"></script> + <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> + <script src="../_static/doctools.js"></script> + <script src="../_static/scripts/furo.js"></script> + <script src="../_static/changelog.js"></script> + </body> +</html>
\ No newline at end of file |