Sort event references by categories

This commit is contained in:
Chiggy-Playz
2021-10-03 16:18:46 +05:30
parent 3260ec6643
commit 16b7cdc488
85 changed files with 85331 additions and 571 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,282 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cogs</title>
<!-- end extra head -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css" />
<link rel="stylesheet" href="../../_static/style.css" type="text/css" />
<link rel="stylesheet" href="../../_static/codeblocks.css" type="text/css" />
<link rel="stylesheet" href="../../_static/icons.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<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/doctools.js"></script>
<script src="../../_static/custom.js"></script>
<script src="../../_static/settings.js"></script>
<script src="../../_static/copy.js"></script>
<script src="../../_static/sidebar.js"></script>
<link rel="shortcut icon" href="../../_static/discord_py_logo.ico"/>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Extensions" href="extensions.html" />
<link rel="prev" title="Commands" href="commands.html" />
</head>
<body>
<div class="main-grid">
<header class="grid-item">
<nav>
<a href="../../index.html" class="main-heading">discord.py</a>
<a href="https://github.com/Rapptz/discord.py" title="GitHub"><span class="material-icons custom-icons">github</span></a>
<a href="https://discord.gg/TvqYBrGXEm" title="Discord"><span class="material-icons custom-icons">discord</span></a>
<a href="../../faq.html" title="FAQ"><span class="material-icons">help_center</span></a>
<a onclick="mobileSearch.open();" title="Search" id="open-search" class="mobile-only"><span class="material-icons">search</span></a>
<a onclick="mobileSearch.close();" title="Close" id="close-search" class="mobile-only" hidden><span class="material-icons">close</span></a>
</nav>
<nav class="mobile-only">
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
</nav>
</header>
<div class="sub-header grid-item">
<label for="documentation_select">View Documentation For</label>
<select id="documentation_select" onchange="window.location = this.value;">
<option value="../../index.html">discord</option>
<option value="index.html" selected>discord.ext.commands</option>
<option value="../tasks/index.html" >discord.ext.tasks</option>
</select>
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
<a accesskey="S" class="settings" onclick="settingsModal.open();"><span class="material-icons">settings</span></a>
</div>
<aside class="grid-item">
<span id="hamburger-toggle">
<span class="material-icons">menu</span>
</span>
<span id="settings-toggle" class="settings" onclick="settingsModal.open();">
<span class="material-icons">settings</span>
</span>
<div id="sidebar">
<h3><a href="../../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Cogs</a><ul>
<li><a class="reference internal" href="#quick-example">Quick Example</a></li>
<li><a class="reference internal" href="#cog-registration">Cog Registration</a></li>
<li><a class="reference internal" href="#using-cogs">Using Cogs</a></li>
<li><a class="reference internal" href="#special-methods">Special Methods</a></li>
<li><a class="reference internal" href="#meta-options">Meta Options</a></li>
<li><a class="reference internal" href="#inspection">Inspection</a></li>
</ul>
</li>
</ul>
</div>
</aside>
<main class="grid-item" role="main">
<section id="cogs">
<span id="ext-commands-cogs"></span><h1>Cogs<a class="headerlink" href="#cogs" title="Permalink to this headline"></a></h1>
<p>There comes a point in your bots development when you want to organize a collection of commands, listeners, and some state into one class. Cogs allow you to do just that.</p>
<p>The gist:</p>
<ul class="simple">
<li><p>Each cog is a Python class that subclasses <a class="reference internal" href="api.html#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">commands.Cog</span></code></a>.</p></li>
<li><p>Every command is marked with the <a class="reference internal" href="api.html#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">commands.command()</span></code></a> decorator.</p></li>
<li><p>Every listener is marked with the <a class="reference internal" href="api.html#discord.ext.commands.Cog.listener" title="discord.ext.commands.Cog.listener"><code class="xref py py-meth docutils literal notranslate"><span class="pre">commands.Cog.listener()</span></code></a> decorator.</p></li>
<li><p>Cogs are then registered with the <a class="reference internal" href="api.html#discord.ext.commands.Bot.add_cog" title="discord.ext.commands.Bot.add_cog"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.add_cog()</span></code></a> call.</p></li>
<li><p>Cogs are subsequently removed with the <a class="reference internal" href="api.html#discord.ext.commands.Bot.remove_cog" title="discord.ext.commands.Bot.remove_cog"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.remove_cog()</span></code></a> call.</p></li>
</ul>
<p>It should be noted that cogs are typically used alongside with <a class="reference internal" href="extensions.html#ext-commands-extensions"><span class="std std-ref">Extensions</span></a>.</p>
<section id="quick-example">
<h2>Quick Example<a class="headerlink" href="#quick-example" title="Permalink to this headline"></a></h2>
<p>This example cog defines a <code class="docutils literal notranslate"><span class="pre">Greetings</span></code> category for your commands, with a single <a class="reference internal" href="commands.html#ext-commands-commands"><span class="std std-ref">command</span></a> named <code class="docutils literal notranslate"><span class="pre">hello</span></code> as well as a listener to listen to an <a class="reference internal" href="../../api.html#discord-api-events"><span class="std std-ref">Event</span></a>.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Greetings</span><span class="p">(</span><span class="n">commands</span><span class="o">.</span><span class="n">Cog</span><span class="p">):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bot</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">bot</span> <span class="o">=</span> <span class="n">bot</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_last_member</span> <span class="o">=</span> <span class="kc">None</span>
<span class="nd">@commands</span><span class="o">.</span><span class="n">Cog</span><span class="o">.</span><span class="n">listener</span><span class="p">()</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_member_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">member</span><span class="p">):</span>
<span class="n">channel</span> <span class="o">=</span> <span class="n">member</span><span class="o">.</span><span class="n">guild</span><span class="o">.</span><span class="n">system_channel</span>
<span class="k">if</span> <span class="n">channel</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">await</span> <span class="n">channel</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Welcome </span><span class="si">{</span><span class="n">member</span><span class="o">.</span><span class="n">mention</span><span class="si">}</span><span class="s1">.&#39;</span><span class="p">)</span>
<span class="nd">@commands</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">hello</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">member</span><span class="p">:</span> <span class="n">discord</span><span class="o">.</span><span class="n">Member</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Says hello&quot;&quot;&quot;</span>
<span class="n">member</span> <span class="o">=</span> <span class="n">member</span> <span class="ow">or</span> <span class="n">ctx</span><span class="o">.</span><span class="n">author</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_member</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_member</span><span class="o">.</span><span class="n">id</span> <span class="o">!=</span> <span class="n">member</span><span class="o">.</span><span class="n">id</span><span class="p">:</span>
<span class="k">await</span> <span class="n">ctx</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Hello </span><span class="si">{</span><span class="n">member</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s1">~&#39;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">await</span> <span class="n">ctx</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Hello </span><span class="si">{</span><span class="n">member</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s1">... This feels familiar.&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_last_member</span> <span class="o">=</span> <span class="n">member</span>
</pre></div>
</div>
<p>A couple of technical notes to take into consideration:</p>
<ul class="simple">
<li><p>All listeners must be explicitly marked via decorator, <a class="reference internal" href="api.html#discord.ext.commands.Cog.listener" title="discord.ext.commands.Cog.listener"><code class="xref py py-meth docutils literal notranslate"><span class="pre">listener()</span></code></a>.</p></li>
<li><p>The name of the cog is automatically derived from the class name but can be overridden. See <a class="reference internal" href="#ext-commands-cogs-meta-options"><span class="std std-ref">Meta Options</span></a>.</p></li>
<li><p>All commands must now take a <code class="docutils literal notranslate"><span class="pre">self</span></code> parameter to allow usage of instance attributes that can be used to maintain state.</p></li>
</ul>
</section>
<section id="cog-registration">
<h2>Cog Registration<a class="headerlink" href="#cog-registration" title="Permalink to this headline"></a></h2>
<p>Once you have defined your cogs, you need to tell the bot to register the cogs to be used. We do this via the <a class="reference internal" href="api.html#discord.ext.commands.Bot.add_cog" title="discord.ext.commands.Bot.add_cog"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_cog()</span></code></a> method.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">bot</span><span class="o">.</span><span class="n">add_cog</span><span class="p">(</span><span class="n">Greetings</span><span class="p">(</span><span class="n">bot</span><span class="p">))</span>
</pre></div>
</div>
<p>This binds the cog to the bot, adding all commands and listeners to the bot automatically.</p>
<p>Note that we reference the cog by name, which we can override through <a class="reference internal" href="#ext-commands-cogs-meta-options"><span class="std std-ref">Meta Options</span></a>. So if we ever want to remove the cog eventually, we would have to do the following.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">bot</span><span class="o">.</span><span class="n">remove_cog</span><span class="p">(</span><span class="s1">&#39;Greetings&#39;</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="using-cogs">
<h2>Using Cogs<a class="headerlink" href="#using-cogs" title="Permalink to this headline"></a></h2>
<p>Just as we remove a cog by its name, we can also retrieve it by its name as well. This allows us to use a cog as an inter-command communication protocol to share data. For example:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Economy</span><span class="p">(</span><span class="n">commands</span><span class="o">.</span><span class="n">Cog</span><span class="p">):</span>
<span class="o">...</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">withdraw_money</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">member</span><span class="p">,</span> <span class="n">money</span><span class="p">):</span>
<span class="c1"># implementation here</span>
<span class="o">...</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">deposit_money</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">member</span><span class="p">,</span> <span class="n">money</span><span class="p">):</span>
<span class="c1"># implementation here</span>
<span class="o">...</span>
<span class="k">class</span> <span class="nc">Gambling</span><span class="p">(</span><span class="n">commands</span><span class="o">.</span><span class="n">Cog</span><span class="p">):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bot</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">bot</span> <span class="o">=</span> <span class="n">bot</span>
<span class="k">def</span> <span class="nf">coinflip</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="nd">@commands</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">gamble</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">,</span> <span class="n">money</span><span class="p">:</span> <span class="nb">int</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Gambles some money.&quot;&quot;&quot;</span>
<span class="hll"> <span class="n">economy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bot</span><span class="o">.</span><span class="n">get_cog</span><span class="p">(</span><span class="s1">&#39;Economy&#39;</span><span class="p">)</span>
</span> <span class="k">if</span> <span class="n">economy</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="hll"> <span class="k">await</span> <span class="n">economy</span><span class="o">.</span><span class="n">withdraw_money</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">author</span><span class="p">,</span> <span class="n">money</span><span class="p">)</span>
</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">coinflip</span><span class="p">()</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">await</span> <span class="n">economy</span><span class="o">.</span><span class="n">deposit_money</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">author</span><span class="p">,</span> <span class="n">money</span> <span class="o">*</span> <span class="mf">1.5</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="special-methods">
<span id="ext-commands-cogs-special-methods"></span><h2>Special Methods<a class="headerlink" href="#special-methods" title="Permalink to this headline"></a></h2>
<p>As cogs get more complicated and have more commands, there comes a point where we want to customise the behaviour of the entire cog or bot.</p>
<p>They are as follows:</p>
<ul class="simple">
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.cog_unload" title="discord.ext.commands.Cog.cog_unload"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.cog_unload()</span></code></a></p></li>
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.cog_check" title="discord.ext.commands.Cog.cog_check"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.cog_check()</span></code></a></p></li>
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.cog_command_error" title="discord.ext.commands.Cog.cog_command_error"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.cog_command_error()</span></code></a></p></li>
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.cog_before_invoke" title="discord.ext.commands.Cog.cog_before_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.cog_before_invoke()</span></code></a></p></li>
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.cog_after_invoke" title="discord.ext.commands.Cog.cog_after_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.cog_after_invoke()</span></code></a></p></li>
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.bot_check" title="discord.ext.commands.Cog.bot_check"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.bot_check()</span></code></a></p></li>
<li><p><a class="reference internal" href="api.html#discord.ext.commands.Cog.bot_check_once" title="discord.ext.commands.Cog.bot_check_once"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.bot_check_once()</span></code></a></p></li>
</ul>
<p>You can visit the reference to get more detail.</p>
</section>
<section id="meta-options">
<span id="ext-commands-cogs-meta-options"></span><h2>Meta Options<a class="headerlink" href="#meta-options" title="Permalink to this headline"></a></h2>
<p>At the heart of a cog resides a metaclass, <a class="reference internal" href="api.html#discord.ext.commands.CogMeta" title="discord.ext.commands.CogMeta"><code class="xref py py-class docutils literal notranslate"><span class="pre">commands.CogMeta</span></code></a>, which can take various options to customise some of the behaviour. To do this, we pass keyword arguments to the class definition line. For example, to change the cog name we can pass the <code class="docutils literal notranslate"><span class="pre">name</span></code> keyword argument as follows:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyCog</span><span class="p">(</span><span class="n">commands</span><span class="o">.</span><span class="n">Cog</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;My Cog&#39;</span><span class="p">):</span>
<span class="k">pass</span>
</pre></div>
</div>
<p>To see more options that you can set, see the documentation of <a class="reference internal" href="api.html#discord.ext.commands.CogMeta" title="discord.ext.commands.CogMeta"><code class="xref py py-class docutils literal notranslate"><span class="pre">commands.CogMeta</span></code></a>.</p>
</section>
<section id="inspection">
<h2>Inspection<a class="headerlink" href="#inspection" title="Permalink to this headline"></a></h2>
<p>Since cogs ultimately are classes, we have some tools to help us inspect certain properties of the cog.</p>
<p>To get a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of commands, we can use <a class="reference internal" href="api.html#discord.ext.commands.Cog.get_commands" title="discord.ext.commands.Cog.get_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.get_commands()</span></code></a>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">cog</span> <span class="o">=</span> <span class="n">bot</span><span class="o">.</span><span class="n">get_cog</span><span class="p">(</span><span class="s1">&#39;Greetings&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">commands</span> <span class="o">=</span> <span class="n">cog</span><span class="o">.</span><span class="n">get_commands</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">([</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">commands</span><span class="p">])</span>
</pre></div>
</div>
<p>If we want to get the subcommands as well, we can use the <a class="reference internal" href="api.html#discord.ext.commands.Cog.walk_commands" title="discord.ext.commands.Cog.walk_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.walk_commands()</span></code></a> generator.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">([</span><span class="n">c</span><span class="o">.</span><span class="n">qualified_name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">cog</span><span class="o">.</span><span class="n">walk_commands</span><span class="p">()])</span>
</pre></div>
</div>
<p>To do the same with listeners, we can query them with <a class="reference internal" href="api.html#discord.ext.commands.Cog.get_listeners" title="discord.ext.commands.Cog.get_listeners"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Cog.get_listeners()</span></code></a>. This returns a list of tuples the first element being the listener name and the second one being the actual function itself.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">func</span> <span class="ow">in</span> <span class="n">cog</span><span class="o">.</span><span class="n">get_listeners</span><span class="p">():</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="s1">&#39;-&gt;&#39;</span><span class="p">,</span> <span class="n">func</span><span class="p">)</span>
</pre></div>
</div>
</section>
</section>
</main>
<footer class="grid-item">
&#169; Copyright 2015-present, Rapptz.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
</footer>
</div>
<div id="settings" class="modal" onclick="if (event.target == this){ settingsModal.close(); }" hidden>
<div class="modal-content">
<span class="close" onclick="settingsModal.close();" title="Close">
<span class="material-icons">close</span>
</span>
<h1>Settings</h1>
<h2>Font</h2>
<div class="setting">
<h3>Use a serif font:
<label class="toggle"
title="Use a serif font? Your system font will be used, falling back to serif.">
<input type="checkbox" name="useSerifFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
<h2>Theme</h2>
<div class="setting">
<h3>
<label class="toggle" title="Set your theme based on your system preferences">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="automatic" checked>
</label>
Automatic
</h3>
<h3>
<label class="toggle" title="Set your theme to light theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="light">
</label>
Light
</h3>
<h3>
<label class="toggle" title="Set your theme to dark theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="dark">
</label>
Dark
</h3>
</div>
</div>
</div>
<div id="to-top" onclick="scrollToTop()" hidden>
<span><span class="material-icons">arrow_upward</span> to top</span>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,200 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Extensions</title>
<!-- end extra head -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css" />
<link rel="stylesheet" href="../../_static/style.css" type="text/css" />
<link rel="stylesheet" href="../../_static/codeblocks.css" type="text/css" />
<link rel="stylesheet" href="../../_static/icons.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<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/doctools.js"></script>
<script src="../../_static/custom.js"></script>
<script src="../../_static/settings.js"></script>
<script src="../../_static/copy.js"></script>
<script src="../../_static/sidebar.js"></script>
<link rel="shortcut icon" href="../../_static/discord_py_logo.ico"/>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Slash Commands" href="slash-commands.html" />
<link rel="prev" title="Cogs" href="cogs.html" />
</head>
<body>
<div class="main-grid">
<header class="grid-item">
<nav>
<a href="../../index.html" class="main-heading">discord.py</a>
<a href="https://github.com/Rapptz/discord.py" title="GitHub"><span class="material-icons custom-icons">github</span></a>
<a href="https://discord.gg/TvqYBrGXEm" title="Discord"><span class="material-icons custom-icons">discord</span></a>
<a href="../../faq.html" title="FAQ"><span class="material-icons">help_center</span></a>
<a onclick="mobileSearch.open();" title="Search" id="open-search" class="mobile-only"><span class="material-icons">search</span></a>
<a onclick="mobileSearch.close();" title="Close" id="close-search" class="mobile-only" hidden><span class="material-icons">close</span></a>
</nav>
<nav class="mobile-only">
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
</nav>
</header>
<div class="sub-header grid-item">
<label for="documentation_select">View Documentation For</label>
<select id="documentation_select" onchange="window.location = this.value;">
<option value="../../index.html">discord</option>
<option value="index.html" selected>discord.ext.commands</option>
<option value="../tasks/index.html" >discord.ext.tasks</option>
</select>
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
<a accesskey="S" class="settings" onclick="settingsModal.open();"><span class="material-icons">settings</span></a>
</div>
<aside class="grid-item">
<span id="hamburger-toggle">
<span class="material-icons">menu</span>
</span>
<span id="settings-toggle" class="settings" onclick="settingsModal.open();">
<span class="material-icons">settings</span>
</span>
<div id="sidebar">
<h3><a href="../../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Extensions</a><ul>
<li><a class="reference internal" href="#primer">Primer</a></li>
<li><a class="reference internal" href="#reloading">Reloading</a></li>
<li><a class="reference internal" href="#cleaning-up">Cleaning Up</a></li>
</ul>
</li>
</ul>
</div>
</aside>
<main class="grid-item" role="main">
<section id="extensions">
<span id="ext-commands-extensions"></span><h1>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline"></a></h1>
<p>There comes a time in the bot development when you want to extend the bot functionality at run-time and quickly unload and reload code (also called hot-reloading). The command framework comes with this ability built-in, with a concept called <strong>extensions</strong>.</p>
<section id="primer">
<h2>Primer<a class="headerlink" href="#primer" title="Permalink to this headline"></a></h2>
<p>An extension at its core is a python file with an entry point called <code class="docutils literal notranslate"><span class="pre">setup</span></code>. This setup must be a plain Python function (not a coroutine). It takes a single parameter the <a class="reference internal" href="api.html#discord.ext.commands.Bot" title="discord.ext.commands.Bot"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bot</span></code></a> that loads the extension.</p>
<p>An example extension looks like this:</p>
<div class="literal-block-wrapper docutils container" id="id1">
<div class="code-block-caption"><span class="caption-text">hello.py</span><a class="headerlink" href="#id1" title="Permalink to this code"></a></div>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">discord.ext</span> <span class="kn">import</span> <span class="n">commands</span>
<span class="nd">@commands</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">hello</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
<span class="k">await</span> <span class="n">ctx</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Hello </span><span class="si">{</span><span class="n">ctx</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">display_name</span><span class="si">}</span><span class="s1">.&#39;</span><span class="p">)</span>
<span class="hll"><span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="n">bot</span><span class="p">):</span>
</span><span class="hll"> <span class="n">bot</span><span class="o">.</span><span class="n">add_command</span><span class="p">(</span><span class="n">hello</span><span class="p">)</span>
</span></pre></div>
</div>
</div>
<p>In this example we define a simple command, and when the extension is loaded this command is added to the bot. Now the final step to this is loading the extension, which we do by calling <a class="reference internal" href="api.html#discord.ext.commands.Bot.load_extension" title="discord.ext.commands.Bot.load_extension"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.load_extension()</span></code></a>. To load this extension we call <code class="docutils literal notranslate"><span class="pre">bot.load_extension('hello')</span></code>.</p>
<div class="helpful admonition">
<p class="admonition-title">Cogs</p>
<p>Extensions are usually used in conjunction with cogs. To read more about them, check out the documentation, <a class="reference internal" href="cogs.html#ext-commands-cogs"><span class="std std-ref">Cogs</span></a>.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Extension paths are ultimately similar to the import mechanism. What this means is that if there is a folder, then it must be dot-qualified. For example to load an extension in <code class="docutils literal notranslate"><span class="pre">plugins/hello.py</span></code> then we use the string <code class="docutils literal notranslate"><span class="pre">plugins.hello</span></code>.</p>
</div>
</section>
<section id="reloading">
<h2>Reloading<a class="headerlink" href="#reloading" title="Permalink to this headline"></a></h2>
<p>When you make a change to the extension and want to reload the references, the library comes with a function to do this for you, <a class="reference internal" href="api.html#discord.ext.commands.Bot.reload_extension" title="discord.ext.commands.Bot.reload_extension"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.reload_extension()</span></code></a>.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">bot</span><span class="o">.</span><span class="n">reload_extension</span><span class="p">(</span><span class="s1">&#39;hello&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Once the extension reloads, any changes that we did will be applied. This is useful if we want to add or remove functionality without restarting our bot. If an error occurred during the reloading process, the bot will pretend as if the reload never happened.</p>
</section>
<section id="cleaning-up">
<h2>Cleaning Up<a class="headerlink" href="#cleaning-up" title="Permalink to this headline"></a></h2>
<p>Although rare, sometimes an extension needs to clean-up or know when its being unloaded. For cases like these, there is another entry point named <code class="docutils literal notranslate"><span class="pre">teardown</span></code> which is similar to <code class="docutils literal notranslate"><span class="pre">setup</span></code> except called when the extension is unloaded.</p>
<div class="literal-block-wrapper docutils container" id="id2">
<div class="code-block-caption"><span class="caption-text">basic_ext.py</span><a class="headerlink" href="#id2" title="Permalink to this code"></a></div>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="n">bot</span><span class="p">):</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;I am being loaded!&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">teardown</span><span class="p">(</span><span class="n">bot</span><span class="p">):</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;I am being unloaded!&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</section>
</section>
</main>
<footer class="grid-item">
&#169; Copyright 2015-present, Rapptz.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
</footer>
</div>
<div id="settings" class="modal" onclick="if (event.target == this){ settingsModal.close(); }" hidden>
<div class="modal-content">
<span class="close" onclick="settingsModal.close();" title="Close">
<span class="material-icons">close</span>
</span>
<h1>Settings</h1>
<h2>Font</h2>
<div class="setting">
<h3>Use a serif font:
<label class="toggle"
title="Use a serif font? Your system font will be used, falling back to serif.">
<input type="checkbox" name="useSerifFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
<h2>Theme</h2>
<div class="setting">
<h3>
<label class="toggle" title="Set your theme based on your system preferences">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="automatic" checked>
</label>
Automatic
</h3>
<h3>
<label class="toggle" title="Set your theme to light theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="light">
</label>
Light
</h3>
<h3>
<label class="toggle" title="Set your theme to dark theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="dark">
</label>
Dark
</h3>
</div>
</div>
</div>
<div id="to-top" onclick="scrollToTop()" hidden>
<span><span class="material-icons">arrow_upward</span> to top</span>
</div>
</body>
</html>

View File

@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>discord.ext.commands Bot commands framework</title>
<!-- end extra head -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css" />
<link rel="stylesheet" href="../../_static/style.css" type="text/css" />
<link rel="stylesheet" href="../../_static/codeblocks.css" type="text/css" />
<link rel="stylesheet" href="../../_static/icons.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<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/doctools.js"></script>
<script src="../../_static/custom.js"></script>
<script src="../../_static/settings.js"></script>
<script src="../../_static/copy.js"></script>
<script src="../../_static/sidebar.js"></script>
<link rel="shortcut icon" href="../../_static/discord_py_logo.ico"/>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Commands" href="commands.html" />
<link rel="prev" title="Welcome to discord.py" href="../../index.html" />
</head>
<body>
<div class="main-grid">
<header class="grid-item">
<nav>
<a href="../../index.html" class="main-heading">discord.py</a>
<a href="https://github.com/Rapptz/discord.py" title="GitHub"><span class="material-icons custom-icons">github</span></a>
<a href="https://discord.gg/TvqYBrGXEm" title="Discord"><span class="material-icons custom-icons">discord</span></a>
<a href="../../faq.html" title="FAQ"><span class="material-icons">help_center</span></a>
<a onclick="mobileSearch.open();" title="Search" id="open-search" class="mobile-only"><span class="material-icons">search</span></a>
<a onclick="mobileSearch.close();" title="Close" id="close-search" class="mobile-only" hidden><span class="material-icons">close</span></a>
</nav>
<nav class="mobile-only">
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
</nav>
</header>
<div class="sub-header grid-item">
<label for="documentation_select">View Documentation For</label>
<select id="documentation_select" onchange="window.location = this.value;">
<option value="../../index.html">discord</option>
<option value="#" selected>discord.ext.commands</option>
<option value="../tasks/index.html" >discord.ext.tasks</option>
</select>
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
<a accesskey="S" class="settings" onclick="settingsModal.open();"><span class="material-icons">settings</span></a>
</div>
<aside class="grid-item">
<span id="settings-toggle" class="settings" onclick="settingsModal.open();">
<span class="material-icons">settings</span>
</span>
<div id="sidebar">
</div>
</aside>
<main class="grid-item" role="main">
<section id="discord-ext-commands-bot-commands-framework">
<span id="discord-ext-commands"></span><h1><code class="docutils literal notranslate"><span class="pre">discord.ext.commands</span></code> Bot commands framework<a class="headerlink" href="#discord-ext-commands-bot-commands-framework" title="Permalink to this headline"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">discord.py</span></code> offers a lower level aspect on interacting with Discord. Often times, the library is used for the creation of
bots. However this task can be daunting and confusing to get correctly the first time. Many times there comes a repetition in
creating a bot command framework that is extensible, flexible, and powerful. For this reason, <code class="docutils literal notranslate"><span class="pre">discord.py</span></code> comes with an
extension library that handles this for you.</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a><ul>
<li class="toctree-l2"><a class="reference internal" href="commands.html#parameters">Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#invocation-context">Invocation Context</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#converters">Converters</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#error-handling">Error Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#checks">Checks</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cogs.html">Cogs</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cogs.html#quick-example">Quick Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="cogs.html#cog-registration">Cog Registration</a></li>
<li class="toctree-l2"><a class="reference internal" href="cogs.html#using-cogs">Using Cogs</a></li>
<li class="toctree-l2"><a class="reference internal" href="cogs.html#special-methods">Special Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="cogs.html#meta-options">Meta Options</a></li>
<li class="toctree-l2"><a class="reference internal" href="cogs.html#inspection">Inspection</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="extensions.html">Extensions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#primer">Primer</a></li>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#reloading">Reloading</a></li>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#cleaning-up">Cleaning Up</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="slash-commands.html">Slash Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api.html#bots">Bots</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#prefix-helpers">Prefix Helpers</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#event-reference">Event Reference</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#commands">Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#cogs">Cogs</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#help-commands">Help Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#enums">Enums</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#checks">Checks</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#cooldown">Cooldown</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#context">Context</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#converters">Converters</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#exceptions">Exceptions</a></li>
</ul>
</li>
</ul>
</div>
</section>
</main>
<footer class="grid-item">
&#169; Copyright 2015-present, Rapptz.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
</footer>
</div>
<div id="settings" class="modal" onclick="if (event.target == this){ settingsModal.close(); }" hidden>
<div class="modal-content">
<span class="close" onclick="settingsModal.close();" title="Close">
<span class="material-icons">close</span>
</span>
<h1>Settings</h1>
<h2>Font</h2>
<div class="setting">
<h3>Use a serif font:
<label class="toggle"
title="Use a serif font? Your system font will be used, falling back to serif.">
<input type="checkbox" name="useSerifFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
<h2>Theme</h2>
<div class="setting">
<h3>
<label class="toggle" title="Set your theme based on your system preferences">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="automatic" checked>
</label>
Automatic
</h3>
<h3>
<label class="toggle" title="Set your theme to light theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="light">
</label>
Light
</h3>
<h3>
<label class="toggle" title="Set your theme to dark theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="dark">
</label>
Dark
</h3>
</div>
</div>
</div>
<div id="to-top" onclick="scrollToTop()" hidden>
<span><span class="material-icons">arrow_upward</span> to top</span>
</div>
</body>
</html>

View File

@@ -0,0 +1,149 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Slash Commands</title>
<!-- end extra head -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css" />
<link rel="stylesheet" href="../../_static/style.css" type="text/css" />
<link rel="stylesheet" href="../../_static/codeblocks.css" type="text/css" />
<link rel="stylesheet" href="../../_static/icons.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<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/doctools.js"></script>
<script src="../../_static/custom.js"></script>
<script src="../../_static/settings.js"></script>
<script src="../../_static/copy.js"></script>
<script src="../../_static/sidebar.js"></script>
<link rel="shortcut icon" href="../../_static/discord_py_logo.ico"/>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="API Reference" href="api.html" />
<link rel="prev" title="Extensions" href="extensions.html" />
</head>
<body>
<div class="main-grid">
<header class="grid-item">
<nav>
<a href="../../index.html" class="main-heading">discord.py</a>
<a href="https://github.com/Rapptz/discord.py" title="GitHub"><span class="material-icons custom-icons">github</span></a>
<a href="https://discord.gg/TvqYBrGXEm" title="Discord"><span class="material-icons custom-icons">discord</span></a>
<a href="../../faq.html" title="FAQ"><span class="material-icons">help_center</span></a>
<a onclick="mobileSearch.open();" title="Search" id="open-search" class="mobile-only"><span class="material-icons">search</span></a>
<a onclick="mobileSearch.close();" title="Close" id="close-search" class="mobile-only" hidden><span class="material-icons">close</span></a>
</nav>
<nav class="mobile-only">
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
</nav>
</header>
<div class="sub-header grid-item">
<label for="documentation_select">View Documentation For</label>
<select id="documentation_select" onchange="window.location = this.value;">
<option value="../../index.html">discord</option>
<option value="index.html" selected>discord.ext.commands</option>
<option value="../tasks/index.html" >discord.ext.tasks</option>
</select>
<form role="search" class="search" action="../../search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
<a accesskey="S" class="settings" onclick="settingsModal.open();"><span class="material-icons">settings</span></a>
</div>
<aside class="grid-item">
<span id="settings-toggle" class="settings" onclick="settingsModal.open();">
<span class="material-icons">settings</span>
</span>
<div id="sidebar">
</div>
</aside>
<main class="grid-item" role="main">
<section id="slash-commands">
<span id="ext-commands-slash-commands"></span><h1>Slash Commands<a class="headerlink" href="#slash-commands" title="Permalink to this headline"></a></h1>
<p>Slash Commands are currently supported in enhanced-discord.py using a system on top of ext.commands.</p>
<p>This system is very simple to use, and can be enabled via <a class="reference internal" href="api.html#discord.ext.commands.Bot.slash_commands" title="discord.ext.commands.Bot.slash_commands"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Bot.slash_commands</span></code></a> globally,
or only for specific commands via <a class="reference internal" href="api.html#discord.ext.commands.Command.slash_command" title="discord.ext.commands.Command.slash_command"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.slash_command</span></code></a>.</p>
<p>There is also the parameter <code class="docutils literal notranslate"><span class="pre">slash_command_guilds</span></code> which can be passed to either <a class="reference internal" href="api.html#discord.ext.commands.Bot" title="discord.ext.commands.Bot"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bot</span></code></a> or the command
decorator in order to only upload the commands as guild commands to these specific guild IDs, however this
should only be used for testing or small (&lt;10 guilds) bots.</p>
<p>If you want to add option descriptions to your commands, you should use <a class="reference internal" href="api.html#discord.ext.commands.Option" title="discord.ext.commands.Option"><code class="xref py py-class docutils literal notranslate"><span class="pre">Option</span></code></a></p>
<p>For troubleshooting, see the <a class="reference internal" href="../../faq.html#ext-commands-slash-command-troubleshooting"><span class="std std-ref">FAQ</span></a></p>
<div class="admonition-slash-command-only admonition">
<p class="admonition-title">Slash Command Only</p>
<p>For parts of the docs specific to slash commands, look for this box!</p>
</div>
</section>
</main>
<footer class="grid-item">
&#169; Copyright 2015-present, Rapptz.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
</footer>
</div>
<div id="settings" class="modal" onclick="if (event.target == this){ settingsModal.close(); }" hidden>
<div class="modal-content">
<span class="close" onclick="settingsModal.close();" title="Close">
<span class="material-icons">close</span>
</span>
<h1>Settings</h1>
<h2>Font</h2>
<div class="setting">
<h3>Use a serif font:
<label class="toggle"
title="Use a serif font? Your system font will be used, falling back to serif.">
<input type="checkbox" name="useSerifFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
<h2>Theme</h2>
<div class="setting">
<h3>
<label class="toggle" title="Set your theme based on your system preferences">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="automatic" checked>
</label>
Automatic
</h3>
<h3>
<label class="toggle" title="Set your theme to light theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="light">
</label>
Light
</h3>
<h3>
<label class="toggle" title="Set your theme to dark theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="dark">
</label>
Dark
</h3>
</div>
</div>
</div>
<div id="to-top" onclick="scrollToTop()" hidden>
<span><span class="material-icons">arrow_upward</span> to top</span>
</div>
</body>
</html>