8921 lines
848 KiB
HTML
8921 lines
848 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>API Reference</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="discord.ext.tasks – asyncio.Task helpers" href="../tasks/index.html" />
|
||
<link rel="prev" title="Slash Commands" href="slash-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="#">API Reference</a><ul>
|
||
<li><a class="reference internal" href="#bots">Bots</a><ul>
|
||
<li><a class="reference internal" href="#bot">Bot</a></li>
|
||
<li><a class="reference internal" href="#autoshardedbot">AutoShardedBot</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#prefix-helpers">Prefix Helpers</a></li>
|
||
<li><a class="reference internal" href="#event-reference">Event Reference</a></li>
|
||
<li><a class="reference internal" href="#commands">Commands</a><ul>
|
||
<li><a class="reference internal" href="#decorators">Decorators</a></li>
|
||
<li><a class="reference internal" href="#command">Command</a></li>
|
||
<li><a class="reference internal" href="#group">Group</a></li>
|
||
<li><a class="reference internal" href="#groupmixin">GroupMixin</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#cogs">Cogs</a><ul>
|
||
<li><a class="reference internal" href="#cog">Cog</a></li>
|
||
<li><a class="reference internal" href="#cogmeta">CogMeta</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#help-commands">Help Commands</a><ul>
|
||
<li><a class="reference internal" href="#helpcommand">HelpCommand</a></li>
|
||
<li><a class="reference internal" href="#defaulthelpcommand">DefaultHelpCommand</a></li>
|
||
<li><a class="reference internal" href="#minimalhelpcommand">MinimalHelpCommand</a></li>
|
||
<li><a class="reference internal" href="#paginator">Paginator</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#enums">Enums</a></li>
|
||
<li><a class="reference internal" href="#checks">Checks</a></li>
|
||
<li><a class="reference internal" href="#cooldown">Cooldown</a></li>
|
||
<li><a class="reference internal" href="#context">Context</a></li>
|
||
<li><a class="reference internal" href="#converters">Converters</a><ul>
|
||
<li><a class="reference internal" href="#option">Option</a></li>
|
||
<li><a class="reference internal" href="#flag-converter">Flag Converter</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#exceptions">Exceptions</a><ul>
|
||
<li><a class="reference internal" href="#exception-hierarchy">Exception Hierarchy</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
</aside>
|
||
<main class="grid-item" role="main">
|
||
|
||
<section id="api-reference">
|
||
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
|
||
<p>The following section outlines the API of discord.py’s command extension module.</p>
|
||
<section id="bots">
|
||
<span id="ext-commands-api-bot"></span><h2>Bots<a class="headerlink" href="#bots" title="Permalink to this headline">¶</a></h2>
|
||
<section id="bot">
|
||
<h3>Bot<a class="headerlink" href="#bot" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Bot"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.activity">activity</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.allowed_mentions">allowed_mentions</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.application_flags">application_flags</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.application_id">application_id</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.cached_messages">cached_messages</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.case_insensitive">case_insensitive</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.cogs">cogs</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.command_prefix">command_prefix</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.commands">commands</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.description">description</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.emojis">emojis</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.extensions">extensions</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.guilds">guilds</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.help_command">help_command</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.intents">intents</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.latency">latency</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.message_commands">message_commands</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.owner_id">owner_id</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.owner_ids">owner_ids</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.persistent_views">persistent_views</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.private_channels">private_channels</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.slash_command_guilds">slash_command_guilds</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.slash_commands">slash_commands</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.status">status</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.stickers">stickers</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.strip_after_prefix">strip_after_prefix</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.user">user</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.users">users</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.voice_clients">voice_clients</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.add_check">add_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.add_cog">add_cog</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.add_command">add_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.add_listener">add_listener</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.add_view">add_view</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.after_invoke">after_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.application_info">application_info</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.before_identify_hook">before_identify_hook</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.before_invoke">before_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.change_presence">change_presence</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.check">check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.check_once">check_once</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.clear">clear</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.close">close</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.command">command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.connect">connect</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.create_dm">create_dm</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.create_guild">create_guild</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.delete_invite">delete_invite</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.event">event</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_channel">fetch_channel</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_guild">fetch_guild</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_guilds">fetch_guilds</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_invite">fetch_invite</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_premium_sticker_packs">fetch_premium_sticker_packs</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_stage_instance">fetch_stage_instance</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_sticker">fetch_sticker</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_template">fetch_template</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_user">fetch_user</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_webhook">fetch_webhook</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.fetch_widget">fetch_widget</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_all_channels">get_all_channels</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_all_members">get_all_members</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_channel">get_channel</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_cog">get_cog</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_command">get_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.get_context">get_context</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_emoji">get_emoji</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_guild">get_guild</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_partial_messageable">get_partial_messageable</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.get_prefix">get_prefix</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_stage_instance">get_stage_instance</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_sticker">get_sticker</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.get_user">get_user</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.group">group</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.invoke">invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.is_closed">is_closed</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.is_owner">is_owner</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.is_ready">is_ready</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.is_ws_ratelimited">is_ws_ratelimited</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Bot.listen">listen</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.load_extension">load_extension</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.login">login</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.on_command_error">on_command_error</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.on_error">on_error</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.populate_owners">populate_owners</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.process_commands">process_commands</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.process_slash_commands">process_slash_commands</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.reload_extension">reload_extension</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.remove_check">remove_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.remove_cog">remove_cog</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.remove_command">remove_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.remove_listener">remove_listener</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.run">run</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.setup">setup</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.start">start</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.try_owners">try_owners</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.try_user">try_user</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.unload_extension">unload_extension</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.wait_for">wait_for</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Bot.wait_until_ready">wait_until_ready</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Bot.walk_commands">walk_commands</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Bot</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">command_prefix</span></em>, <em class="sig-param"><span class="pre">help_command=<default-help-command></span></em>, <em class="sig-param"><span class="pre">description=None</span></em>, <em class="sig-param"><span class="pre">*</span></em>, <em class="sig-param"><span class="pre">intents</span></em>, <em class="sig-param"><span class="pre">message_commands=True</span></em>, <em class="sig-param"><span class="pre">slash_commands=False</span></em>, <em class="sig-param"><span class="pre">**options</span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents a discord bot.</p>
|
||
<p>This class is a subclass of <a class="reference internal" href="../../api.html#discord.Client" title="discord.Client"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Client</span></code></a> and as a result
|
||
anything that you can do with a <a class="reference internal" href="../../api.html#discord.Client" title="discord.Client"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Client</span></code></a> you can do with
|
||
this bot.</p>
|
||
<p>This class also subclasses <a class="reference internal" href="#discord.ext.commands.GroupMixin" title="discord.ext.commands.GroupMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">GroupMixin</span></code></a> to provide the functionality
|
||
to manage commands.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.command_prefix">
|
||
<span class="sig-name descname"><span class="pre">command_prefix</span></span><a class="headerlink" href="#discord.ext.commands.Bot.command_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command prefix is what the message content must contain initially
|
||
to have a command invoked. This prefix could either be a string to
|
||
indicate what the prefix should be, or a callable that takes in the bot
|
||
as its first parameter and <a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a> as its second
|
||
parameter and returns the prefix. This is to facilitate “dynamic”
|
||
command prefixes. This callable can be either a regular function or
|
||
a coroutine.</p>
|
||
<p>An empty string as the prefix always matches, enabling prefix-less
|
||
command invocation. While this may be useful in DMs it should be avoided
|
||
in servers, as it’s likely to cause performance issues and unintended
|
||
command invocations.</p>
|
||
<p>The command prefix could also be an iterable of strings indicating that
|
||
multiple checks for the prefix should be used and the first one to
|
||
match will be the invocation prefix. You can get this prefix via
|
||
<a class="reference internal" href="#discord.ext.commands.Context.prefix" title="discord.ext.commands.Context.prefix"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Context.prefix</span></code></a>. To avoid confusion empty iterables are not
|
||
allowed.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>When passing multiple prefixes be careful to not pass a prefix
|
||
that matches a longer prefix occurring later in the sequence. For
|
||
example, if the command prefix is <code class="docutils literal notranslate"><span class="pre">('!',</span> <span class="pre">'!?')</span></code> the <code class="docutils literal notranslate"><span class="pre">'!?'</span></code>
|
||
prefix will never be matched to any message as the previous one
|
||
matches messages starting with <code class="docutils literal notranslate"><span class="pre">!?</span></code>. This is especially important
|
||
when passing an empty string, it should always be last as no prefix
|
||
after it will be matched.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.case_insensitive">
|
||
<span class="sig-name descname"><span class="pre">case_insensitive</span></span><a class="headerlink" href="#discord.ext.commands.Bot.case_insensitive" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether the commands should be case insensitive. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>. This
|
||
attribute does not carry over to groups. You must set it to every group if
|
||
you require group commands to be case insensitive as well.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.description">
|
||
<span class="sig-name descname"><span class="pre">description</span></span><a class="headerlink" href="#discord.ext.commands.Bot.description" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The content prefixed into the default help message.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.help_command">
|
||
<span class="sig-name descname"><span class="pre">help_command</span></span><a class="headerlink" href="#discord.ext.commands.Bot.help_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The help command implementation to use. This can be dynamically
|
||
set at runtime. To remove the help command pass <code class="docutils literal notranslate"><span class="pre">None</span></code>. For more
|
||
information on implementing a help command, see <a class="reference internal" href="#ext-commands-help-command"><span class="std std-ref">Help Commands</span></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.HelpCommand" title="discord.ext.commands.HelpCommand"><code class="xref py py-class docutils literal notranslate"><span class="pre">HelpCommand</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.owner_id">
|
||
<span class="sig-name descname"><span class="pre">owner_id</span></span><a class="headerlink" href="#discord.ext.commands.Bot.owner_id" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The user ID that owns the bot. If this is not set and is then queried via
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.is_owner" title="discord.ext.commands.Bot.is_owner"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_owner()</span></code></a> then it is fetched automatically using
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.application_info" title="discord.ext.commands.Bot.application_info"><code class="xref py py-meth docutils literal notranslate"><span class="pre">application_info()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.owner_ids">
|
||
<span class="sig-name descname"><span class="pre">owner_ids</span></span><a class="headerlink" href="#discord.ext.commands.Bot.owner_ids" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The user IDs that owns the bot. This is similar to <a class="reference internal" href="#discord.ext.commands.Bot.owner_id" title="discord.ext.commands.Bot.owner_id"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_id</span></code></a>.
|
||
If this is not set and the application is team based, then it is
|
||
fetched automatically using <a class="reference internal" href="#discord.ext.commands.Bot.application_info" title="discord.ext.commands.Bot.application_info"><code class="xref py py-meth docutils literal notranslate"><span class="pre">application_info()</span></code></a>.
|
||
For performance reasons it is recommended to use a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#set" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">set</span></code></a>
|
||
for the collection. You cannot set both <code class="docutils literal notranslate"><span class="pre">owner_id</span></code> and <code class="docutils literal notranslate"><span class="pre">owner_ids</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[Collection[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.strip_after_prefix">
|
||
<span class="sig-name descname"><span class="pre">strip_after_prefix</span></span><a class="headerlink" href="#discord.ext.commands.Bot.strip_after_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to strip whitespace characters after encountering the command
|
||
prefix. This allows for <code class="docutils literal notranslate"><span class="pre">!</span>   <span class="pre">hello</span></code> and <code class="docutils literal notranslate"><span class="pre">!hello</span></code> to both work if
|
||
the <code class="docutils literal notranslate"><span class="pre">command_prefix</span></code> is set to <code class="docutils literal notranslate"><span class="pre">!</span></code>. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.message_commands">
|
||
<span class="sig-name descname"><span class="pre">message_commands</span></span><a class="headerlink" href="#discord.ext.commands.Bot.message_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to process commands based on messages.</p>
|
||
<p>Can be overwritten per command in the command decorators or when making
|
||
a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> object via the <code class="docutils literal notranslate"><span class="pre">message_command</span></code> parameter</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.slash_commands">
|
||
<span class="sig-name descname"><span class="pre">slash_commands</span></span><a class="headerlink" href="#discord.ext.commands.Bot.slash_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to upload and process slash commands.</p>
|
||
<p>Can be overwritten per command in the command decorators or when making
|
||
a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> object via the <code class="docutils literal notranslate"><span class="pre">slash_command</span></code> parameter</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.slash_command_guilds">
|
||
<span class="sig-name descname"><span class="pre">slash_command_guilds</span></span><a class="headerlink" href="#discord.ext.commands.Bot.slash_command_guilds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If this is set, only upload slash commands to these guild IDs.</p>
|
||
<p>Can be overwritten per command in the command decorators or when making
|
||
a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> object via the <code class="docutils literal notranslate"><span class="pre">slash_command_guilds</span></code> parameter</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<code class="xref py py-class docutils literal notranslate"><span class="pre">List[int]</span></code>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.after_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">after_invoke</span></span><a class="headerlink" href="#discord.ext.commands.Bot.after_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a post-invoke hook.</p>
|
||
<p>A post-invoke hook is called directly after the command is
|
||
called. This makes it a useful function to clean-up database
|
||
connections or any type of clean up required.</p>
|
||
<p>This post-invoke hook takes a sole parameter, a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Similar to <a class="reference internal" href="#discord.ext.commands.Bot.before_invoke" title="discord.ext.commands.Bot.before_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">before_invoke()</span></code></a>, this is not called unless
|
||
checks and argument parsing procedures succeed. This hook is,
|
||
however, <strong>always</strong> called regardless of the internal command
|
||
callback raising an error (i.e. <a class="reference internal" href="#discord.ext.commands.CommandInvokeError" title="discord.ext.commands.CommandInvokeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandInvokeError</span></code></a>).
|
||
This makes it ideal for clean-up scenarios.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the post-invoke hook.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.before_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">before_invoke</span></span><a class="headerlink" href="#discord.ext.commands.Bot.before_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a pre-invoke hook.</p>
|
||
<p>A pre-invoke hook is called directly before the command is
|
||
called. This makes it a useful function to set up database
|
||
connections or any type of set up required.</p>
|
||
<p>This pre-invoke hook takes a sole parameter, a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The <a class="reference internal" href="#discord.ext.commands.Bot.before_invoke" title="discord.ext.commands.Bot.before_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">before_invoke()</span></code></a> and <a class="reference internal" href="#discord.ext.commands.Bot.after_invoke" title="discord.ext.commands.Bot.after_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">after_invoke()</span></code></a> hooks are
|
||
only called if all checks and argument parsing procedures pass
|
||
without error. If any check or argument parsing procedures fail
|
||
then the hooks are not called.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the pre-invoke hook.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.check">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">check</span></span><a class="headerlink" href="#discord.ext.commands.Bot.check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that adds a global check to the bot.</p>
|
||
<p>A global check is similar to a <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that is applied
|
||
on a per command basis except it is run before any command checks
|
||
have been verified and applies to every command the bot has.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This function can either be a regular function or a coroutine.</p>
|
||
</div>
|
||
<p>Similar to a command <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a>, this takes a single parameter
|
||
of type <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> and can only raise exceptions inherited from
|
||
<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>.</p>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@bot</span><span class="o">.</span><span class="n">check</span>
|
||
<span class="k">def</span> <span class="nf">check_commands</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">command</span><span class="o">.</span><span class="n">qualified_name</span> <span class="ow">in</span> <span class="n">allowed_commands</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.check_once">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">check_once</span></span><a class="headerlink" href="#discord.ext.commands.Bot.check_once" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that adds a “call once” global check to the bot.</p>
|
||
<p>Unlike regular global checks, this one is called only once
|
||
per <a class="reference internal" href="#discord.ext.commands.Bot.invoke" title="discord.ext.commands.Bot.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a> call.</p>
|
||
<p>Regular global checks are called whenever a command is called
|
||
or <a class="reference internal" href="#discord.ext.commands.Command.can_run" title="discord.ext.commands.Command.can_run"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.can_run()</span></code></a> is called. This type of check
|
||
bypasses that and ensures that it’s called only once, even inside
|
||
the default help command.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>When using this function the <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> sent to a group subcommand
|
||
may only parse the parent command and not the subcommands due to it
|
||
being invoked once per <a class="reference internal" href="#discord.ext.commands.Bot.invoke" title="discord.ext.commands.Bot.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.invoke()</span></code></a> call.</p>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This function can either be a regular function or a coroutine.</p>
|
||
</div>
|
||
<p>Similar to a command <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a>, this takes a single parameter
|
||
of type <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> and can only raise exceptions inherited from
|
||
<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>.</p>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@bot</span><span class="o">.</span><span class="n">check_once</span>
|
||
<span class="k">def</span> <span class="nf">whitelist</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">message</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">id</span> <span class="ow">in</span> <span class="n">my_whitelist</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.command">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">command</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut decorator that invokes <a class="reference internal" href="#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">command()</span></code></a> and adds it to
|
||
the internal command list via <a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command" title="discord.ext.commands.GroupMixin.add_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_command()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A decorator that converts the provided method into a Command, adds it to the bot, then returns it.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Callable[…, <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Bot.event">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">event</span></span><a class="headerlink" href="#discord.ext.commands.Bot.event" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers an event to listen to.</p>
|
||
<p>You can find more info about the events on the <a class="reference internal" href="../../api.html#discord-api-events"><span class="std std-ref">documentation below</span></a>.</p>
|
||
<p>The events must be a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>, if not, <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> is raised.</p>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@client</span><span class="o">.</span><span class="n">event</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_ready</span><span class="p">():</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Ready!'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.group">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">group</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.group" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut decorator that invokes <a class="reference internal" href="#discord.ext.commands.group" title="discord.ext.commands.group"><code class="xref py py-func docutils literal notranslate"><span class="pre">group()</span></code></a> and adds it to
|
||
the internal command list via <a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command" title="discord.ext.commands.GroupMixin.add_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_command()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A decorator that converts the provided method into a Group, adds it to the bot, then returns it.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Callable[…, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.listen">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">listen</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="headerlink" href="#discord.ext.commands.Bot.listen" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers another function as an external
|
||
event listener. Basically this allows you to listen to multiple
|
||
events from different places e.g. such as <a class="reference internal" href="../../api.html#discord.on_ready" title="discord.on_ready"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_ready()</span></code></a></p>
|
||
<p>The functions being listened to must be a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>.</p>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@bot</span><span class="o">.</span><span class="n">listen</span><span class="p">()</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_message</span><span class="p">(</span><span class="n">message</span><span class="p">):</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="s1">'one'</span><span class="p">)</span>
|
||
|
||
<span class="c1"># in some other file...</span>
|
||
|
||
<span class="nd">@bot</span><span class="o">.</span><span class="n">listen</span><span class="p">(</span><span class="s1">'on_message'</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">my_message</span><span class="p">(</span><span class="n">message</span><span class="p">):</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="s1">'two'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Would print one and two in an unspecified order.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The function being listened to is not a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.activity">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">activity</span></span><a class="headerlink" href="#discord.ext.commands.Bot.activity" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The activity being used upon
|
||
logging in.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.BaseActivity" title="discord.BaseActivity"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseActivity</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.add_check">
|
||
<span class="sig-name descname"><span class="pre">add_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</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">call_once</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.add_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a global check to the bot.</p>
|
||
<p>This is the non-decorator interface to <a class="reference internal" href="#discord.ext.commands.Bot.check" title="discord.ext.commands.Bot.check"><code class="xref py py-meth docutils literal notranslate"><span class="pre">check()</span></code></a>
|
||
and <a class="reference internal" href="#discord.ext.commands.Bot.check_once" title="discord.ext.commands.Bot.check_once"><code class="xref py py-meth docutils literal notranslate"><span class="pre">check_once()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>func</strong> – The function that was used as a global check.</p></li>
|
||
<li><p><strong>call_once</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – If the function should only be called once per
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.invoke" title="discord.ext.commands.Bot.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a> call.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.add_cog">
|
||
<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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">override</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.add_cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a “cog” to the bot.</p>
|
||
<p>A cog is a class that has its own event listeners and commands.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 2.0: </span><a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ClientException</span></code></a> is raised when a cog with the same name
|
||
is already loaded.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>cog</strong> (<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>) – The cog to register to the bot.</p></li>
|
||
<li><p><strong>override</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – <p>If a previously loaded cog with the same name should be ejected
|
||
instead of raising an error.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The cog does not inherit from <a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – An error happened during loading.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><strong>ClientException</strong></a> – A cog with the same name is already loaded.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.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="headerlink" href="#discord.ext.commands.Bot.add_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> into the internal list of commands.</p>
|
||
<p>This is usually not called, instead the <a class="reference internal" href="#discord.ext.commands.GroupMixin.command" title="discord.ext.commands.GroupMixin.command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">command()</span></code></a> or
|
||
<a class="reference internal" href="#discord.ext.commands.GroupMixin.group" title="discord.ext.commands.GroupMixin.group"><code class="xref py py-meth docutils literal notranslate"><span class="pre">group()</span></code></a> shortcut decorators are used instead.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.4: </span>Raise <a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandRegistrationError</span></code></a> instead of generic <a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ClientException</span></code></a></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to add.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><strong>CommandRegistrationError</strong></a> – If the command or its alias is already registered by different command.</p></li>
|
||
<li><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – If the command passed is not a subclass of <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.add_listener">
|
||
<span class="sig-name descname"><span class="pre">add_listener</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <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">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.add_listener" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The non decorator alternative to <a class="reference internal" href="#discord.ext.commands.Bot.listen" title="discord.ext.commands.Bot.listen"><code class="xref py py-meth docutils literal notranslate"><span class="pre">listen()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>func</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The function to call.</p></li>
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the event to listen for. Defaults to <code class="docutils literal notranslate"><span class="pre">func.__name__</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">on_ready</span><span class="p">():</span> <span class="k">pass</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">my_message</span><span class="p">(</span><span class="n">message</span><span class="p">):</span> <span class="k">pass</span>
|
||
|
||
<span class="n">bot</span><span class="o">.</span><span class="n">add_listener</span><span class="p">(</span><span class="n">on_ready</span><span class="p">)</span>
|
||
<span class="n">bot</span><span class="o">.</span><span class="n">add_listener</span><span class="p">(</span><span class="n">my_message</span><span class="p">,</span> <span class="s1">'on_message'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.add_view">
|
||
<span class="sig-name descname"><span class="pre">add_view</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">view</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">message_id</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="headerlink" href="#discord.ext.commands.Bot.add_view" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Registers a <a class="reference internal" href="../../api.html#discord.ui.View" title="discord.ui.View"><code class="xref py py-class docutils literal notranslate"><span class="pre">View</span></code></a> for persistent listening.</p>
|
||
<p>This method should be used for when a view is comprised of components
|
||
that last longer than the lifecycle of the program.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>view</strong> (<a class="reference internal" href="../../api.html#discord.ui.View" title="discord.ui.View"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.ui.View</span></code></a>) – The view to register for dispatching.</p></li>
|
||
<li><p><strong>message_id</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – The message ID that the view is attached to. This is currently used to
|
||
refresh the view’s state during message update events. If not given
|
||
then message update events are not propagated for the view.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – A view was not passed.</p></li>
|
||
<li><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.9)"><strong>ValueError</strong></a> – The view is not persistent. A persistent view has no timeout
|
||
and all their components have an explicitly provided custom_id.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.allowed_mentions">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">allowed_mentions</span></span><a class="headerlink" href="#discord.ext.commands.Bot.allowed_mentions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The allowed mention configuration.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.AllowedMentions" title="discord.AllowedMentions"><code class="xref py py-class docutils literal notranslate"><span class="pre">AllowedMentions</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.application_flags">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">application_flags</span></span><a class="headerlink" href="#discord.ext.commands.Bot.application_flags" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The client’s application flags.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.ApplicationFlags" title="discord.ApplicationFlags"><code class="xref py py-class docutils literal notranslate"><span class="pre">ApplicationFlags</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.application_id">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">application_id</span></span><a class="headerlink" href="#discord.ext.commands.Bot.application_id" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The client’s application ID.</p>
|
||
<p>If this is not passed via <code class="docutils literal notranslate"><span class="pre">__init__</span></code> then this is retrieved
|
||
through the gateway when an event contains the data. Usually
|
||
after <a class="reference internal" href="../../api.html#discord.on_connect" title="discord.on_connect"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_connect()</span></code></a> is called.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.application_info">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">application_info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.application_info" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves the bot’s application information.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the information failed somehow.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The bot’s application information.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.AppInfo" title="discord.AppInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">AppInfo</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.before_identify_hook">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">before_identify_hook</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shard_id</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">initial</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.before_identify_hook" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A hook that is called before IDENTIFYing a session. This is useful
|
||
if you wish to have more control over the synchronization of multiple
|
||
IDENTIFYing clients.</p>
|
||
<p>The default implementation sleeps for 5 seconds.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>shard_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The shard ID that requested being IDENTIFY’d</p></li>
|
||
<li><p><strong>initial</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether this IDENTIFY is the first initial IDENTIFY.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.cached_messages">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">cached_messages</span></span><a class="headerlink" href="#discord.ext.commands.Bot.cached_messages" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Read-only list of messages the connected client has cached.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Sequence[<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.change_presence">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">change_presence</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">activity</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">status</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="headerlink" href="#discord.ext.commands.Bot.change_presence" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Changes the client’s presence.</p>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">game</span> <span class="o">=</span> <span class="n">discord</span><span class="o">.</span><span class="n">Game</span><span class="p">(</span><span class="s2">"with the API"</span><span class="p">)</span>
|
||
<span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">change_presence</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">discord</span><span class="o">.</span><span class="n">Status</span><span class="o">.</span><span class="n">idle</span><span class="p">,</span> <span class="n">activity</span><span class="o">=</span><span class="n">game</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 2.0: </span>Removed the <code class="docutils literal notranslate"><span class="pre">afk</span></code> keyword-only parameter.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>activity</strong> (Optional[<a class="reference internal" href="../../api.html#discord.BaseActivity" title="discord.BaseActivity"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseActivity</span></code></a>]) – The activity being done. <code class="docutils literal notranslate"><span class="pre">None</span></code> if no currently active activity is done.</p></li>
|
||
<li><p><strong>status</strong> (Optional[<a class="reference internal" href="../../api.html#discord.Status" title="discord.Status"><code class="xref py py-class docutils literal notranslate"><span class="pre">Status</span></code></a>]) – Indicates what status to change to. If <code class="docutils literal notranslate"><span class="pre">None</span></code>, then
|
||
<a class="reference internal" href="../../api.html#discord.Status.online" title="discord.Status.online"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Status.online</span></code></a> is used.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.InvalidArgument" title="discord.InvalidArgument"><strong>InvalidArgument</strong></a> – If the <code class="docutils literal notranslate"><span class="pre">activity</span></code> parameter is not the proper type.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.clear">
|
||
<span class="sig-name descname"><span class="pre">clear</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.clear" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Clears the internal state of the bot.</p>
|
||
<p>After this, the bot can be considered “re-opened”, i.e. <a class="reference internal" href="#discord.ext.commands.Bot.is_closed" title="discord.ext.commands.Bot.is_closed"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_closed()</span></code></a>
|
||
and <a class="reference internal" href="#discord.ext.commands.Bot.is_ready" title="discord.ext.commands.Bot.is_ready"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_ready()</span></code></a> both return <code class="docutils literal notranslate"><span class="pre">False</span></code> along with the bot’s internal
|
||
cache cleared.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.close">
|
||
<em class="property"><span class="pre">await</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="headerlink" href="#discord.ext.commands.Bot.close" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Closes the connection to Discord.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.cogs">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">cogs</span></span><a class="headerlink" href="#discord.ext.commands.Bot.cogs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A read-only mapping of cog name to cog.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Mapping[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.commands">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">commands</span></span><a class="headerlink" href="#discord.ext.commands.Bot.commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A unique set of commands without aliases that are registered.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Set[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Bot.connect">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">connect</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">reconnect</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.connect" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Creates a websocket connection and lets the websocket listen
|
||
to messages from Discord. This is a loop that runs the entire
|
||
event system and miscellaneous aspects of the library. Control
|
||
is not resumed until the WebSocket connection is terminated.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>reconnect</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – If we should attempt reconnecting, either due to internet
|
||
failure or a specific failure on Discord’s part. Certain
|
||
disconnects that lead to bad state will not be handled (such as
|
||
invalid sharding payloads or bad tokens).</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.GatewayNotFound" title="discord.GatewayNotFound"><strong>GatewayNotFound</strong></a> – If the gateway to connect to Discord is not found. Usually if this
|
||
is thrown then there is a Discord API outage.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.ConnectionClosed" title="discord.ConnectionClosed"><strong>ConnectionClosed</strong></a> – The websocket connection has been terminated.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.create_dm">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">create_dm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">user</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.create_dm" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Creates a <a class="reference internal" href="../../api.html#discord.DMChannel" title="discord.DMChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">DMChannel</span></code></a> with this user.</p>
|
||
<p>This should be rarely called, as this is done transparently for most
|
||
people.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>user</strong> (<a class="reference internal" href="../../api.html#discord.abc.Snowflake" title="discord.abc.Snowflake"><code class="xref py py-class docutils literal notranslate"><span class="pre">Snowflake</span></code></a>) – The user to create a DM with.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The channel that was created.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.DMChannel" title="discord.DMChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">DMChannel</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.create_guild">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">create_guild</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">*</span></em>, <em class="sig-param"><span class="pre">name</span></em>, <em class="sig-param"><span class="pre">region=<VoiceRegion.us_west:</span> <span class="pre">'us-west'></span></em>, <em class="sig-param"><span class="pre">icon=...</span></em>, <em class="sig-param"><span class="pre">code=...</span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.create_guild" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Creates a <a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a>.</p>
|
||
<p>Bot accounts in more than 10 guilds are not allowed to create guilds.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the guild.</p></li>
|
||
<li><p><strong>region</strong> (<a class="reference internal" href="../../api.html#discord.VoiceRegion" title="discord.VoiceRegion"><code class="xref py py-class docutils literal notranslate"><span class="pre">VoiceRegion</span></code></a>) – The region for the voice communication server.
|
||
Defaults to <a class="reference internal" href="../../api.html#discord.VoiceRegion.us_west" title="discord.VoiceRegion.us_west"><code class="xref py py-attr docutils literal notranslate"><span class="pre">VoiceRegion.us_west</span></code></a>.</p></li>
|
||
<li><p><strong>icon</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>]) – The <a class="reference external" href="https://docs.python.org/3/glossary.html#term-bytes-like-object" title="(in Python v3.9)"><span>bytes-like object</span></a> representing the icon. See <a class="reference internal" href="../../api.html#discord.ClientUser.edit" title="discord.ClientUser.edit"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ClientUser.edit()</span></code></a>
|
||
for more details on what is expected.</p></li>
|
||
<li><p><strong>code</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – <p>The code for a template to create the guild with.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Guild creation failed.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.InvalidArgument" title="discord.InvalidArgument"><strong>InvalidArgument</strong></a> – Invalid icon image format given. Must be PNG or JPG.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The guild created. This is not the same guild that is
|
||
added to cache.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.delete_invite">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">delete_invite</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">invite</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.delete_invite" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Revokes an <a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a>, URL, or ID to an invite.</p>
|
||
<p>You must have the <a class="reference internal" href="../../api.html#discord.Permissions.manage_channels" title="discord.Permissions.manage_channels"><code class="xref py py-attr docutils literal notranslate"><span class="pre">manage_channels</span></code></a> permission in
|
||
the associated guild to do this.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>invite</strong> (Union[<a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The invite to revoke.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have permissions to revoke invites.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – The invite is invalid or expired.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Revoking the invite failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.emojis">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">emojis</span></span><a class="headerlink" href="#discord.ext.commands.Bot.emojis" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The emojis that the connected client has.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.Emoji" title="discord.Emoji"><code class="xref py py-class docutils literal notranslate"><span class="pre">Emoji</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.extensions">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">extensions</span></span><a class="headerlink" href="#discord.ext.commands.Bot.extensions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A read-only mapping of extension name to extension.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Mapping[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/types.html#types.ModuleType" title="(in Python v3.9)"><code class="docutils literal notranslate"><span class="pre">types.ModuleType</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_channel">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_channel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">channel_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves a <a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a>, <a class="reference internal" href="../../api.html#discord.abc.PrivateChannel" title="discord.abc.PrivateChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.PrivateChannel</span></code></a>, or <a class="reference internal" href="../../api.html#discord.Thread" title="discord.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></a> with the specified ID.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is an API call. For general usage, consider <a class="reference internal" href="#discord.ext.commands.Bot.get_channel" title="discord.ext.commands.Bot.get_channel"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_channel()</span></code></a> instead.</p>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.2.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.InvalidData" title="discord.InvalidData"><strong>InvalidData</strong></a> – An unknown channel type was received from Discord.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the channel failed.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – Invalid Channel ID.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have permission to fetch this channel.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The channel from the ID.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a>, <a class="reference internal" href="../../api.html#discord.abc.PrivateChannel" title="discord.abc.PrivateChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.PrivateChannel</span></code></a>, <a class="reference internal" href="../../api.html#discord.Thread" title="discord.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_guild">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_guild</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">guild_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_guild" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves a <a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a> from an ID.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Using this, you will <strong>not</strong> receive <a class="reference internal" href="../../api.html#discord.Guild.channels" title="discord.Guild.channels"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.channels</span></code></a>, <a class="reference internal" href="../../api.html#discord.Guild.members" title="discord.Guild.members"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.members</span></code></a>,
|
||
<a class="reference internal" href="../../api.html#discord.Member.activity" title="discord.Member.activity"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Member.activity</span></code></a> and <a class="reference internal" href="../../api.html#discord.Member.voice" title="discord.Member.voice"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Member.voice</span></code></a> per <a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a>.</p>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is an API call. For general usage, consider <a class="reference internal" href="#discord.ext.commands.Bot.get_guild" title="discord.ext.commands.Bot.get_guild"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_guild()</span></code></a> instead.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>guild_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The guild’s ID to fetch from.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have access to the guild.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Getting the guild failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The guild from the ID.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_guilds">
|
||
<span class="sig-name descname"><span class="pre">fetch_guilds</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">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">before</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">after</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="headerlink" href="#discord.ext.commands.Bot.fetch_guilds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves an <a class="reference internal" href="../../api.html#discord.AsyncIterator" title="discord.AsyncIterator"><code class="xref py py-class docutils literal notranslate"><span class="pre">AsyncIterator</span></code></a> that enables receiving your guilds.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Using this, you will only receive <a class="reference internal" href="../../api.html#discord.Guild.owner" title="discord.Guild.owner"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.owner</span></code></a>, <a class="reference internal" href="../../api.html#discord.Guild.icon" title="discord.Guild.icon"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.icon</span></code></a>,
|
||
<a class="reference internal" href="../../api.html#discord.Guild.id" title="discord.Guild.id"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.id</span></code></a>, and <a class="reference internal" href="../../api.html#discord.Guild.name" title="discord.Guild.name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.name</span></code></a> per <a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a>.</p>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is an API call. For general usage, consider <a class="reference internal" href="#discord.ext.commands.Bot.guilds" title="discord.ext.commands.Bot.guilds"><code class="xref py py-attr docutils literal notranslate"><span class="pre">guilds</span></code></a> instead.</p>
|
||
</div>
|
||
<p class="rubric">Examples</p>
|
||
<p>Usage</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">for</span> <span class="n">guild</span> <span class="ow">in</span> <span class="n">client</span><span class="o">.</span><span class="n">fetch_guilds</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">150</span><span class="p">):</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">guild</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Flattening into a list</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">guilds</span> <span class="o">=</span> <span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">fetch_guilds</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">150</span><span class="p">)</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>
|
||
<span class="c1"># guilds is now a list of Guild...</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>All parameters are optional.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>limit</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – The number of guilds to retrieve.
|
||
If <code class="docutils literal notranslate"><span class="pre">None</span></code>, it retrieves every guild you have access to. Note, however,
|
||
that this would make it a slow operation.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">100</span></code>.</p></li>
|
||
<li><p><strong>before</strong> (Union[<a class="reference internal" href="../../api.html#discord.abc.Snowflake" title="discord.abc.Snowflake"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.Snowflake</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>]) – Retrieves guilds before this date or object.
|
||
If a datetime is provided, it is recommended to use a UTC aware datetime.
|
||
If the datetime is naive, it is assumed to be local time.</p></li>
|
||
<li><p><strong>after</strong> (Union[<a class="reference internal" href="../../api.html#discord.abc.Snowflake" title="discord.abc.Snowflake"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.Snowflake</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>]) – Retrieve guilds after this date or object.
|
||
If a datetime is provided, it is recommended to use a UTC aware datetime.
|
||
If the datetime is naive, it is assumed to be local time.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Getting the guilds failed.</p>
|
||
</dd>
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a> – The guild with the guild data parsed.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_invite">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_invite</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">url</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">with_counts</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="n"><span class="pre">with_expiration</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_invite" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Gets an <a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a> from a discord.gg URL or ID.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>If the invite is for a guild you have not joined, the guild and channel
|
||
attributes of the returned <a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a> will be <a class="reference internal" href="../../api.html#discord.PartialInviteGuild" title="discord.PartialInviteGuild"><code class="xref py py-class docutils literal notranslate"><span class="pre">PartialInviteGuild</span></code></a> and
|
||
<a class="reference internal" href="../../api.html#discord.PartialInviteChannel" title="discord.PartialInviteChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">PartialInviteChannel</span></code></a> respectively.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>url</strong> (Union[<a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The Discord invite ID or URL (must be a discord.gg URL).</p></li>
|
||
<li><p><strong>with_counts</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether to include count information in the invite. This fills the
|
||
<a class="reference internal" href="../../api.html#discord.Invite.approximate_member_count" title="discord.Invite.approximate_member_count"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Invite.approximate_member_count</span></code></a> and <a class="reference internal" href="../../api.html#discord.Invite.approximate_presence_count" title="discord.Invite.approximate_presence_count"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Invite.approximate_presence_count</span></code></a>
|
||
fields.</p></li>
|
||
<li><p><strong>with_expiration</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – <p>Whether to include the expiration date of the invite. This fills the
|
||
<a class="reference internal" href="../../api.html#discord.Invite.expires_at" title="discord.Invite.expires_at"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Invite.expires_at</span></code></a> field.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – The invite has expired or is invalid.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Getting the invite failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The invite from the URL/ID.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_premium_sticker_packs">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_premium_sticker_packs</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_premium_sticker_packs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves all available premium sticker packs.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the sticker packs failed.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>All available premium sticker packs.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.StickerPack" title="discord.StickerPack"><code class="xref py py-class docutils literal notranslate"><span class="pre">StickerPack</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_stage_instance">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_stage_instance</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">channel_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_stage_instance" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Gets a <a class="reference internal" href="../../api.html#discord.StageInstance" title="discord.StageInstance"><code class="xref py py-class docutils literal notranslate"><span class="pre">StageInstance</span></code></a> for a stage channel id.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>channel_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The stage channel ID.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – The stage instance or channel could not be found.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Getting the stage instance failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The stage instance from the stage channel ID.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.StageInstance" title="discord.StageInstance"><code class="xref py py-class docutils literal notranslate"><span class="pre">StageInstance</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_sticker">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_sticker</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sticker_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_sticker" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves a <a class="reference internal" href="../../api.html#discord.Sticker" title="discord.Sticker"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sticker</span></code></a> with the specified ID.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the sticker failed.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – Invalid sticker ID.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The sticker you requested.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="../../api.html#discord.StandardSticker" title="discord.StandardSticker"><code class="xref py py-class docutils literal notranslate"><span class="pre">StandardSticker</span></code></a>, <a class="reference internal" href="../../api.html#discord.GuildSticker" title="discord.GuildSticker"><code class="xref py py-class docutils literal notranslate"><span class="pre">GuildSticker</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_template">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_template</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_template" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Gets a <a class="reference internal" href="../../api.html#discord.Template" title="discord.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a> from a discord.new URL or code.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>code</strong> (Union[<a class="reference internal" href="../../api.html#discord.Template" title="discord.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The Discord Template Code or URL (must be a discord.new URL).</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – The template is invalid.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Getting the template failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The template from the URL/code.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.Template" title="discord.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_user">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_user</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">user_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_user" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves a <a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a> based on their ID.
|
||
You do not have to share any guilds with the user to get this information,
|
||
however many operations do require that you do.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is an API call. If you have <a class="reference internal" href="../../api.html#discord.Intents.members" title="discord.Intents.members"><code class="xref py py-attr docutils literal notranslate"><span class="pre">discord.Intents.members</span></code></a> and member cache enabled, consider <a class="reference internal" href="#discord.ext.commands.Bot.get_user" title="discord.ext.commands.Bot.get_user"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_user()</span></code></a> instead.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>user_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The user’s ID to fetch from.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – A user with this ID does not exist.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Fetching the user failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The user you requested.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_webhook">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_webhook</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">webhook_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_webhook" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves a <a class="reference internal" href="../../api.html#discord.Webhook" title="discord.Webhook"><code class="xref py py-class docutils literal notranslate"><span class="pre">Webhook</span></code></a> with the specified ID.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the webhook failed.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – Invalid webhook ID.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have permission to fetch this webhook.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The webhook you requested.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Webhook" title="discord.Webhook"><code class="xref py py-class docutils literal notranslate"><span class="pre">Webhook</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.fetch_widget">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_widget</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">guild_id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.fetch_widget" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Gets a <a class="reference internal" href="../../api.html#discord.Widget" title="discord.Widget"><code class="xref py py-class docutils literal notranslate"><span class="pre">Widget</span></code></a> from a guild ID.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The guild must have the widget enabled to get this information.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>guild_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID of the guild.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – The widget for this guild is disabled.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the widget failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The guild’s widget.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.Widget" title="discord.Widget"><code class="xref py py-class docutils literal notranslate"><span class="pre">Widget</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_all_channels">
|
||
<em class="property"><span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">get_all_channels</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_all_channels" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A generator that retrieves every <a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a> the client can ‘access’.</p>
|
||
<p>This is equivalent to:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">guild</span> <span class="ow">in</span> <span class="n">client</span><span class="o">.</span><span class="n">guilds</span><span class="p">:</span>
|
||
<span class="k">for</span> <span class="n">channel</span> <span class="ow">in</span> <span class="n">guild</span><span class="o">.</span><span class="n">channels</span><span class="p">:</span>
|
||
<span class="k">yield</span> <span class="n">channel</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Just because you receive a <a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a> does not mean that
|
||
you can communicate in said channel. <a class="reference internal" href="../../api.html#discord.abc.GuildChannel.permissions_for" title="discord.abc.GuildChannel.permissions_for"><code class="xref py py-meth docutils literal notranslate"><span class="pre">abc.GuildChannel.permissions_for()</span></code></a> should
|
||
be used for that.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a> – A channel the client can ‘access’.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_all_members">
|
||
<em class="property"><span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">get_all_members</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_all_members" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a generator with every <a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a> the client can see.</p>
|
||
<p>This is equivalent to:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">guild</span> <span class="ow">in</span> <span class="n">client</span><span class="o">.</span><span class="n">guilds</span><span class="p">:</span>
|
||
<span class="k">for</span> <span class="n">member</span> <span class="ow">in</span> <span class="n">guild</span><span class="o">.</span><span class="n">members</span><span class="p">:</span>
|
||
<span class="k">yield</span> <span class="n">member</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a> – A member the client can see.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_channel">
|
||
<span class="sig-name descname"><span class="pre">get_channel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a channel or thread with the given ID.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID to search for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The returned channel or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[Union[<a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a>, <a class="reference internal" href="../../api.html#discord.Thread" title="discord.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></a>, <a class="reference internal" href="../../api.html#discord.abc.PrivateChannel" title="discord.abc.PrivateChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.PrivateChannel</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_cog">
|
||
<span class="sig-name descname"><span class="pre">get_cog</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="headerlink" href="#discord.ext.commands.Bot.get_cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Gets the cog instance requested.</p>
|
||
<p>If the cog is not found, <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned instead.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the cog you are requesting.
|
||
This is equivalent to the name passed via keyword
|
||
argument in class creation or the class name if unspecified.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The cog that was requested. If not found, returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_command">
|
||
<span class="sig-name descname"><span class="pre">get_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="headerlink" href="#discord.ext.commands.Bot.get_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> from the internal list
|
||
of commands.</p>
|
||
<p>This could also be used as a way to get aliases.</p>
|
||
<p>The name could be fully qualified (e.g. <code class="docutils literal notranslate"><span class="pre">'foo</span> <span class="pre">bar'</span></code>) will get
|
||
the subcommand <code class="docutils literal notranslate"><span class="pre">bar</span></code> of the group command <code class="docutils literal notranslate"><span class="pre">foo</span></code>. If a
|
||
subcommand is not found then <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned just as usual.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the command to get.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The command that was requested. If not found, returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Bot.get_context">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">get_context</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">message</span></em>, <em class="sig-param"><span class="pre">*</span></em>, <em class="sig-param"><span class="pre">cls=<class</span> <span class="pre">'discord.ext.commands.context.Context'></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_context" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Returns the invocation context from the message.</p>
|
||
<p>This is a more low-level counter-part for <a class="reference internal" href="#discord.ext.commands.Bot.process_commands" title="discord.ext.commands.Bot.process_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">process_commands()</span></code></a>
|
||
to allow users more fine grained control over the processing.</p>
|
||
<p>The returned context is not guaranteed to be a valid invocation
|
||
context, <a class="reference internal" href="#discord.ext.commands.Context.valid" title="discord.ext.commands.Context.valid"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Context.valid</span></code></a> must be checked to make sure it is.
|
||
If the context is not valid then it is not a valid candidate to be
|
||
invoked under <a class="reference internal" href="#discord.ext.commands.Bot.invoke" title="discord.ext.commands.Bot.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>message</strong> (<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a>) – The message to get the invocation context from.</p></li>
|
||
<li><p><strong>cls</strong> – The factory class that will be used to create the context.
|
||
By default, this is <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>. Should a custom
|
||
class be provided, it must be similar enough to <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>'s
|
||
interface.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The invocation context. The type of this can change via the
|
||
<code class="docutils literal notranslate"><span class="pre">cls</span></code> parameter.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_emoji">
|
||
<span class="sig-name descname"><span class="pre">get_emoji</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_emoji" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns an emoji with the given ID.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID to search for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The custom emoji or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.Emoji" title="discord.Emoji"><code class="xref py py-class docutils literal notranslate"><span class="pre">Emoji</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_guild">
|
||
<span class="sig-name descname"><span class="pre">get_guild</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_guild" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a guild with the given ID.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID to search for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The guild or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_partial_messageable">
|
||
<span class="sig-name descname"><span class="pre">get_partial_messageable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</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">type</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="headerlink" href="#discord.ext.commands.Bot.get_partial_messageable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a partial messageable with the given channel ID.</p>
|
||
<p>This is useful if you have a channel_id but don’t want to do an API call
|
||
to send messages to it.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The channel ID to create a partial messageable for.</p></li>
|
||
<li><p><strong>type</strong> (Optional[<a class="reference internal" href="../../api.html#discord.ChannelType" title="discord.ChannelType"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChannelType</span></code></a>]) – The underlying channel type for the partial messageable.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The partial messageable</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.PartialMessageable" title="discord.PartialMessageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">PartialMessageable</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_prefix">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">get_prefix</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="headerlink" href="#discord.ext.commands.Bot.get_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves the prefix the bot is listening to
|
||
with the message as a context.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>message</strong> (<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a>) – The message context to get the prefix of.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A list of prefixes or a single prefix that the bot is
|
||
listening for.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Union[List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_stage_instance">
|
||
<span class="sig-name descname"><span class="pre">get_stage_instance</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_stage_instance" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a stage instance with the given stage channel ID.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID to search for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The returns stage instance of <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.StageInstance" title="discord.StageInstance"><code class="xref py py-class docutils literal notranslate"><span class="pre">StageInstance</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_sticker">
|
||
<span class="sig-name descname"><span class="pre">get_sticker</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_sticker" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a guild sticker with the given ID.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>To retrieve standard stickers, use <a class="reference internal" href="#discord.ext.commands.Bot.fetch_sticker" title="discord.ext.commands.Bot.fetch_sticker"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fetch_sticker()</span></code></a>.
|
||
or <a class="reference internal" href="#discord.ext.commands.Bot.fetch_premium_sticker_packs" title="discord.ext.commands.Bot.fetch_premium_sticker_packs"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fetch_premium_sticker_packs()</span></code></a>.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The sticker or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Optional[<a class="reference internal" href="../../api.html#discord.GuildSticker" title="discord.GuildSticker"><code class="xref py py-class docutils literal notranslate"><span class="pre">GuildSticker</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.get_user">
|
||
<span class="sig-name descname"><span class="pre">get_user</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.get_user" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a user with the given ID.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID to search for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The user or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.guilds">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">guilds</span></span><a class="headerlink" href="#discord.ext.commands.Bot.guilds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The guilds that the connected client is a member of.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.intents">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">intents</span></span><a class="headerlink" href="#discord.ext.commands.Bot.intents" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The intents configured for this connection.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Intents" title="discord.Intents"><code class="xref py py-class docutils literal notranslate"><span class="pre">Intents</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.invoke">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">invoke</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Invokes the command given under the invocation context and
|
||
handles all the internal event dispatch mechanisms.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to invoke.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.is_closed">
|
||
<span class="sig-name descname"><span class="pre">is_closed</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.is_closed" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>: Indicates if the websocket connection is closed.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.is_owner">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">is_owner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">user</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.is_owner" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Checks if a <a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a> or <a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a> is the owner of
|
||
this bot.</p>
|
||
<p>If an <a class="reference internal" href="#discord.ext.commands.Bot.owner_id" title="discord.ext.commands.Bot.owner_id"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_id</span></code></a> is not set, it is fetched automatically
|
||
through the use of <a class="reference internal" href="#discord.ext.commands.Bot.application_info" title="discord.ext.commands.Bot.application_info"><code class="xref py py-meth docutils literal notranslate"><span class="pre">application_info()</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.3: </span>The function also checks if the application is team-owned if
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.owner_ids" title="discord.ext.commands.Bot.owner_ids"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_ids</span></code></a> is not set.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>user</strong> (<a class="reference internal" href="../../api.html#discord.abc.User" title="discord.abc.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.User</span></code></a>) – The user to check for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>Whether the user is the owner.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><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="discord.ext.commands.Bot.is_ready">
|
||
<span class="sig-name descname"><span class="pre">is_ready</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.is_ready" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>: Specifies if the client’s internal cache is ready for use.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.is_ws_ratelimited">
|
||
<span class="sig-name descname"><span class="pre">is_ws_ratelimited</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.is_ws_ratelimited" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>: Whether the websocket is currently rate limited.</p>
|
||
<p>This can be useful to know when deciding whether you should query members
|
||
using HTTP or via the gateway.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.6.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.latency">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">latency</span></span><a class="headerlink" href="#discord.ext.commands.Bot.latency" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.</p>
|
||
<p>This could be referred to as the Discord WebSocket protocol latency.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.load_extension">
|
||
<span class="sig-name descname"><span class="pre">load_extension</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="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">package</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="headerlink" href="#discord.ext.commands.Bot.load_extension" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Loads an extension.</p>
|
||
<p>An extension is a python module that contains commands, cogs, or
|
||
listeners.</p>
|
||
<p>An extension must have a global function, <code class="docutils literal notranslate"><span class="pre">setup</span></code> defined as
|
||
the entry point on what to do when the extension is loaded. This entry
|
||
point must have a single argument, the <code class="docutils literal notranslate"><span class="pre">bot</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The extension name to load. It must be dot separated like
|
||
regular Python imports if accessing a sub-module. e.g.
|
||
<code class="docutils literal notranslate"><span class="pre">foo.test</span></code> if you want to import <code class="docutils literal notranslate"><span class="pre">foo/test.py</span></code>.</p></li>
|
||
<li><p><strong>package</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – <p>The package name to resolve relative imports with.
|
||
This is required when loading an extension using a relative path, e.g <code class="docutils literal notranslate"><span class="pre">.foo.test</span></code>.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotFound" title="discord.ext.commands.ExtensionNotFound"><strong>ExtensionNotFound</strong></a> – The extension could not be imported.
|
||
This is also raised if the name of the extension could not
|
||
be resolved using the provided <code class="docutils literal notranslate"><span class="pre">package</span></code> parameter.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionAlreadyLoaded" title="discord.ext.commands.ExtensionAlreadyLoaded"><strong>ExtensionAlreadyLoaded</strong></a> – The extension is already loaded.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.NoEntryPointError" title="discord.ext.commands.NoEntryPointError"><strong>NoEntryPointError</strong></a> – The extension does not have a setup function.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionFailed" title="discord.ext.commands.ExtensionFailed"><strong>ExtensionFailed</strong></a> – The extension or its setup function had an execution error.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.login">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">login</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">token</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.login" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Logs in the client with the specified credentials.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>token</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The authentication token. Do not prefix this token with
|
||
anything as the library will do it for you.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.LoginFailure" title="discord.LoginFailure"><strong>LoginFailure</strong></a> – The wrong credentials are passed.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – An unknown HTTP related error occurred,
|
||
usually when it isn’t 200 or the known incorrect credentials
|
||
passing status code.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.on_command_error">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">on_command_error</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">context</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exception</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.on_command_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The default command error handler provided by the bot.</p>
|
||
<p>By default this prints to <a class="reference external" href="https://docs.python.org/3/library/sys.html#sys.stderr" title="(in Python v3.9)"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.stderr</span></code></a> however it could be
|
||
overridden to have a different implementation.</p>
|
||
<p>This only fires if you do not specify any listeners for command error.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.on_error">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">on_error</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">event_method</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="headerlink" href="#discord.ext.commands.Bot.on_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The default error handler provided by the client.</p>
|
||
<p>By default this prints to <a class="reference external" href="https://docs.python.org/3/library/sys.html#sys.stderr" title="(in Python v3.9)"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.stderr</span></code></a> however it could be
|
||
overridden to have a different implementation.
|
||
Check <a class="reference internal" href="../../api.html#discord.on_error" title="discord.on_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_error()</span></code></a> for more details.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.persistent_views">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">persistent_views</span></span><a class="headerlink" href="#discord.ext.commands.Bot.persistent_views" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A sequence of persistent views added to the client.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Sequence[<a class="reference internal" href="../../api.html#discord.ui.View" title="discord.ui.View"><code class="xref py py-class docutils literal notranslate"><span class="pre">View</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.populate_owners">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">populate_owners</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.populate_owners" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Populate the <a class="reference internal" href="#discord.ext.commands.Bot.owner_id" title="discord.ext.commands.Bot.owner_id"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_id</span></code></a> and <a class="reference internal" href="#discord.ext.commands.Bot.owner_ids" title="discord.ext.commands.Bot.owner_ids"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_ids</span></code></a> through the use of <a class="reference internal" href="#discord.ext.commands.Bot.application_info" title="discord.ext.commands.Bot.application_info"><code class="xref py py-meth docutils literal notranslate"><span class="pre">application_info()</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.private_channels">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">private_channels</span></span><a class="headerlink" href="#discord.ext.commands.Bot.private_channels" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The private channels that the connected client is participating on.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This returns only up to 128 most recent private channels due to an internal working
|
||
on how Discord deals with private channels.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.abc.PrivateChannel" title="discord.abc.PrivateChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.PrivateChannel</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.process_commands">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">process_commands</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="headerlink" href="#discord.ext.commands.Bot.process_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>This function processes the commands that have been registered
|
||
to the bot and other groups. Without this coroutine, none of the
|
||
commands will be triggered.</p>
|
||
<p>By default, this coroutine is called inside the <a class="reference internal" href="../../api.html#discord.on_message" title="discord.on_message"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_message()</span></code></a>
|
||
event. If you choose to override the <a class="reference internal" href="../../api.html#discord.on_message" title="discord.on_message"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_message()</span></code></a> event, then
|
||
you should invoke this coroutine as well.</p>
|
||
<p>This is built using other low level tools, and is equivalent to a
|
||
call to <a class="reference internal" href="#discord.ext.commands.Bot.get_context" title="discord.ext.commands.Bot.get_context"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_context()</span></code></a> followed by a call to <a class="reference internal" href="#discord.ext.commands.Bot.invoke" title="discord.ext.commands.Bot.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a>.</p>
|
||
<p>This also checks if the message’s author is a bot and doesn’t
|
||
call <a class="reference internal" href="#discord.ext.commands.Bot.get_context" title="discord.ext.commands.Bot.get_context"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_context()</span></code></a> or <a class="reference internal" href="#discord.ext.commands.Bot.invoke" title="discord.ext.commands.Bot.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a> if so.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>message</strong> (<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a>) – The message to process commands for.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.process_slash_commands">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">process_slash_commands</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="headerlink" href="#discord.ext.commands.Bot.process_slash_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>This function processes a slash command interaction into a usable
|
||
message and calls <a class="reference internal" href="#discord.ext.commands.Bot.process_commands" title="discord.ext.commands.Bot.process_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">process_commands()</span></code></a> based on it. Without this
|
||
coroutine slash commands will not be triggered.</p>
|
||
<p>By default, this coroutine is called inside the <a class="reference internal" href="../../api.html#discord.on_interaction" title="discord.on_interaction"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_interaction()</span></code></a>
|
||
event. If you choose to override the <a class="reference internal" href="../../api.html#discord.on_interaction" title="discord.on_interaction"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_interaction()</span></code></a> event,
|
||
then you should invoke this coroutine as well.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>interaction</strong> (<a class="reference internal" href="../../api.html#discord.Interaction" title="discord.Interaction"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Interaction</span></code></a>) – The interaction to process slash commands for.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.reload_extension">
|
||
<span class="sig-name descname"><span class="pre">reload_extension</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="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">package</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="headerlink" href="#discord.ext.commands.Bot.reload_extension" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Atomically reloads an extension.</p>
|
||
<p>This replaces the extension with the same extension, only refreshed. This is
|
||
equivalent to a <a class="reference internal" href="#discord.ext.commands.Bot.unload_extension" title="discord.ext.commands.Bot.unload_extension"><code class="xref py py-meth docutils literal notranslate"><span class="pre">unload_extension()</span></code></a> followed by a <a class="reference internal" href="#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">load_extension()</span></code></a>
|
||
except done in an atomic way. That is, if an operation fails mid-reload then
|
||
the bot will roll-back to the prior working state.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The extension name to reload. It must be dot separated like
|
||
regular Python imports if accessing a sub-module. e.g.
|
||
<code class="docutils literal notranslate"><span class="pre">foo.test</span></code> if you want to import <code class="docutils literal notranslate"><span class="pre">foo/test.py</span></code>.</p></li>
|
||
<li><p><strong>package</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – <p>The package name to resolve relative imports with.
|
||
This is required when reloading an extension using a relative path, e.g <code class="docutils literal notranslate"><span class="pre">.foo.test</span></code>.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotLoaded" title="discord.ext.commands.ExtensionNotLoaded"><strong>ExtensionNotLoaded</strong></a> – The extension was not loaded.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotFound" title="discord.ext.commands.ExtensionNotFound"><strong>ExtensionNotFound</strong></a> – The extension could not be imported.
|
||
This is also raised if the name of the extension could not
|
||
be resolved using the provided <code class="docutils literal notranslate"><span class="pre">package</span></code> parameter.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.NoEntryPointError" title="discord.ext.commands.NoEntryPointError"><strong>NoEntryPointError</strong></a> – The extension does not have a setup function.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionFailed" title="discord.ext.commands.ExtensionFailed"><strong>ExtensionFailed</strong></a> – The extension setup function had an execution error.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.remove_check">
|
||
<span class="sig-name descname"><span class="pre">remove_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</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">call_once</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.remove_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes a global check from the bot.</p>
|
||
<p>This function is idempotent and will not raise an exception
|
||
if the function is not in the global checks.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>func</strong> – The function to remove from the global checks.</p></li>
|
||
<li><p><strong>call_once</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – If the function was added with <code class="docutils literal notranslate"><span class="pre">call_once=True</span></code> in
|
||
the <a class="reference internal" href="#discord.ext.commands.Bot.add_check" title="discord.ext.commands.Bot.add_check"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.add_check()</span></code></a> call or using <a class="reference internal" href="#discord.ext.commands.Bot.check_once" title="discord.ext.commands.Bot.check_once"><code class="xref py py-meth docutils literal notranslate"><span class="pre">check_once()</span></code></a>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.remove_cog">
|
||
<span class="sig-name descname"><span class="pre">remove_cog</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="headerlink" href="#discord.ext.commands.Bot.remove_cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes a cog from the bot and returns it.</p>
|
||
<p>All registered commands and event listeners that the
|
||
cog has registered will be removed as well.</p>
|
||
<p>If no cog is found then this method has no effect.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the cog to remove.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The cog that was removed. <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.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="headerlink" href="#discord.ext.commands.Bot.remove_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Remove a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> from the internal list
|
||
of commands.</p>
|
||
<p>This could also be used as a way to remove aliases.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the command to remove.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The command that was removed. If the name is not valid then
|
||
<code class="docutils literal notranslate"><span class="pre">None</span></code> is returned instead.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Bot.remove_listener">
|
||
<span class="sig-name descname"><span class="pre">remove_listener</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <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">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.remove_listener" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes a listener from the pool of listeners.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>func</strong> – The function that was used as a listener to remove.</p></li>
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the event we want to remove. Defaults to
|
||
<code class="docutils literal notranslate"><span class="pre">func.__name__</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.run">
|
||
<span class="sig-name descname"><span class="pre">run</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.run" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A blocking call that abstracts away the event loop
|
||
initialisation from you.</p>
|
||
<p>If you want more control over the event loop then this
|
||
function should not be used. Use <a class="reference internal" href="#discord.ext.commands.Bot.start" title="discord.ext.commands.Bot.start"><code class="xref py py-meth docutils literal notranslate"><span class="pre">start()</span></code></a> coroutine
|
||
or <a class="reference internal" href="#discord.ext.commands.Bot.connect" title="discord.ext.commands.Bot.connect"><code class="xref py py-meth docutils literal notranslate"><span class="pre">connect()</span></code></a> + <a class="reference internal" href="#discord.ext.commands.Bot.login" title="discord.ext.commands.Bot.login"><code class="xref py py-meth docutils literal notranslate"><span class="pre">login()</span></code></a>.</p>
|
||
<p>Roughly Equivalent to:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
|
||
<span class="n">loop</span><span class="o">.</span><span class="n">run_until_complete</span><span class="p">(</span><span class="n">start</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span>
|
||
<span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
|
||
<span class="n">loop</span><span class="o">.</span><span class="n">run_until_complete</span><span class="p">(</span><span class="n">close</span><span class="p">())</span>
|
||
<span class="c1"># cancel all tasks lingering</span>
|
||
<span class="k">finally</span><span class="p">:</span>
|
||
<span class="n">loop</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition warning">
|
||
<p class="admonition-title">Warning</p>
|
||
<p>This function must be the last function to call due to the fact that it
|
||
is blocking. That means that registration of events or anything being
|
||
called after this function call will not execute until it returns.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.setup">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">setup</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.setup" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A coroutine to be called to setup the bot, by default this is blank.</p>
|
||
<p>To perform asynchronous setup after the bot is logged in but before
|
||
it has connected to the Websocket, overwrite this coroutine.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.start">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">start</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">token</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">reconnect</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.start" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A shorthand coroutine for <a class="reference internal" href="#discord.ext.commands.Bot.login" title="discord.ext.commands.Bot.login"><code class="xref py py-meth docutils literal notranslate"><span class="pre">login()</span></code></a> + <a class="reference internal" href="#discord.ext.commands.Bot.setup" title="discord.ext.commands.Bot.setup"><code class="xref py py-meth docutils literal notranslate"><span class="pre">setup()</span></code></a> + <a class="reference internal" href="#discord.ext.commands.Bot.connect" title="discord.ext.commands.Bot.connect"><code class="xref py py-meth docutils literal notranslate"><span class="pre">connect()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – An unexpected keyword argument was received.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.status">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">status</span></span><a class="headerlink" href="#discord.ext.commands.Bot.status" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference internal" href="../../api.html#discord.Status" title="discord.Status"><code class="xref py py-class docutils literal notranslate"><span class="pre">Status</span></code></a>:
|
||
The status being used upon logging on to Discord.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.stickers">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">stickers</span></span><a class="headerlink" href="#discord.ext.commands.Bot.stickers" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The stickers that the connected client has.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.GuildSticker" title="discord.GuildSticker"><code class="xref py py-class docutils literal notranslate"><span class="pre">GuildSticker</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.try_owners">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">try_owners</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.try_owners" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Returns a list of <a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a> representing the owners of the bot.
|
||
It uses the <a class="reference internal" href="#discord.ext.commands.Bot.owner_id" title="discord.ext.commands.Bot.owner_id"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_id</span></code></a> and <a class="reference internal" href="#discord.ext.commands.Bot.owner_ids" title="discord.ext.commands.Bot.owner_ids"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_ids</span></code></a>, if set.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0: </span>The function also checks if the application is team-owned if
|
||
<a class="reference internal" href="#discord.ext.commands.Bot.owner_ids" title="discord.ext.commands.Bot.owner_ids"><code class="xref py py-attr docutils literal notranslate"><span class="pre">owner_ids</span></code></a> is not set.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>List of owners of the bot.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>List[<a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.try_user">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">try_user</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.try_user" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.
|
||
Returns a user with the given ID. If not from cache, the user will be requested from the API.</p>
|
||
<p>You do not have to share any guilds with the user to get this information from the API,
|
||
however many operations do require that you do.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method is an API call. If you have <a class="reference internal" href="../../api.html#discord.Intents.members" title="discord.Intents.members"><code class="xref py py-attr docutils literal notranslate"><span class="pre">discord.Intents.members</span></code></a> and member cache enabled, consider <a class="reference internal" href="#discord.ext.commands.Bot.get_user" title="discord.ext.commands.Bot.get_user"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_user()</span></code></a> instead.</p>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The ID to search for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The user or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.unload_extension">
|
||
<span class="sig-name descname"><span class="pre">unload_extension</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="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">package</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="headerlink" href="#discord.ext.commands.Bot.unload_extension" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Unloads an extension.</p>
|
||
<p>When the extension is unloaded, all commands, listeners, and cogs are
|
||
removed from the bot and the module is un-imported.</p>
|
||
<p>The extension can provide an optional global function, <code class="docutils literal notranslate"><span class="pre">teardown</span></code>,
|
||
to do miscellaneous clean-up if necessary. This function takes a single
|
||
parameter, the <code class="docutils literal notranslate"><span class="pre">bot</span></code>, similar to <code class="docutils literal notranslate"><span class="pre">setup</span></code> from
|
||
<a class="reference internal" href="#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">load_extension()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The extension name to unload. It must be dot separated like
|
||
regular Python imports if accessing a sub-module. e.g.
|
||
<code class="docutils literal notranslate"><span class="pre">foo.test</span></code> if you want to import <code class="docutils literal notranslate"><span class="pre">foo/test.py</span></code>.</p></li>
|
||
<li><p><strong>package</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – <p>The package name to resolve relative imports with.
|
||
This is required when unloading an extension using a relative path, e.g <code class="docutils literal notranslate"><span class="pre">.foo.test</span></code>.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotFound" title="discord.ext.commands.ExtensionNotFound"><strong>ExtensionNotFound</strong></a> – The name of the extension could not
|
||
be resolved using the provided <code class="docutils literal notranslate"><span class="pre">package</span></code> parameter.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotLoaded" title="discord.ext.commands.ExtensionNotLoaded"><strong>ExtensionNotLoaded</strong></a> – The extension was not loaded.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.user">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">user</span></span><a class="headerlink" href="#discord.ext.commands.Bot.user" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents the connected client. <code class="docutils literal notranslate"><span class="pre">None</span></code> if not logged in.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.ClientUser" title="discord.ClientUser"><code class="xref py py-class docutils literal notranslate"><span class="pre">ClientUser</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.users">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">users</span></span><a class="headerlink" href="#discord.ext.commands.Bot.users" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a list of all the users the bot can see.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.voice_clients">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">voice_clients</span></span><a class="headerlink" href="#discord.ext.commands.Bot.voice_clients" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents a list of voice connections.</p>
|
||
<p>These are usually <a class="reference internal" href="../../api.html#discord.VoiceClient" title="discord.VoiceClient"><code class="xref py py-class docutils literal notranslate"><span class="pre">VoiceClient</span></code></a> instances.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.VoiceProtocol" title="discord.VoiceProtocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">VoiceProtocol</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.wait_for">
|
||
<span class="sig-name descname"><span class="pre">wait_for</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">event</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">check</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">timeout</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="headerlink" href="#discord.ext.commands.Bot.wait_for" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Waits for a WebSocket event to be dispatched.</p>
|
||
<p>This could be used to wait for a user to reply to a message,
|
||
or to react to a message, or to edit a message in a self-contained
|
||
way.</p>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">timeout</span></code> parameter is passed onto <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.wait_for()</span></code></a>. By default,
|
||
it does not timeout. Note that this does propagate the
|
||
<a class="reference external" href="https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError" title="(in Python v3.9)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">asyncio.TimeoutError</span></code></a> for you in case of timeout and is provided for
|
||
ease of use.</p>
|
||
<p>In case the event returns multiple arguments, a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a> containing those
|
||
arguments is returned instead. Please check the
|
||
<a class="reference internal" href="../../api.html#discord-api-events"><span class="std std-ref">documentation</span></a> for a list of events and their
|
||
parameters.</p>
|
||
<p>This function returns the <strong>first event that meets the requirements</strong>.</p>
|
||
<p class="rubric">Examples</p>
|
||
<p>Waiting for a user reply:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nd">@client</span><span class="o">.</span><span class="n">event</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_message</span><span class="p">(</span><span class="n">message</span><span class="p">):</span>
|
||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">content</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">'$greet'</span><span class="p">):</span>
|
||
<span class="n">channel</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">channel</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="s1">'Say hello!'</span><span class="p">)</span>
|
||
|
||
<span class="k">def</span> <span class="nf">check</span><span class="p">(</span><span class="n">m</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">m</span><span class="o">.</span><span class="n">content</span> <span class="o">==</span> <span class="s1">'hello'</span> <span class="ow">and</span> <span class="n">m</span><span class="o">.</span><span class="n">channel</span> <span class="o">==</span> <span class="n">channel</span>
|
||
|
||
<span class="n">msg</span> <span class="o">=</span> <span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">wait_for</span><span class="p">(</span><span class="s1">'message'</span><span class="p">,</span> <span class="n">check</span><span class="o">=</span><span class="n">check</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">'Hello </span><span class="si">{</span><span class="n">msg</span><span class="o">.</span><span class="n">author</span><span class="si">}</span><span class="s1">!'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Waiting for a thumbs up reaction from the message author:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nd">@client</span><span class="o">.</span><span class="n">event</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_message</span><span class="p">(</span><span class="n">message</span><span class="p">):</span>
|
||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">content</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">'$thumb'</span><span class="p">):</span>
|
||
<span class="n">channel</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">channel</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="s1">'Send me that 👍 reaction, mate'</span><span class="p">)</span>
|
||
|
||
<span class="k">def</span> <span class="nf">check</span><span class="p">(</span><span class="n">reaction</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">user</span> <span class="o">==</span> <span class="n">message</span><span class="o">.</span><span class="n">author</span> <span class="ow">and</span> <span class="nb">str</span><span class="p">(</span><span class="n">reaction</span><span class="o">.</span><span class="n">emoji</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'👍'</span>
|
||
|
||
<span class="k">try</span><span class="p">:</span>
|
||
<span class="n">reaction</span><span class="p">,</span> <span class="n">user</span> <span class="o">=</span> <span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">wait_for</span><span class="p">(</span><span class="s1">'reaction_add'</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="mf">60.0</span><span class="p">,</span> <span class="n">check</span><span class="o">=</span><span class="n">check</span><span class="p">)</span>
|
||
<span class="k">except</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">TimeoutError</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="s1">'👎'</span><span class="p">)</span>
|
||
<span class="k">else</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="s1">'👍'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>event</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The event name, similar to the <a class="reference internal" href="../../api.html#discord-api-events"><span class="std std-ref">event reference</span></a>,
|
||
but without the <code class="docutils literal notranslate"><span class="pre">on_</span></code> prefix, to wait for.</p></li>
|
||
<li><p><strong>check</strong> (Optional[Callable[…, <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]]) – A predicate to check what to wait for. The arguments must meet the
|
||
parameters of the event being waited for.</p></li>
|
||
<li><p><strong>timeout</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – The number of seconds to wait before timing out and raising
|
||
<a class="reference external" href="https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError" title="(in Python v3.9)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">asyncio.TimeoutError</span></code></a>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError" title="(in Python v3.9)"><strong>asyncio.TimeoutError</strong></a> – If a timeout is provided and it was reached.</p>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>Returns no arguments, a single argument, or a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a> of multiple
|
||
arguments that mirrors the parameters passed in the
|
||
<a class="reference internal" href="../../api.html#discord-api-events"><span class="std std-ref">event reference</span></a>.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Any</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.wait_until_ready">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">wait_until_ready</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.wait_until_ready" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Waits until the client’s internal cache is all ready.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Bot.walk_commands">
|
||
<em class="property"><span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">walk_commands</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Bot.walk_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An iterator that recursively walks through all commands and subcommands.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.4: </span>Duplicates due to aliases are no longer returned</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>] – A command or group from the internal list of commands.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="autoshardedbot">
|
||
<h3>AutoShardedBot<a class="headerlink" href="#autoshardedbot" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.AutoShardedBot"></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.AutoShardedBot">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">AutoShardedBot</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">command_prefix</span></em>, <em class="sig-param"><span class="pre">help_command=<default-help-command></span></em>, <em class="sig-param"><span class="pre">description=None</span></em>, <em class="sig-param"><span class="pre">*</span></em>, <em class="sig-param"><span class="pre">intents</span></em>, <em class="sig-param"><span class="pre">message_commands=True</span></em>, <em class="sig-param"><span class="pre">slash_commands=False</span></em>, <em class="sig-param"><span class="pre">**options</span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.AutoShardedBot" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This is similar to <a class="reference internal" href="#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> except that it is inherited from
|
||
<a class="reference internal" href="../../api.html#discord.AutoShardedClient" title="discord.AutoShardedClient"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.AutoShardedClient</span></code></a> instead.</p>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
</section>
|
||
<section id="prefix-helpers">
|
||
<h2>Prefix Helpers<a class="headerlink" href="#prefix-helpers" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.when_mentioned">
|
||
<span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">when_mentioned</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">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.when_mentioned" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A callable that implements a command prefix equivalent to being mentioned.</p>
|
||
<p>These are meant to be passed into the <a class="reference internal" href="#discord.ext.commands.Bot.command_prefix" title="discord.ext.commands.Bot.command_prefix"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Bot.command_prefix</span></code></a> attribute.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.when_mentioned_or">
|
||
<span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">when_mentioned_or</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">prefixes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.when_mentioned_or" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A callable that implements when mentioned or other prefixes provided.</p>
|
||
<p>These are meant to be passed into the <a class="reference internal" href="#discord.ext.commands.Bot.command_prefix" title="discord.ext.commands.Bot.command_prefix"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Bot.command_prefix</span></code></a> attribute.</p>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">bot</span> <span class="o">=</span> <span class="n">commands</span><span class="o">.</span><span class="n">Bot</span><span class="p">(</span><span class="n">command_prefix</span><span class="o">=</span><span class="n">commands</span><span class="o">.</span><span class="n">when_mentioned_or</span><span class="p">(</span><span class="s1">'!'</span><span class="p">))</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This callable returns another callable, so if this is done inside a custom
|
||
callable, you must call the returned callable, for example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">get_prefix</span><span class="p">(</span><span class="n">bot</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
|
||
<span class="n">extras</span> <span class="o">=</span> <span class="k">await</span> <span class="n">prefixes_for</span><span class="p">(</span><span class="n">message</span><span class="o">.</span><span class="n">guild</span><span class="p">)</span> <span class="c1"># returns a list</span>
|
||
<span class="k">return</span> <span class="n">commands</span><span class="o">.</span><span class="n">when_mentioned_or</span><span class="p">(</span><span class="o">*</span><span class="n">extras</span><span class="p">)(</span><span class="n">bot</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p><a class="reference internal" href="#discord.ext.commands.when_mentioned" title="discord.ext.commands.when_mentioned"><code class="xref py py-func docutils literal notranslate"><span class="pre">when_mentioned()</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="event-reference">
|
||
<span id="ext-commands-api-events"></span><h2>Event Reference<a class="headerlink" href="#event-reference" title="Permalink to this headline">¶</a></h2>
|
||
<p>These events function similar to <a class="reference internal" href="../../api.html#discord-api-events"><span class="std std-ref">the regular events</span></a>, except they
|
||
are custom to the command extension module.</p>
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.discord.ext.commands.on_command_error">
|
||
<span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">on_command_error</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">error</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.discord.ext.commands.on_command_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An error handler that is called when an error is raised
|
||
inside a command either through user input error, check
|
||
failure, or an error in your own code.</p>
|
||
<p>A default one is provided (<a class="reference internal" href="#discord.ext.commands.Bot.on_command_error" title="discord.ext.commands.Bot.on_command_error"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.on_command_error()</span></code></a>).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p></li>
|
||
<li><p><strong>error</strong> (<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived) – The error that was raised.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.discord.ext.commands.on_command">
|
||
<span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">on_command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.discord.ext.commands.on_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An event that is called when a command is found and is about to be invoked.</p>
|
||
<p>This event is called regardless of whether the command itself succeeds via
|
||
error or completes.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.discord.ext.commands.on_command_completion">
|
||
<span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">on_command_completion</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.discord.ext.commands.on_command_completion" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An event that is called when a command has completed its invocation.</p>
|
||
<p>This event is called only if the command succeeded, i.e. all checks have
|
||
passed and the user input it correctly.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="commands">
|
||
<span id="ext-commands-api-command"></span><h2>Commands<a class="headerlink" href="#commands" title="Permalink to this headline">¶</a></h2>
|
||
<section id="decorators">
|
||
<h3>Decorators<a class="headerlink" href="#decorators" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.command">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">command</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">...</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cls</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">attrs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that transforms a function into a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>
|
||
or if called with <a class="reference internal" href="#discord.ext.commands.group" title="discord.ext.commands.group"><code class="xref py py-func docutils literal notranslate"><span class="pre">group()</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>.</p>
|
||
<p>By default the <code class="docutils literal notranslate"><span class="pre">help</span></code> attribute is received automatically from the
|
||
docstring of the function and is cleaned up with the use of
|
||
<code class="docutils literal notranslate"><span class="pre">inspect.cleandoc</span></code>. If the docstring is <code class="docutils literal notranslate"><span class="pre">bytes</span></code>, then it is decoded
|
||
into <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> using utf-8 encoding.</p>
|
||
<p>All checks added using the <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> & co. decorators are added into
|
||
the function. There is no way to supply your own checks through this
|
||
decorator.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name to create the command with. By default this uses the
|
||
function name unchanged.</p></li>
|
||
<li><p><strong>cls</strong> – The class to construct with. By default this is <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>.
|
||
You usually do not change this.</p></li>
|
||
<li><p><strong>attrs</strong> – Keyword arguments to pass into the construction of the class denoted
|
||
by <code class="docutils literal notranslate"><span class="pre">cls</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – If the function is not a coroutine or is already a command.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.group">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">group</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">...</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cls</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">attrs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.group" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that transforms a function into a <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>.</p>
|
||
<p>This is similar to the <a class="reference internal" href="#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">command()</span></code></a> decorator but the <code class="docutils literal notranslate"><span class="pre">cls</span></code>
|
||
parameter is set to <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a> by default.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.1: </span>The <code class="docutils literal notranslate"><span class="pre">cls</span></code> parameter can now be passed.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="command">
|
||
<h3>Command<a class="headerlink" href="#command" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Command"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.aliases">aliases</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.brief">brief</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.callback">callback</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.checks">checks</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.clean_params">clean_params</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.cog">cog</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.cog_name">cog_name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.cooldown_after_parsing">cooldown_after_parsing</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.description">description</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.enabled">enabled</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.extras">extras</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.full_parent_name">full_parent_name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.help">help</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.hidden">hidden</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.ignore_extra">ignore_extra</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.invoked_subcommand">invoked_subcommand</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.message_command">message_command</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.name">name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.option_descriptions">option_descriptions</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.parent">parent</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.parents">parents</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.qualified_name">qualified_name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.require_var_positional">require_var_positional</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.rest_is_raw">rest_is_raw</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.root_parent">root_parent</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.short_doc">short_doc</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.signature">signature</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.slash_command">slash_command</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.slash_command_guilds">slash_command_guilds</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Command.usage">usage</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Command.__call__">__call__</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.add_check">add_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Command.after_invoke">after_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Command.before_invoke">before_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Command.can_run">can_run</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.copy">copy</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Command.error">error</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.get_cooldown_retry_after">get_cooldown_retry_after</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.has_error_handler">has_error_handler</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.is_on_cooldown">is_on_cooldown</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.remove_check">remove_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.reset_cooldown">reset_cooldown</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Command.update">update</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Command</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A class that implements the protocol for a bot text command.</p>
|
||
<p>These are not created manually, instead they are created via the
|
||
decorator or functional interface.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.Command.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The name of the command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.callback">
|
||
<span class="sig-name descname"><span class="pre">callback</span></span><a class="headerlink" href="#discord.ext.commands.Command.callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The coroutine that is executed when the command is called.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.help">
|
||
<span class="sig-name descname"><span class="pre">help</span></span><a class="headerlink" href="#discord.ext.commands.Command.help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The long help text for the command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.brief">
|
||
<span class="sig-name descname"><span class="pre">brief</span></span><a class="headerlink" href="#discord.ext.commands.Command.brief" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The short help text for the command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.usage">
|
||
<span class="sig-name descname"><span class="pre">usage</span></span><a class="headerlink" href="#discord.ext.commands.Command.usage" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A replacement for arguments in the default help text.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.aliases">
|
||
<span class="sig-name descname"><span class="pre">aliases</span></span><a class="headerlink" href="#discord.ext.commands.Command.aliases" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The list of aliases the command can be invoked under.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Union[List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>], Tuple[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.enabled">
|
||
<span class="sig-name descname"><span class="pre">enabled</span></span><a class="headerlink" href="#discord.ext.commands.Command.enabled" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A boolean that indicates if the command is currently enabled.
|
||
If the command is invoked while it is disabled, then
|
||
<a class="reference internal" href="#discord.ext.commands.DisabledCommand" title="discord.ext.commands.DisabledCommand"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DisabledCommand</span></code></a> is raised to the <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a>
|
||
event. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.parent">
|
||
<span class="sig-name descname"><span class="pre">parent</span></span><a class="headerlink" href="#discord.ext.commands.Command.parent" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The parent group that this command belongs to. <code class="docutils literal notranslate"><span class="pre">None</span></code> if there
|
||
isn’t one.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.cog">
|
||
<span class="sig-name descname"><span class="pre">cog</span></span><a class="headerlink" href="#discord.ext.commands.Command.cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The cog that this command belongs to. <code class="docutils literal notranslate"><span class="pre">None</span></code> if there isn’t one.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.checks">
|
||
<span class="sig-name descname"><span class="pre">checks</span></span><a class="headerlink" href="#discord.ext.commands.Command.checks" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A list of predicates that verifies if the command could be executed
|
||
with the given <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> as the sole parameter. If an exception
|
||
is necessary to be thrown to signal failure, then one inherited from
|
||
<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> should be used. Note that if the checks fail then
|
||
<a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a> exception is raised to the <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a>
|
||
event.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[Callable[[<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.description">
|
||
<span class="sig-name descname"><span class="pre">description</span></span><a class="headerlink" href="#discord.ext.commands.Command.description" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The message prefixed into the default help command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.hidden">
|
||
<span class="sig-name descname"><span class="pre">hidden</span></span><a class="headerlink" href="#discord.ext.commands.Command.hidden" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the default help command does not show this in the
|
||
help output.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.rest_is_raw">
|
||
<span class="sig-name descname"><span class="pre">rest_is_raw</span></span><a class="headerlink" href="#discord.ext.commands.Command.rest_is_raw" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If <code class="docutils literal notranslate"><span class="pre">False</span></code> and a keyword-only argument is provided then the keyword
|
||
only argument is stripped and handled as if it was a regular argument
|
||
that handles <a class="reference internal" href="#discord.ext.commands.MissingRequiredArgument" title="discord.ext.commands.MissingRequiredArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingRequiredArgument</span></code></a> and default values in a
|
||
regular matter rather than passing the rest completely raw. If <code class="docutils literal notranslate"><span class="pre">True</span></code>
|
||
then the keyword-only argument will pass in the rest of the arguments
|
||
in a completely raw matter. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.invoked_subcommand">
|
||
<span class="sig-name descname"><span class="pre">invoked_subcommand</span></span><a class="headerlink" href="#discord.ext.commands.Command.invoked_subcommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The subcommand that was invoked, if any.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.require_var_positional">
|
||
<span class="sig-name descname"><span class="pre">require_var_positional</span></span><a class="headerlink" href="#discord.ext.commands.Command.require_var_positional" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If <code class="docutils literal notranslate"><span class="pre">True</span></code> and a variadic positional argument is specified, requires
|
||
the user to specify at least one argument. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.ignore_extra">
|
||
<span class="sig-name descname"><span class="pre">ignore_extra</span></span><a class="headerlink" href="#discord.ext.commands.Command.ignore_extra" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, ignores extraneous strings passed to a command if all its
|
||
requirements are met (e.g. <code class="docutils literal notranslate"><span class="pre">?foo</span> <span class="pre">a</span> <span class="pre">b</span> <span class="pre">c</span></code> when only expecting <code class="docutils literal notranslate"><span class="pre">a</span></code>
|
||
and <code class="docutils literal notranslate"><span class="pre">b</span></code>). Otherwise <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> and local error handlers
|
||
are called with <a class="reference internal" href="#discord.ext.commands.TooManyArguments" title="discord.ext.commands.TooManyArguments"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TooManyArguments</span></code></a>. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.cooldown_after_parsing">
|
||
<span class="sig-name descname"><span class="pre">cooldown_after_parsing</span></span><a class="headerlink" href="#discord.ext.commands.Command.cooldown_after_parsing" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, cooldown processing is done after argument parsing,
|
||
which calls converters. If <code class="docutils literal notranslate"><span class="pre">False</span></code> then cooldown processing is done
|
||
first and then the converters are called second. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.extras">
|
||
<span class="sig-name descname"><span class="pre">extras</span></span><a class="headerlink" href="#discord.ext.commands.Command.extras" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A dict of user provided extras to attach to the Command.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This object may be copied by the library.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.message_command">
|
||
<span class="sig-name descname"><span class="pre">message_command</span></span><a class="headerlink" href="#discord.ext.commands.Command.message_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to process this command based on messages.</p>
|
||
<p>This overwrites the global <code class="docutils literal notranslate"><span class="pre">message_commands</span></code> parameter of <a class="reference internal" href="#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>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.slash_command">
|
||
<span class="sig-name descname"><span class="pre">slash_command</span></span><a class="headerlink" href="#discord.ext.commands.Command.slash_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to upload and process this command as a slash command.</p>
|
||
<p>This overwrites the global <code class="docutils literal notranslate"><span class="pre">slash_commands</span></code> parameter of <a class="reference internal" href="#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>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.slash_command_guilds">
|
||
<span class="sig-name descname"><span class="pre">slash_command_guilds</span></span><a class="headerlink" href="#discord.ext.commands.Command.slash_command_guilds" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>If this is set, only upload this slash command to these guild IDs.</p>
|
||
<p>This overwrites the global <code class="docutils literal notranslate"><span class="pre">slash_command_guilds</span></code> parameter of <a class="reference internal" href="#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>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[List[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.option_descriptions">
|
||
<span class="sig-name descname"><span class="pre">option_descriptions</span></span><a class="headerlink" href="#discord.ext.commands.Command.option_descriptions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The unpacked option descriptions from <a class="reference internal" href="#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>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Dict[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.after_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">after_invoke</span></span><a class="headerlink" href="#discord.ext.commands.Command.after_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a post-invoke hook.</p>
|
||
<p>A post-invoke hook is called directly after the command is
|
||
called. This makes it a useful function to clean-up database
|
||
connections or any type of clean up required.</p>
|
||
<p>This post-invoke hook takes a sole parameter, a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
<p>See <a class="reference internal" href="#discord.ext.commands.Bot.after_invoke" title="discord.ext.commands.Bot.after_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.after_invoke()</span></code></a> for more info.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the post-invoke hook.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.before_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">before_invoke</span></span><a class="headerlink" href="#discord.ext.commands.Command.before_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a pre-invoke hook.</p>
|
||
<p>A pre-invoke hook is called directly before the command is
|
||
called. This makes it a useful function to set up database
|
||
connections or any type of set up required.</p>
|
||
<p>This pre-invoke hook takes a sole parameter, a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
<p>See <a class="reference internal" href="#discord.ext.commands.Bot.before_invoke" title="discord.ext.commands.Bot.before_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.before_invoke()</span></code></a> for more info.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the pre-invoke hook.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.error">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">error</span></span><a class="headerlink" href="#discord.ext.commands.Command.error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a local error handler.</p>
|
||
<p>A local error handler is an <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> event limited to
|
||
a single command. However, the <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> is still
|
||
invoked afterwards as the catch-all.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the local error handler.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.add_check">
|
||
<span class="sig-name descname"><span class="pre">add_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.add_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a check to the command.</p>
|
||
<p>This is the non-decorator interface to <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>func</strong> – The function that will be used as a check.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.remove_check">
|
||
<span class="sig-name descname"><span class="pre">remove_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.remove_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes a check from the command.</p>
|
||
<p>This function is idempotent and will not raise an exception
|
||
if the function is not in the command’s checks.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>func</strong> – The function to remove from the checks.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.update">
|
||
<span class="sig-name descname"><span class="pre">update</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">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.update" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Updates <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> instance with updated attribute.</p>
|
||
<p>This works similarly to the <a class="reference internal" href="#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">command()</span></code></a> decorator in terms
|
||
of parameters in that they are passed to the <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> or
|
||
subclass constructors, sans the name and callback.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.__call__">
|
||
<em class="property"><span class="pre">await</span> </em><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">context</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="headerlink" href="#discord.ext.commands.Command.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Calls the internal callback that the command holds.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This bypasses all mechanisms – including checks, converters,
|
||
invoke hooks, cooldowns, etc. You must take care to pass
|
||
the proper arguments and types to this function.</p>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.copy">
|
||
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.copy" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a copy of this command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A new instance of this command.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.clean_params">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">clean_params</span></span><a class="headerlink" href="#discord.ext.commands.Command.clean_params" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Dict[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a>]:
|
||
Retrieves the parameter dictionary without the context or self parameters.</p>
|
||
<p>Useful for inspecting signature.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.full_parent_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">full_parent_name</span></span><a class="headerlink" href="#discord.ext.commands.Command.full_parent_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the fully qualified parent command name.</p>
|
||
<p>This the base command name required to execute it. For example,
|
||
in <code class="docutils literal notranslate"><span class="pre">?one</span> <span class="pre">two</span> <span class="pre">three</span></code> the parent name would be <code class="docutils literal notranslate"><span class="pre">one</span> <span class="pre">two</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.parents">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">parents</span></span><a class="headerlink" href="#discord.ext.commands.Command.parents" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the parents of this command.</p>
|
||
<p>If the command has no parents then it returns an empty <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>.</p>
|
||
<p>For example in commands <code class="docutils literal notranslate"><span class="pre">?a</span> <span class="pre">b</span> <span class="pre">c</span> <span class="pre">test</span></code>, the parents are <code class="docutils literal notranslate"><span class="pre">[c,</span> <span class="pre">b,</span> <span class="pre">a]</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.root_parent">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">root_parent</span></span><a class="headerlink" href="#discord.ext.commands.Command.root_parent" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the root parent of this command.</p>
|
||
<p>If the command has no parents then it returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<p>For example in commands <code class="docutils literal notranslate"><span class="pre">?a</span> <span class="pre">b</span> <span class="pre">c</span> <span class="pre">test</span></code>, the root parent is <code class="docutils literal notranslate"><span class="pre">a</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.qualified_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">qualified_name</span></span><a class="headerlink" href="#discord.ext.commands.Command.qualified_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the fully qualified command name.</p>
|
||
<p>This is the full parent name with the command name as well.
|
||
For example, in <code class="docutils literal notranslate"><span class="pre">?one</span> <span class="pre">two</span> <span class="pre">three</span></code> the qualified name would be
|
||
<code class="docutils literal notranslate"><span class="pre">one</span> <span class="pre">two</span> <span class="pre">three</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.is_on_cooldown">
|
||
<span class="sig-name descname"><span class="pre">is_on_cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.is_on_cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Checks whether the command is currently on cooldown.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to use when checking the commands cooldown status.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A boolean indicating if the command is on cooldown.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><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="discord.ext.commands.Command.reset_cooldown">
|
||
<span class="sig-name descname"><span class="pre">reset_cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.reset_cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Resets the cooldown on this command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to reset the cooldown under.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.get_cooldown_retry_after">
|
||
<span class="sig-name descname"><span class="pre">get_cooldown_retry_after</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.get_cooldown_retry_after" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the amount of seconds before this command can be tried again.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to retrieve the cooldown from.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The amount of time left on this command’s cooldown in seconds.
|
||
If this is <code class="docutils literal notranslate"><span class="pre">0.0</span></code> then the command isn’t on cooldown.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.has_error_handler">
|
||
<span class="sig-name descname"><span class="pre">has_error_handler</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.has_error_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>: Checks whether the command has an error handler registered.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.cog_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">cog_name</span></span><a class="headerlink" href="#discord.ext.commands.Command.cog_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The name of the cog this command belongs to, if any.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.short_doc">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">short_doc</span></span><a class="headerlink" href="#discord.ext.commands.Command.short_doc" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Gets the “short” documentation of a command.</p>
|
||
<p>By default, this is the <a class="reference internal" href="#discord.ext.commands.Command.brief" title="discord.ext.commands.Command.brief"><code class="xref py py-attr docutils literal notranslate"><span class="pre">brief</span></code></a> attribute.
|
||
If that lookup leads to an empty string then the first line of the
|
||
<a class="reference internal" href="#discord.ext.commands.Command.help" title="discord.ext.commands.Command.help"><code class="xref py py-attr docutils literal notranslate"><span class="pre">help</span></code></a> attribute is used instead.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.signature">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">signature</span></span><a class="headerlink" href="#discord.ext.commands.Command.signature" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a POSIX-like signature useful for help command output.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Command.can_run">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">can_run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Command.can_run" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Checks if the command can be executed by checking all the predicates
|
||
inside the <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">checks</span></code></a> attribute. This also checks whether the
|
||
command is disabled.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.3: </span>Checks whether the command is disabled or not</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The ctx of the command currently being invoked.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – Any command error that was raised during a check call will be propagated
|
||
by this function.</p>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A boolean indicating if the command can be invoked.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="group">
|
||
<h3>Group<a class="headerlink" href="#group" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Group"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.case_insensitive">case_insensitive</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.clean_params">clean_params</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.cog_name">cog_name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.commands">commands</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.full_parent_name">full_parent_name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.invoke_without_command">invoke_without_command</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.parents">parents</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.qualified_name">qualified_name</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.root_parent">root_parent</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.short_doc">short_doc</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Group.signature">signature</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.add_check">add_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.add_command">add_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Group.after_invoke">after_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Group.before_invoke">before_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Group.can_run">can_run</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Group.command">command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.copy">copy</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Group.error">error</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.get_command">get_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.get_cooldown_retry_after">get_cooldown_retry_after</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.Group.group">group</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.has_error_handler">has_error_handler</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.is_on_cooldown">is_on_cooldown</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.remove_check">remove_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.remove_command">remove_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.reset_cooldown">reset_cooldown</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.update">update</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Group.walk_commands">walk_commands</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Group</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A class that implements a grouping protocol for commands to be
|
||
executed as subcommands.</p>
|
||
<p>This class is a subclass of <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> and thus all options
|
||
valid in <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> are valid in here as well.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.invoke_without_command">
|
||
<span class="sig-name descname"><span class="pre">invoke_without_command</span></span><a class="headerlink" href="#discord.ext.commands.Group.invoke_without_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Indicates if the group callback should begin parsing and
|
||
invocation only if no subcommand was found. Useful for
|
||
making it an error handling function to tell the user that
|
||
no subcommand was found or to have different functionality
|
||
in case no subcommand was found. If this is <code class="docutils literal notranslate"><span class="pre">False</span></code>, then
|
||
the group callback will always be invoked first. This means
|
||
that the checks and the parsing dictated by its parameters
|
||
will be executed. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.case_insensitive">
|
||
<span class="sig-name descname"><span class="pre">case_insensitive</span></span><a class="headerlink" href="#discord.ext.commands.Group.case_insensitive" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Indicates if the group’s commands should be case insensitive.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><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="discord.ext.commands.Group.after_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">after_invoke</span></span><a class="headerlink" href="#discord.ext.commands.Group.after_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a post-invoke hook.</p>
|
||
<p>A post-invoke hook is called directly after the command is
|
||
called. This makes it a useful function to clean-up database
|
||
connections or any type of clean up required.</p>
|
||
<p>This post-invoke hook takes a sole parameter, a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
<p>See <a class="reference internal" href="#discord.ext.commands.Bot.after_invoke" title="discord.ext.commands.Bot.after_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.after_invoke()</span></code></a> for more info.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the post-invoke hook.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.before_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">before_invoke</span></span><a class="headerlink" href="#discord.ext.commands.Group.before_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a pre-invoke hook.</p>
|
||
<p>A pre-invoke hook is called directly before the command is
|
||
called. This makes it a useful function to set up database
|
||
connections or any type of set up required.</p>
|
||
<p>This pre-invoke hook takes a sole parameter, a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
<p>See <a class="reference internal" href="#discord.ext.commands.Bot.before_invoke" title="discord.ext.commands.Bot.before_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.before_invoke()</span></code></a> for more info.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the pre-invoke hook.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.command">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">command</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut decorator that invokes <a class="reference internal" href="#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">command()</span></code></a> and adds it to
|
||
the internal command list via <a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command" title="discord.ext.commands.GroupMixin.add_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_command()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A decorator that converts the provided method into a Command, adds it to the bot, then returns it.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Callable[…, <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Group.error">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">error</span></span><a class="headerlink" href="#discord.ext.commands.Group.error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a local error handler.</p>
|
||
<p>A local error handler is an <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> event limited to
|
||
a single command. However, the <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> is still
|
||
invoked afterwards as the catch-all.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>coro</strong> (<a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>) – The coroutine to register as the local error handler.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The coroutine passed is not actually a coroutine.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.group">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">group</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.group" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut decorator that invokes <a class="reference internal" href="#discord.ext.commands.group" title="discord.ext.commands.group"><code class="xref py py-func docutils literal notranslate"><span class="pre">group()</span></code></a> and adds it to
|
||
the internal command list via <a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command" title="discord.ext.commands.GroupMixin.add_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_command()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A decorator that converts the provided method into a Group, adds it to the bot, then returns it.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Callable[…, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.copy">
|
||
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.copy" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a copy of this <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A new instance of this group.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.add_check">
|
||
<span class="sig-name descname"><span class="pre">add_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.add_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a check to the command.</p>
|
||
<p>This is the non-decorator interface to <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>func</strong> – The function that will be used as a check.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.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="headerlink" href="#discord.ext.commands.Group.add_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> into the internal list of commands.</p>
|
||
<p>This is usually not called, instead the <a class="reference internal" href="#discord.ext.commands.GroupMixin.command" title="discord.ext.commands.GroupMixin.command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">command()</span></code></a> or
|
||
<a class="reference internal" href="#discord.ext.commands.GroupMixin.group" title="discord.ext.commands.GroupMixin.group"><code class="xref py py-meth docutils literal notranslate"><span class="pre">group()</span></code></a> shortcut decorators are used instead.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.4: </span>Raise <a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandRegistrationError</span></code></a> instead of generic <a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ClientException</span></code></a></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to add.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><strong>CommandRegistrationError</strong></a> – If the command or its alias is already registered by different command.</p></li>
|
||
<li><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – If the command passed is not a subclass of <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.can_run">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">can_run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.can_run" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Checks if the command can be executed by checking all the predicates
|
||
inside the <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">checks</span></code></a> attribute. This also checks whether the
|
||
command is disabled.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.3: </span>Checks whether the command is disabled or not</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The ctx of the command currently being invoked.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – Any command error that was raised during a check call will be propagated
|
||
by this function.</p>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A boolean indicating if the command can be invoked.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.clean_params">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">clean_params</span></span><a class="headerlink" href="#discord.ext.commands.Group.clean_params" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Dict[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a>]:
|
||
Retrieves the parameter dictionary without the context or self parameters.</p>
|
||
<p>Useful for inspecting signature.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.cog_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">cog_name</span></span><a class="headerlink" href="#discord.ext.commands.Group.cog_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The name of the cog this command belongs to, if any.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.commands">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">commands</span></span><a class="headerlink" href="#discord.ext.commands.Group.commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A unique set of commands without aliases that are registered.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Set[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.full_parent_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">full_parent_name</span></span><a class="headerlink" href="#discord.ext.commands.Group.full_parent_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the fully qualified parent command name.</p>
|
||
<p>This the base command name required to execute it. For example,
|
||
in <code class="docutils literal notranslate"><span class="pre">?one</span> <span class="pre">two</span> <span class="pre">three</span></code> the parent name would be <code class="docutils literal notranslate"><span class="pre">one</span> <span class="pre">two</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.get_command">
|
||
<span class="sig-name descname"><span class="pre">get_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="headerlink" href="#discord.ext.commands.Group.get_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> from the internal list
|
||
of commands.</p>
|
||
<p>This could also be used as a way to get aliases.</p>
|
||
<p>The name could be fully qualified (e.g. <code class="docutils literal notranslate"><span class="pre">'foo</span> <span class="pre">bar'</span></code>) will get
|
||
the subcommand <code class="docutils literal notranslate"><span class="pre">bar</span></code> of the group command <code class="docutils literal notranslate"><span class="pre">foo</span></code>. If a
|
||
subcommand is not found then <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned just as usual.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the command to get.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The command that was requested. If not found, returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Group.get_cooldown_retry_after">
|
||
<span class="sig-name descname"><span class="pre">get_cooldown_retry_after</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.get_cooldown_retry_after" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the amount of seconds before this command can be tried again.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to retrieve the cooldown from.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The amount of time left on this command’s cooldown in seconds.
|
||
If this is <code class="docutils literal notranslate"><span class="pre">0.0</span></code> then the command isn’t on cooldown.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.has_error_handler">
|
||
<span class="sig-name descname"><span class="pre">has_error_handler</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.has_error_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>: Checks whether the command has an error handler registered.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.is_on_cooldown">
|
||
<span class="sig-name descname"><span class="pre">is_on_cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.is_on_cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Checks whether the command is currently on cooldown.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to use when checking the commands cooldown status.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A boolean indicating if the command is on cooldown.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.parents">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">parents</span></span><a class="headerlink" href="#discord.ext.commands.Group.parents" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the parents of this command.</p>
|
||
<p>If the command has no parents then it returns an empty <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>.</p>
|
||
<p>For example in commands <code class="docutils literal notranslate"><span class="pre">?a</span> <span class="pre">b</span> <span class="pre">c</span> <span class="pre">test</span></code>, the parents are <code class="docutils literal notranslate"><span class="pre">[c,</span> <span class="pre">b,</span> <span class="pre">a]</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.qualified_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">qualified_name</span></span><a class="headerlink" href="#discord.ext.commands.Group.qualified_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the fully qualified command name.</p>
|
||
<p>This is the full parent name with the command name as well.
|
||
For example, in <code class="docutils literal notranslate"><span class="pre">?one</span> <span class="pre">two</span> <span class="pre">three</span></code> the qualified name would be
|
||
<code class="docutils literal notranslate"><span class="pre">one</span> <span class="pre">two</span> <span class="pre">three</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.remove_check">
|
||
<span class="sig-name descname"><span class="pre">remove_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.remove_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes a check from the command.</p>
|
||
<p>This function is idempotent and will not raise an exception
|
||
if the function is not in the command’s checks.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>func</strong> – The function to remove from the checks.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.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="headerlink" href="#discord.ext.commands.Group.remove_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Remove a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> from the internal list
|
||
of commands.</p>
|
||
<p>This could also be used as a way to remove aliases.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the command to remove.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The command that was removed. If the name is not valid then
|
||
<code class="docutils literal notranslate"><span class="pre">None</span></code> is returned instead.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.Group.reset_cooldown">
|
||
<span class="sig-name descname"><span class="pre">reset_cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.reset_cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Resets the cooldown on this command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to reset the cooldown under.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.root_parent">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">root_parent</span></span><a class="headerlink" href="#discord.ext.commands.Group.root_parent" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the root parent of this command.</p>
|
||
<p>If the command has no parents then it returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<p>For example in commands <code class="docutils literal notranslate"><span class="pre">?a</span> <span class="pre">b</span> <span class="pre">c</span> <span class="pre">test</span></code>, the root parent is <code class="docutils literal notranslate"><span class="pre">a</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.short_doc">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">short_doc</span></span><a class="headerlink" href="#discord.ext.commands.Group.short_doc" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Gets the “short” documentation of a command.</p>
|
||
<p>By default, this is the <a class="reference internal" href="#discord.ext.commands.Command.brief" title="discord.ext.commands.Command.brief"><code class="xref py py-attr docutils literal notranslate"><span class="pre">brief</span></code></a> attribute.
|
||
If that lookup leads to an empty string then the first line of the
|
||
<a class="reference internal" href="#discord.ext.commands.Command.help" title="discord.ext.commands.Command.help"><code class="xref py py-attr docutils literal notranslate"><span class="pre">help</span></code></a> attribute is used instead.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.signature">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">signature</span></span><a class="headerlink" href="#discord.ext.commands.Group.signature" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a POSIX-like signature useful for help command output.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.update">
|
||
<span class="sig-name descname"><span class="pre">update</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">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.update" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Updates <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> instance with updated attribute.</p>
|
||
<p>This works similarly to the <a class="reference internal" href="#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">command()</span></code></a> decorator in terms
|
||
of parameters in that they are passed to the <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> or
|
||
subclass constructors, sans the name and callback.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Group.walk_commands">
|
||
<em class="property"><span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">walk_commands</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Group.walk_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An iterator that recursively walks through all commands and subcommands.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.4: </span>Duplicates due to aliases are no longer returned</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>] – A command or group from the internal list of commands.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="groupmixin">
|
||
<h3>GroupMixin<a class="headerlink" href="#groupmixin" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.GroupMixin"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.GroupMixin.all_commands">all_commands</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.GroupMixin.case_insensitive">case_insensitive</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.GroupMixin.commands">commands</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command">add_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.GroupMixin.command">command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.GroupMixin.get_command">get_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="decorator">
|
||
@</span><a class="reference internal" href="#discord.ext.commands.GroupMixin.group">group</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.GroupMixin.remove_command">remove_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.GroupMixin.walk_commands">walk_commands</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GroupMixin">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GroupMixin</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GroupMixin" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A mixin that implements common functionality for classes that behave
|
||
similar to <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a> and are allowed to register commands.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GroupMixin.all_commands">
|
||
<span class="sig-name descname"><span class="pre">all_commands</span></span><a class="headerlink" href="#discord.ext.commands.GroupMixin.all_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A mapping of command name to <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>
|
||
objects.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GroupMixin.case_insensitive">
|
||
<span class="sig-name descname"><span class="pre">case_insensitive</span></span><a class="headerlink" href="#discord.ext.commands.GroupMixin.case_insensitive" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether the commands should be case insensitive. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><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="discord.ext.commands.GroupMixin.command">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">command</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GroupMixin.command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut decorator that invokes <a class="reference internal" href="#discord.ext.commands.command" title="discord.ext.commands.command"><code class="xref py py-func docutils literal notranslate"><span class="pre">command()</span></code></a> and adds it to
|
||
the internal command list via <a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command" title="discord.ext.commands.GroupMixin.add_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_command()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A decorator that converts the provided method into a Command, adds it to the bot, then returns it.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Callable[…, <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.GroupMixin.group">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-name descname"><span class="pre">group</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GroupMixin.group" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut decorator that invokes <a class="reference internal" href="#discord.ext.commands.group" title="discord.ext.commands.group"><code class="xref py py-func docutils literal notranslate"><span class="pre">group()</span></code></a> and adds it to
|
||
the internal command list via <a class="reference internal" href="#discord.ext.commands.GroupMixin.add_command" title="discord.ext.commands.GroupMixin.add_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_command()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A decorator that converts the provided method into a Group, adds it to the bot, then returns it.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Callable[…, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GroupMixin.commands">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">commands</span></span><a class="headerlink" href="#discord.ext.commands.GroupMixin.commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A unique set of commands without aliases that are registered.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Set[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.GroupMixin.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="headerlink" href="#discord.ext.commands.GroupMixin.add_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> into the internal list of commands.</p>
|
||
<p>This is usually not called, instead the <a class="reference internal" href="#discord.ext.commands.GroupMixin.command" title="discord.ext.commands.GroupMixin.command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">command()</span></code></a> or
|
||
<a class="reference internal" href="#discord.ext.commands.GroupMixin.group" title="discord.ext.commands.GroupMixin.group"><code class="xref py py-meth docutils literal notranslate"><span class="pre">group()</span></code></a> shortcut decorators are used instead.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.4: </span>Raise <a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandRegistrationError</span></code></a> instead of generic <a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ClientException</span></code></a></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to add.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><strong>CommandRegistrationError</strong></a> – If the command or its alias is already registered by different command.</p></li>
|
||
<li><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – If the command passed is not a subclass of <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GroupMixin.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="headerlink" href="#discord.ext.commands.GroupMixin.remove_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Remove a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> from the internal list
|
||
of commands.</p>
|
||
<p>This could also be used as a way to remove aliases.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the command to remove.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The command that was removed. If the name is not valid then
|
||
<code class="docutils literal notranslate"><span class="pre">None</span></code> is returned instead.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.GroupMixin.walk_commands">
|
||
<em class="property"><span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">walk_commands</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GroupMixin.walk_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An iterator that recursively walks through all commands and subcommands.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.4: </span>Duplicates due to aliases are no longer returned</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>] – A command or group from the internal list of commands.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GroupMixin.get_command">
|
||
<span class="sig-name descname"><span class="pre">get_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="headerlink" href="#discord.ext.commands.GroupMixin.get_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> from the internal list
|
||
of commands.</p>
|
||
<p>This could also be used as a way to get aliases.</p>
|
||
<p>The name could be fully qualified (e.g. <code class="docutils literal notranslate"><span class="pre">'foo</span> <span class="pre">bar'</span></code>) will get
|
||
the subcommand <code class="docutils literal notranslate"><span class="pre">bar</span></code> of the group command <code class="docutils literal notranslate"><span class="pre">foo</span></code>. If a
|
||
subcommand is not found then <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned just as usual.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the command to get.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The command that was requested. If not found, returns <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
</section>
|
||
<section id="cogs">
|
||
<span id="ext-commands-api-cogs"></span><h2>Cogs<a class="headerlink" href="#cogs" title="Permalink to this headline">¶</a></h2>
|
||
<section id="cog">
|
||
<h3>Cog<a class="headerlink" href="#cog" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Cog"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Cog.description">description</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Cog.qualified_name">qualified_name</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="classmethod">
|
||
cls</span><a class="reference internal" href="#discord.ext.commands.Cog.listener">Cog.listener</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.bot_check">bot_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.bot_check_once">bot_check_once</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Cog.cog_after_invoke">cog_after_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Cog.cog_before_invoke">cog_before_invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.cog_check">cog_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Cog.cog_command_error">cog_command_error</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.cog_unload">cog_unload</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.get_commands">get_commands</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.get_listeners">get_listeners</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.has_error_handler">has_error_handler</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cog.walk_commands">walk_commands</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Cog</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The base class that all cogs must inherit from.</p>
|
||
<p>A cog is a collection of commands, listeners, and optional state to
|
||
help group commands together. More information on them can be found on
|
||
the <a class="reference internal" href="cogs.html#ext-commands-cogs"><span class="std std-ref">Cogs</span></a> page.</p>
|
||
<p>When inheriting from this class, the options shown in <a class="reference internal" href="#discord.ext.commands.CogMeta" title="discord.ext.commands.CogMeta"><code class="xref py py-class docutils literal notranslate"><span class="pre">CogMeta</span></code></a>
|
||
are equally valid here.</p>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.get_commands">
|
||
<span class="sig-name descname"><span class="pre">get_commands</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.get_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><p>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 <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>s that are
|
||
defined inside this cog.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This does not include subcommands.</p>
|
||
</div>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>List[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.qualified_name">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">qualified_name</span></span><a class="headerlink" href="#discord.ext.commands.Cog.qualified_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the cog’s specified name, not the class name.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.description">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">description</span></span><a class="headerlink" href="#discord.ext.commands.Cog.description" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the cog’s description, typically the cleaned docstring.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.walk_commands">
|
||
<em class="property"><span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">walk_commands</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.walk_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An iterator that recursively walks through this cog’s commands and subcommands.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>] – A command or group from the cog.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.get_listeners">
|
||
<span class="sig-name descname"><span class="pre">get_listeners</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.get_listeners" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns 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 (name, function) listener pairs that are defined in this cog.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The listeners defined in this cog.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>List[Tuple[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.listener">
|
||
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">listener</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">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.listener" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that marks a function as a listener.</p>
|
||
<p>This is the cog equivalent of <a class="reference internal" href="#discord.ext.commands.Bot.listen" title="discord.ext.commands.Bot.listen"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.listen()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The name of the event being listened to. If not provided, it
|
||
defaults to the function’s name.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The function is not a coroutine function or a string was not passed as
|
||
the name.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.has_error_handler">
|
||
<span class="sig-name descname"><span class="pre">has_error_handler</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.has_error_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>: Checks whether the cog has an error handler.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.cog_unload">
|
||
<span class="sig-name descname"><span class="pre">cog_unload</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.cog_unload" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that is called when the cog gets removed.</p>
|
||
<p>This function <strong>cannot</strong> be a coroutine. It must be a regular
|
||
function.</p>
|
||
<p>Subclasses must replace this if they want special unloading behaviour.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.bot_check_once">
|
||
<span class="sig-name descname"><span class="pre">bot_check_once</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.bot_check_once" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that registers as a <a class="reference internal" href="#discord.ext.commands.Bot.check_once" title="discord.ext.commands.Bot.check_once"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.check_once()</span></code></a>
|
||
check.</p>
|
||
<p>This function <strong>can</strong> be a coroutine and must take a sole parameter,
|
||
<code class="docutils literal notranslate"><span class="pre">ctx</span></code>, to represent the <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.bot_check">
|
||
<span class="sig-name descname"><span class="pre">bot_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.bot_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that registers as a <a class="reference internal" href="#discord.ext.commands.Bot.check" title="discord.ext.commands.Bot.check"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.check()</span></code></a>
|
||
check.</p>
|
||
<p>This function <strong>can</strong> be a coroutine and must take a sole parameter,
|
||
<code class="docutils literal notranslate"><span class="pre">ctx</span></code>, to represent the <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.cog_check">
|
||
<span class="sig-name descname"><span class="pre">cog_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.cog_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that registers as a <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a>
|
||
for every command and subcommand in this cog.</p>
|
||
<p>This function <strong>can</strong> be a coroutine and must take a sole parameter,
|
||
<code class="docutils literal notranslate"><span class="pre">ctx</span></code>, to represent the <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.cog_command_error">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">cog_command_error</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">error</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.cog_command_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that is called whenever an error
|
||
is dispatched inside this cog.</p>
|
||
<p>This is similar to <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> except only applying
|
||
to the commands inside this cog.</p>
|
||
<p>This <strong>must</strong> be a coroutine.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context where the error happened.</p></li>
|
||
<li><p><strong>error</strong> (<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandError</span></code></a>) – The error that happened.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.cog_before_invoke">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">cog_before_invoke</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.cog_before_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that acts as a cog local pre-invoke hook.</p>
|
||
<p>This is similar to <a class="reference internal" href="#discord.ext.commands.Command.before_invoke" title="discord.ext.commands.Command.before_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.before_invoke()</span></code></a>.</p>
|
||
<p>This <strong>must</strong> be a coroutine.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cog.cog_after_invoke">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">cog_after_invoke</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cog.cog_after_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special method that acts as a cog local post-invoke hook.</p>
|
||
<p>This is similar to <a class="reference internal" href="#discord.ext.commands.Command.after_invoke" title="discord.ext.commands.Command.after_invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Command.after_invoke()</span></code></a>.</p>
|
||
<p>This <strong>must</strong> be a coroutine.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="cogmeta">
|
||
<h3>CogMeta<a class="headerlink" href="#cogmeta" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.CogMeta"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.CogMeta.command_attrs">command_attrs</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.CogMeta.description">description</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.CogMeta.name">name</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CogMeta">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CogMeta</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CogMeta" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A metaclass for defining a cog.</p>
|
||
<p>Note that you should probably not use this directly. It is exposed
|
||
purely for documentation purposes along with making custom metaclasses to intermix
|
||
with other metaclasses such as the <a class="reference external" href="https://docs.python.org/3/library/abc.html#abc.ABCMeta" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABCMeta</span></code></a> metaclass.</p>
|
||
<p>For example, to create an abstract cog mixin class, the following would be done.</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">abc</span>
|
||
|
||
<span class="k">class</span> <span class="nc">CogABCMeta</span><span class="p">(</span><span class="n">commands</span><span class="o">.</span><span class="n">CogMeta</span><span class="p">,</span> <span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>
|
||
<span class="k">pass</span>
|
||
|
||
<span class="k">class</span> <span class="nc">SomeMixin</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>
|
||
<span class="k">pass</span>
|
||
|
||
<span class="k">class</span> <span class="nc">SomeCogMixin</span><span class="p">(</span><span class="n">SomeMixin</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">metaclass</span><span class="o">=</span><span class="n">CogABCMeta</span><span class="p">):</span>
|
||
<span class="k">pass</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>When passing an attribute of a metaclass that is documented below, note
|
||
that you must pass it as a keyword-only argument to the class creation
|
||
like the following example:</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">'My Cog'</span><span class="p">):</span>
|
||
<span class="k">pass</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CogMeta.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.CogMeta.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The cog name. By default, it is the name of the class with no modification.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CogMeta.description">
|
||
<span class="sig-name descname"><span class="pre">description</span></span><a class="headerlink" href="#discord.ext.commands.CogMeta.description" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The cog description. By default, it is the cleaned docstring of the class.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.6.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CogMeta.command_attrs">
|
||
<span class="sig-name descname"><span class="pre">command_attrs</span></span><a class="headerlink" href="#discord.ext.commands.CogMeta.command_attrs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A list of attributes to apply to every command inside this cog. The dictionary
|
||
is passed into the <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> options at <code class="docutils literal notranslate"><span class="pre">__init__</span></code>.
|
||
If you specify attributes inside the command attribute in the class, it will
|
||
override the one specified inside this attribute. For example:</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">command_attrs</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">hidden</span><span class="o">=</span><span class="kc">True</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">foo</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="k">pass</span> <span class="c1"># hidden -> True</span>
|
||
|
||
<span class="nd">@commands</span><span class="o">.</span><span class="n">command</span><span class="p">(</span><span class="n">hidden</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">bar</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="k">pass</span> <span class="c1"># hidden -> False</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
</section>
|
||
<section id="help-commands">
|
||
<span id="ext-commands-help-command"></span><h2>Help Commands<a class="headerlink" href="#help-commands" title="Permalink to this headline">¶</a></h2>
|
||
<section id="helpcommand">
|
||
<h3>HelpCommand<a class="headerlink" href="#helpcommand" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.HelpCommand"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.cog">cog</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.command_attrs">command_attrs</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.context">context</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.invoked_with">invoked_with</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.show_hidden">show_hidden</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.verify_checks">verify_checks</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.add_check">add_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.command_callback">command_callback</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.command_not_found">command_not_found</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.filter_commands">filter_commands</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.get_bot_mapping">get_bot_mapping</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.get_command_signature">get_command_signature</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination">get_destination</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.get_max_size">get_max_size</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.on_help_command_error">on_help_command_error</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.prepare_help_command">prepare_help_command</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.remove_check">remove_check</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.remove_mentions">remove_mentions</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_bot_help">send_bot_help</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_cog_help">send_cog_help</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_command_help">send_command_help</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_error_message">send_error_message</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_group_help">send_group_help</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.HelpCommand.subcommand_not_found">subcommand_not_found</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">HelpCommand</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The base implementation for help command formatting.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Internally instances of this class are deep copied every time
|
||
the command itself is invoked to prevent a race condition
|
||
mentioned in <a class="reference external" href="https://github.com/Rapptz/discord.py/issues/2123">GH-2123</a>.</p>
|
||
<p>This means that relying on the state of this class to be
|
||
the same between command invocations would not work as expected.</p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.context">
|
||
<span class="sig-name descname"><span class="pre">context</span></span><a class="headerlink" href="#discord.ext.commands.HelpCommand.context" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The context that invoked this help formatter. This is generally set after
|
||
the help command assigned, <a class="reference internal" href="#discord.ext.commands.HelpCommand.command_callback" title="discord.ext.commands.HelpCommand.command_callback"><code class="xref py py-func docutils literal notranslate"><span class="pre">command_callback()</span></code></a>, has been called.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.show_hidden">
|
||
<span class="sig-name descname"><span class="pre">show_hidden</span></span><a class="headerlink" href="#discord.ext.commands.HelpCommand.show_hidden" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Specifies if hidden commands should be shown in the output.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.verify_checks">
|
||
<span class="sig-name descname"><span class="pre">verify_checks</span></span><a class="headerlink" href="#discord.ext.commands.HelpCommand.verify_checks" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Specifies if commands should have their <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.checks</span></code></a> called
|
||
and verified. If <code class="docutils literal notranslate"><span class="pre">True</span></code>, always calls <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.checks</span></code></a>.
|
||
If <code class="docutils literal notranslate"><span class="pre">None</span></code>, only calls <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.checks</span></code></a> in a guild setting.
|
||
If <code class="docutils literal notranslate"><span class="pre">False</span></code>, never calls <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.checks</span></code></a>. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.command_attrs">
|
||
<span class="sig-name descname"><span class="pre">command_attrs</span></span><a class="headerlink" href="#discord.ext.commands.HelpCommand.command_attrs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A dictionary of options to pass in for the construction of the help command.
|
||
This allows you to change the command behaviour without actually changing
|
||
the implementation of the command. The attributes will be the same as the
|
||
ones passed in the <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> constructor.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><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="discord.ext.commands.HelpCommand.add_check">
|
||
<span class="sig-name descname"><span class="pre">add_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.add_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a check to the help command.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>func</strong> – The function that will be used as a check.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.remove_check">
|
||
<span class="sig-name descname"><span class="pre">remove_check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.remove_check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes a check from the help command.</p>
|
||
<p>This function is idempotent and will not raise an exception if
|
||
the function is not in the command’s checks.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>func</strong> – The function to remove from the checks.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.get_bot_mapping">
|
||
<span class="sig-name descname"><span class="pre">get_bot_mapping</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.get_bot_mapping" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the bot mapping passed to <a class="reference internal" href="#discord.ext.commands.HelpCommand.send_bot_help" title="discord.ext.commands.HelpCommand.send_bot_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_bot_help()</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.invoked_with">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">invoked_with</span></span><a class="headerlink" href="#discord.ext.commands.HelpCommand.invoked_with" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Similar to <a class="reference internal" href="#discord.ext.commands.Context.invoked_with" title="discord.ext.commands.Context.invoked_with"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Context.invoked_with</span></code></a> except properly handles
|
||
the case where <a class="reference internal" href="#discord.ext.commands.Context.send_help" title="discord.ext.commands.Context.send_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Context.send_help()</span></code></a> is used.</p>
|
||
<p>If the help command was used regularly then this returns
|
||
the <a class="reference internal" href="#discord.ext.commands.Context.invoked_with" title="discord.ext.commands.Context.invoked_with"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Context.invoked_with</span></code></a> attribute. Otherwise, if
|
||
it the help command was called using <a class="reference internal" href="#discord.ext.commands.Context.send_help" title="discord.ext.commands.Context.send_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Context.send_help()</span></code></a>
|
||
then it returns the internal command name of the help command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The command name that triggered this invocation.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.get_command_signature">
|
||
<span class="sig-name descname"><span class="pre">get_command_signature</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="headerlink" href="#discord.ext.commands.HelpCommand.get_command_signature" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the signature portion of the help page.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to get the signature of.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The signature for the command.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.remove_mentions">
|
||
<span class="sig-name descname"><span class="pre">remove_mentions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.remove_mentions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Removes mentions from the string to prevent abuse.</p>
|
||
<p>This includes <code class="docutils literal notranslate"><span class="pre">@everyone</span></code>, <code class="docutils literal notranslate"><span class="pre">@here</span></code>, member mentions and role mentions.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The string with mentions removed.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.cog">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">cog</span></span><a class="headerlink" href="#discord.ext.commands.HelpCommand.cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A property for retrieving or setting the cog for the help command.</p>
|
||
<p>When a cog is set for the help command, it is as-if the help command
|
||
belongs to that cog. All cog special methods will apply to the help
|
||
command and it will be automatically unset on unload.</p>
|
||
<p>To unbind the cog from the help command, you can set it to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The cog that is currently set for the help command.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.command_not_found">
|
||
<span class="sig-name descname"><span class="pre">command_not_found</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.command_not_found" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function <em>could be a</em> <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A method called when a command is not found in the help command.
|
||
This is useful to override for i18n.</p>
|
||
<p>Defaults to <code class="docutils literal notranslate"><span class="pre">No</span> <span class="pre">command</span> <span class="pre">called</span> <span class="pre">{0}</span> <span class="pre">found.</span></code></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>string</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The string that contains the invalid command. Note that this has
|
||
had mentions removed to prevent abuse.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The string to use when a command has not been found.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.subcommand_not_found">
|
||
<span class="sig-name descname"><span class="pre">subcommand_not_found</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">string</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.subcommand_not_found" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function <em>could be a</em> <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A method called when a command did not have a subcommand requested in the help command.
|
||
This is useful to override for i18n.</p>
|
||
<p>Defaults to either:</p>
|
||
<ul class="simple">
|
||
<li><dl class="simple">
|
||
<dt><code class="docutils literal notranslate"><span class="pre">'Command</span> <span class="pre">"{command.qualified_name}"</span> <span class="pre">has</span> <span class="pre">no</span> <span class="pre">subcommands.'</span></code></dt><dd><ul>
|
||
<li><p>If there is no subcommand in the <code class="docutils literal notranslate"><span class="pre">command</span></code> parameter.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><dl class="simple">
|
||
<dt><code class="docutils literal notranslate"><span class="pre">'Command</span> <span class="pre">"{command.qualified_name}"</span> <span class="pre">has</span> <span class="pre">no</span> <span class="pre">subcommand</span> <span class="pre">named</span> <span class="pre">{string}'</span></code></dt><dd><ul>
|
||
<li><p>If the <code class="docutils literal notranslate"><span class="pre">command</span></code> parameter has subcommands but not one named <code class="docutils literal notranslate"><span class="pre">string</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
</ul>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command that did not have the subcommand requested.</p></li>
|
||
<li><p><strong>string</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The string that contains the invalid subcommand. Note that this has
|
||
had mentions removed to prevent abuse.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The string to use when the command did not have the subcommand requested.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.filter_commands">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">filter_commands</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">commands</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">sort</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</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="headerlink" href="#discord.ext.commands.HelpCommand.filter_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Returns a filtered list of commands and optionally sorts them.</p>
|
||
<p>This takes into account the <a class="reference internal" href="#discord.ext.commands.HelpCommand.verify_checks" title="discord.ext.commands.HelpCommand.verify_checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">verify_checks</span></code></a> and <a class="reference internal" href="#discord.ext.commands.HelpCommand.show_hidden" title="discord.ext.commands.HelpCommand.show_hidden"><code class="xref py py-attr docutils literal notranslate"><span class="pre">show_hidden</span></code></a>
|
||
attributes.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>commands</strong> (Iterable[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]) – An iterable of commands that are getting filtered.</p></li>
|
||
<li><p><strong>sort</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether to sort the result.</p></li>
|
||
<li><p><strong>key</strong> (Optional[Callable[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>, Any]]) – An optional key function to pass to <a class="reference external" href="https://docs.python.org/3/library/functions.html#sorted" title="(in Python v3.9)"><code class="docutils literal notranslate"><span class="pre">sorted()</span></code></a> that
|
||
takes a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> as its sole parameter. If <code class="docutils literal notranslate"><span class="pre">sort</span></code> is
|
||
passed as <code class="docutils literal notranslate"><span class="pre">True</span></code> then this will default as the command name.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A list of commands that passed the filter.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><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="discord.ext.commands.HelpCommand.get_max_size">
|
||
<span class="sig-name descname"><span class="pre">get_max_size</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">commands</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.get_max_size" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the largest name length of the specified command list.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>commands</strong> (Sequence[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]) – A sequence of commands to check for the largest size.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The maximum width of the commands.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.get_destination">
|
||
<span class="sig-name descname"><span class="pre">get_destination</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.get_destination" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the <a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Messageable</span></code></a> where the help command will be output.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<p>By default this returns the context’s channel.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The destination where the help command will be output.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.Messageable</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.send_error_message">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_error_message</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">error</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.send_error_message" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Handles the implementation when an error happens in the help command.
|
||
For example, the result of <a class="reference internal" href="#discord.ext.commands.HelpCommand.command_not_found" title="discord.ext.commands.HelpCommand.command_not_found"><code class="xref py py-meth docutils literal notranslate"><span class="pre">command_not_found()</span></code></a> will be passed here.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<p>By default, this sends the error message to the destination
|
||
specified by <a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination" title="discord.ext.commands.HelpCommand.get_destination"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_destination()</span></code></a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>You can access the invocation context with <a class="reference internal" href="#discord.ext.commands.HelpCommand.context" title="discord.ext.commands.HelpCommand.context"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HelpCommand.context</span></code></a>.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>error</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The error message to display to the user. Note that this has
|
||
had mentions removed to prevent abuse.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.on_help_command_error">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">on_help_command_error</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">error</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.on_help_command_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The help command’s error handler, as specified by <a class="reference internal" href="commands.html#ext-commands-error-handler"><span class="std std-ref">Error Handling</span></a>.</p>
|
||
<p>Useful to override if you need some specific behaviour when the error handler
|
||
is called.</p>
|
||
<p>By default this method does nothing and just propagates to the default
|
||
error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p></li>
|
||
<li><p><strong>error</strong> (<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandError</span></code></a>) – The error that was raised.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.send_bot_help">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_bot_help</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mapping</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.send_bot_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Handles the implementation of the bot command page in the help command.
|
||
This function is called when the help command is called with no arguments.</p>
|
||
<p>It should be noted that this method does not return anything – rather the
|
||
actual message sending should be done inside this method. Well behaved subclasses
|
||
should use <a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination" title="discord.ext.commands.HelpCommand.get_destination"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_destination()</span></code></a> to know where to send, as this is a customisation
|
||
point for other users.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>You can access the invocation context with <a class="reference internal" href="#discord.ext.commands.HelpCommand.context" title="discord.ext.commands.HelpCommand.context"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HelpCommand.context</span></code></a>.</p>
|
||
<p>Also, the commands in the mapping are not filtered. To do the filtering
|
||
you will have to call <a class="reference internal" href="#discord.ext.commands.HelpCommand.filter_commands" title="discord.ext.commands.HelpCommand.filter_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">filter_commands()</span></code></a> yourself.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>mapping</strong> (Mapping[Optional[<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>], List[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]]) – A mapping of cogs to commands that have been requested by the user for help.
|
||
The key of the mapping is the <a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a> that the command belongs to, or
|
||
<code class="docutils literal notranslate"><span class="pre">None</span></code> if there isn’t one, and the value is a list of commands that belongs to that cog.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.send_cog_help">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_cog_help</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="headerlink" href="#discord.ext.commands.HelpCommand.send_cog_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Handles the implementation of the cog page in the help command.
|
||
This function is called when the help command is called with a cog as the argument.</p>
|
||
<p>It should be noted that this method does not return anything – rather the
|
||
actual message sending should be done inside this method. Well behaved subclasses
|
||
should use <a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination" title="discord.ext.commands.HelpCommand.get_destination"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_destination()</span></code></a> to know where to send, as this is a customisation
|
||
point for other users.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>You can access the invocation context with <a class="reference internal" href="#discord.ext.commands.HelpCommand.context" title="discord.ext.commands.HelpCommand.context"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HelpCommand.context</span></code></a>.</p>
|
||
<p>To get the commands that belong to this cog see <a class="reference internal" href="#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>.
|
||
The commands returned not filtered. To do the filtering you will have to call
|
||
<a class="reference internal" href="#discord.ext.commands.HelpCommand.filter_commands" title="discord.ext.commands.HelpCommand.filter_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">filter_commands()</span></code></a> yourself.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>cog</strong> (<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>) – The cog that was requested for help.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.send_group_help">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_group_help</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">group</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.HelpCommand.send_group_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Handles the implementation of the group page in the help command.
|
||
This function is called when the help command is called with a group as the argument.</p>
|
||
<p>It should be noted that this method does not return anything – rather the
|
||
actual message sending should be done inside this method. Well behaved subclasses
|
||
should use <a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination" title="discord.ext.commands.HelpCommand.get_destination"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_destination()</span></code></a> to know where to send, as this is a customisation
|
||
point for other users.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>You can access the invocation context with <a class="reference internal" href="#discord.ext.commands.HelpCommand.context" title="discord.ext.commands.HelpCommand.context"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HelpCommand.context</span></code></a>.</p>
|
||
<p>To get the commands that belong to this group without aliases see
|
||
<a class="reference internal" href="#discord.ext.commands.Group.commands" title="discord.ext.commands.Group.commands"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Group.commands</span></code></a>. The commands returned not filtered. To do the
|
||
filtering you will have to call <a class="reference internal" href="#discord.ext.commands.HelpCommand.filter_commands" title="discord.ext.commands.HelpCommand.filter_commands"><code class="xref py py-meth docutils literal notranslate"><span class="pre">filter_commands()</span></code></a> yourself.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>group</strong> (<a class="reference internal" href="#discord.ext.commands.Group" title="discord.ext.commands.Group"><code class="xref py py-class docutils literal notranslate"><span class="pre">Group</span></code></a>) – The group that was requested for help.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.send_command_help">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_command_help</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="headerlink" href="#discord.ext.commands.HelpCommand.send_command_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Handles the implementation of the single command page in the help command.</p>
|
||
<p>It should be noted that this method does not return anything – rather the
|
||
actual message sending should be done inside this method. Well behaved subclasses
|
||
should use <a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination" title="discord.ext.commands.HelpCommand.get_destination"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_destination()</span></code></a> to know where to send, as this is a customisation
|
||
point for other users.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>You can access the invocation context with <a class="reference internal" href="#discord.ext.commands.HelpCommand.context" title="discord.ext.commands.HelpCommand.context"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HelpCommand.context</span></code></a>.</p>
|
||
</div>
|
||
<div class="helpful admonition">
|
||
<p class="admonition-title">Showing Help</p>
|
||
<p>There are certain attributes and methods that are helpful for a help command
|
||
to show such as the following:</p>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.Command.help" title="discord.ext.commands.Command.help"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.help</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.Command.brief" title="discord.ext.commands.Command.brief"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.brief</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.Command.short_doc" title="discord.ext.commands.Command.short_doc"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.short_doc</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.Command.description" title="discord.ext.commands.Command.description"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.description</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.get_command_signature" title="discord.ext.commands.HelpCommand.get_command_signature"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_command_signature()</span></code></a></p></li>
|
||
</ul>
|
||
<p>There are more than just these attributes but feel free to play around with
|
||
these to help you get started to get the output that you want.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command that was requested for help.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.prepare_help_command">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">prepare_help_command</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">command</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="headerlink" href="#discord.ext.commands.HelpCommand.prepare_help_command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A low level method that can be used to prepare the help command
|
||
before it does anything. For example, if you need to prepare
|
||
some state in your subclass before the command does its processing
|
||
then this would be the place to do it.</p>
|
||
<p>The default implementation does nothing.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This is called <em>inside</em> the help command callback body. So all
|
||
the usual rules that happen inside apply here as well.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p></li>
|
||
<li><p><strong>command</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The argument passed to the help command.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.HelpCommand.command_callback">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">command_callback</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="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">command</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="headerlink" href="#discord.ext.commands.HelpCommand.command_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The actual implementation of the help command.</p>
|
||
<p>It is not recommended to override this method and instead change
|
||
the behaviour through the methods that actually get dispatched.</p>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_bot_help" title="discord.ext.commands.HelpCommand.send_bot_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_bot_help()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_cog_help" title="discord.ext.commands.HelpCommand.send_cog_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_cog_help()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_group_help" title="discord.ext.commands.HelpCommand.send_group_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_group_help()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_command_help" title="discord.ext.commands.HelpCommand.send_command_help"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_command_help()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.get_destination" title="discord.ext.commands.HelpCommand.get_destination"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_destination()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.command_not_found" title="discord.ext.commands.HelpCommand.command_not_found"><code class="xref py py-meth docutils literal notranslate"><span class="pre">command_not_found()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.subcommand_not_found" title="discord.ext.commands.HelpCommand.subcommand_not_found"><code class="xref py py-meth docutils literal notranslate"><span class="pre">subcommand_not_found()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.send_error_message" title="discord.ext.commands.HelpCommand.send_error_message"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_error_message()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.on_help_command_error" title="discord.ext.commands.HelpCommand.on_help_command_error"><code class="xref py py-meth docutils literal notranslate"><span class="pre">on_help_command_error()</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.HelpCommand.prepare_help_command" title="discord.ext.commands.HelpCommand.prepare_help_command"><code class="xref py py-meth docutils literal notranslate"><span class="pre">prepare_help_command()</span></code></a></p></li>
|
||
</ul>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="defaulthelpcommand">
|
||
<h3>DefaultHelpCommand<a class="headerlink" href="#defaulthelpcommand" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.DefaultHelpCommand"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.commands_heading">commands_heading</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.dm_help">dm_help</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.dm_help_threshold">dm_help_threshold</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.indent">indent</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.no_category">no_category</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.paginator">paginator</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.sort_commands">sort_commands</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.width">width</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.add_command_formatting">add_command_formatting</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.add_indented_commands">add_indented_commands</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.get_destination">get_destination</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.get_ending_note">get_ending_note</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.send_pages">send_pages</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.shorten_text">shorten_text</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">DefaultHelpCommand</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The implementation of the default help command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.HelpCommand" title="discord.ext.commands.HelpCommand"><code class="xref py py-class docutils literal notranslate"><span class="pre">HelpCommand</span></code></a>.</p>
|
||
<p>It extends it with the following attributes.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.width">
|
||
<span class="sig-name descname"><span class="pre">width</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.width" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The maximum number of characters that fit in a line.
|
||
Defaults to 80.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.sort_commands">
|
||
<span class="sig-name descname"><span class="pre">sort_commands</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.sort_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to sort the commands in the output alphabetically. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.dm_help">
|
||
<span class="sig-name descname"><span class="pre">dm_help</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.dm_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A tribool that indicates if the help command should DM the user instead of
|
||
sending it to the channel it received it from. If the boolean is set to
|
||
<code class="docutils literal notranslate"><span class="pre">True</span></code>, then all help output is DM’d. If <code class="docutils literal notranslate"><span class="pre">False</span></code>, none of the help
|
||
output is DM’d. If <code class="docutils literal notranslate"><span class="pre">None</span></code>, then the bot will only DM when the help
|
||
message becomes too long (dictated by more than <a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.dm_help_threshold" title="discord.ext.commands.DefaultHelpCommand.dm_help_threshold"><code class="xref py py-attr docutils literal notranslate"><span class="pre">dm_help_threshold</span></code></a> characters).
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.dm_help_threshold">
|
||
<span class="sig-name descname"><span class="pre">dm_help_threshold</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.dm_help_threshold" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The number of characters the paginator must accumulate before getting DM’d to the
|
||
user if <a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.dm_help" title="discord.ext.commands.DefaultHelpCommand.dm_help"><code class="xref py py-attr docutils literal notranslate"><span class="pre">dm_help</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">None</span></code>. Defaults to 1000.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.indent">
|
||
<span class="sig-name descname"><span class="pre">indent</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.indent" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>How much to indent the commands from a heading. Defaults to <code class="docutils literal notranslate"><span class="pre">2</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.commands_heading">
|
||
<span class="sig-name descname"><span class="pre">commands_heading</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.commands_heading" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command list’s heading string used when the help command is invoked with a category name.
|
||
Useful for i18n. Defaults to <code class="docutils literal notranslate"><span class="pre">"Commands:"</span></code></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.no_category">
|
||
<span class="sig-name descname"><span class="pre">no_category</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.no_category" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The string used when there is a command which does not belong to any category(cog).
|
||
Useful for i18n. Defaults to <code class="docutils literal notranslate"><span class="pre">"No</span> <span class="pre">Category"</span></code></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.paginator">
|
||
<span class="sig-name descname"><span class="pre">paginator</span></span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.paginator" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The paginator used to paginate the help command output.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Paginator" title="discord.ext.commands.Paginator"><code class="xref py py-class docutils literal notranslate"><span class="pre">Paginator</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.shorten_text">
|
||
<span class="sig-name descname"><span class="pre">shorten_text</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.shorten_text" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>: Shortens text to fit into the <a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.width" title="discord.ext.commands.DefaultHelpCommand.width"><code class="xref py py-attr docutils literal notranslate"><span class="pre">width</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.get_ending_note">
|
||
<span class="sig-name descname"><span class="pre">get_ending_note</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.get_ending_note" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>: Returns help command’s ending note. This is mainly useful to override for i18n purposes.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.add_indented_commands">
|
||
<span class="sig-name descname"><span class="pre">add_indented_commands</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">commands</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">heading</span></span></em>, <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">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.add_indented_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Indents a list of commands after the specified heading.</p>
|
||
<p>The formatting is added to the <a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.paginator" title="discord.ext.commands.DefaultHelpCommand.paginator"><code class="xref py py-attr docutils literal notranslate"><span class="pre">paginator</span></code></a>.</p>
|
||
<p>The default implementation is the command name indented by
|
||
<a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.indent" title="discord.ext.commands.DefaultHelpCommand.indent"><code class="xref py py-attr docutils literal notranslate"><span class="pre">indent</span></code></a> spaces, padded to <code class="docutils literal notranslate"><span class="pre">max_size</span></code> followed by
|
||
the command’s <a class="reference internal" href="#discord.ext.commands.Command.short_doc" title="discord.ext.commands.Command.short_doc"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.short_doc</span></code></a> and then shortened
|
||
to fit into the <a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.width" title="discord.ext.commands.DefaultHelpCommand.width"><code class="xref py py-attr docutils literal notranslate"><span class="pre">width</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>commands</strong> (Sequence[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]) – A list of commands to indent for output.</p></li>
|
||
<li><p><strong>heading</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The heading to add to the output. This is only added
|
||
if the list of commands is greater than 0.</p></li>
|
||
<li><p><strong>max_size</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – The max size to use for the gap between indents.
|
||
If unspecified, calls <a class="reference internal" href="#discord.ext.commands.HelpCommand.get_max_size" title="discord.ext.commands.HelpCommand.get_max_size"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_max_size()</span></code></a> on the
|
||
commands parameter.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.send_pages">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_pages</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.send_pages" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A helper utility to send the page output from <a class="reference internal" href="#discord.ext.commands.DefaultHelpCommand.paginator" title="discord.ext.commands.DefaultHelpCommand.paginator"><code class="xref py py-attr docutils literal notranslate"><span class="pre">paginator</span></code></a> to the destination.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.add_command_formatting">
|
||
<span class="sig-name descname"><span class="pre">add_command_formatting</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="headerlink" href="#discord.ext.commands.DefaultHelpCommand.add_command_formatting" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A utility function to format the non-indented block of commands and groups.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to format.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DefaultHelpCommand.get_destination">
|
||
<span class="sig-name descname"><span class="pre">get_destination</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DefaultHelpCommand.get_destination" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the <a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Messageable</span></code></a> where the help command will be output.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<p>By default this returns the context’s channel.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The destination where the help command will be output.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.Messageable</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="minimalhelpcommand">
|
||
<h3>MinimalHelpCommand<a class="headerlink" href="#minimalhelpcommand" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.MinimalHelpCommand"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.aliases_heading">aliases_heading</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.commands_heading">commands_heading</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.dm_help">dm_help</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.dm_help_threshold">dm_help_threshold</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.no_category">no_category</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.paginator">paginator</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.sort_commands">sort_commands</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.add_aliases_formatting">add_aliases_formatting</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.add_bot_commands_formatting">add_bot_commands_formatting</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.add_command_formatting">add_command_formatting</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.add_subcommand_formatting">add_subcommand_formatting</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.get_command_signature">get_command_signature</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.get_destination">get_destination</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.get_ending_note">get_ending_note</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.get_opening_note">get_opening_note</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.send_pages">send_pages</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MinimalHelpCommand</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An implementation of a help command with minimal output.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.HelpCommand" title="discord.ext.commands.HelpCommand"><code class="xref py py-class docutils literal notranslate"><span class="pre">HelpCommand</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.sort_commands">
|
||
<span class="sig-name descname"><span class="pre">sort_commands</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.sort_commands" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to sort the commands in the output alphabetically. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.commands_heading">
|
||
<span class="sig-name descname"><span class="pre">commands_heading</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.commands_heading" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command list’s heading string used when the help command is invoked with a category name.
|
||
Useful for i18n. Defaults to <code class="docutils literal notranslate"><span class="pre">"Commands"</span></code></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.aliases_heading">
|
||
<span class="sig-name descname"><span class="pre">aliases_heading</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.aliases_heading" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The alias list’s heading string used to list the aliases of the command. Useful for i18n.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">"Aliases:"</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.dm_help">
|
||
<span class="sig-name descname"><span class="pre">dm_help</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.dm_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A tribool that indicates if the help command should DM the user instead of
|
||
sending it to the channel it received it from. If the boolean is set to
|
||
<code class="docutils literal notranslate"><span class="pre">True</span></code>, then all help output is DM’d. If <code class="docutils literal notranslate"><span class="pre">False</span></code>, none of the help
|
||
output is DM’d. If <code class="docutils literal notranslate"><span class="pre">None</span></code>, then the bot will only DM when the help
|
||
message becomes too long (dictated by more than <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.dm_help_threshold" title="discord.ext.commands.MinimalHelpCommand.dm_help_threshold"><code class="xref py py-attr docutils literal notranslate"><span class="pre">dm_help_threshold</span></code></a> characters).
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.dm_help_threshold">
|
||
<span class="sig-name descname"><span class="pre">dm_help_threshold</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.dm_help_threshold" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The number of characters the paginator must accumulate before getting DM’d to the
|
||
user if <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.dm_help" title="discord.ext.commands.MinimalHelpCommand.dm_help"><code class="xref py py-attr docutils literal notranslate"><span class="pre">dm_help</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">None</span></code>. Defaults to 1000.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.no_category">
|
||
<span class="sig-name descname"><span class="pre">no_category</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.no_category" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The string used when there is a command which does not belong to any category(cog).
|
||
Useful for i18n. Defaults to <code class="docutils literal notranslate"><span class="pre">"No</span> <span class="pre">Category"</span></code></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.paginator">
|
||
<span class="sig-name descname"><span class="pre">paginator</span></span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.paginator" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The paginator used to paginate the help command output.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Paginator" title="discord.ext.commands.Paginator"><code class="xref py py-class docutils literal notranslate"><span class="pre">Paginator</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.send_pages">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_pages</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.send_pages" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A helper utility to send the page output from <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.paginator" title="discord.ext.commands.MinimalHelpCommand.paginator"><code class="xref py py-attr docutils literal notranslate"><span class="pre">paginator</span></code></a> to the destination.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.get_opening_note">
|
||
<span class="sig-name descname"><span class="pre">get_opening_note</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.get_opening_note" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns help command’s opening note. This is mainly useful to override for i18n purposes.</p>
|
||
<p>The default implementation returns</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Use `{prefix}{command_name} [command]` for more info on a command.
|
||
You can also use `{prefix}{command_name} [category]` for more info on a category.
|
||
</pre></div>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The help command opening note.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.get_command_signature">
|
||
<span class="sig-name descname"><span class="pre">get_command_signature</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="headerlink" href="#discord.ext.commands.MinimalHelpCommand.get_command_signature" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Retrieves the signature portion of the help page.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to get the signature of.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The signature for the command.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.get_ending_note">
|
||
<span class="sig-name descname"><span class="pre">get_ending_note</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.get_ending_note" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the help command’s ending note. This is mainly useful to override for i18n purposes.</p>
|
||
<p>The default implementation does nothing.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The help command ending note.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.add_bot_commands_formatting">
|
||
<span class="sig-name descname"><span class="pre">add_bot_commands_formatting</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">commands</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">heading</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.add_bot_commands_formatting" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds the minified bot heading with commands to the output.</p>
|
||
<p>The formatting should be added to the <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.paginator" title="discord.ext.commands.MinimalHelpCommand.paginator"><code class="xref py py-attr docutils literal notranslate"><span class="pre">paginator</span></code></a>.</p>
|
||
<p>The default implementation is a bold underline heading followed
|
||
by commands separated by an EN SPACE (U+2002) in the next line.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>commands</strong> (Sequence[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]) – A list of commands that belong to the heading.</p></li>
|
||
<li><p><strong>heading</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The heading to add to the line.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.add_subcommand_formatting">
|
||
<span class="sig-name descname"><span class="pre">add_subcommand_formatting</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="headerlink" href="#discord.ext.commands.MinimalHelpCommand.add_subcommand_formatting" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds formatting information on a subcommand.</p>
|
||
<p>The formatting should be added to the <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.paginator" title="discord.ext.commands.MinimalHelpCommand.paginator"><code class="xref py py-attr docutils literal notranslate"><span class="pre">paginator</span></code></a>.</p>
|
||
<p>The default implementation is the prefix and the <a class="reference internal" href="#discord.ext.commands.Command.qualified_name" title="discord.ext.commands.Command.qualified_name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.qualified_name</span></code></a>
|
||
optionally followed by an En dash and the command’s <a class="reference internal" href="#discord.ext.commands.Command.short_doc" title="discord.ext.commands.Command.short_doc"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.short_doc</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to show information of.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.add_aliases_formatting">
|
||
<span class="sig-name descname"><span class="pre">add_aliases_formatting</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">aliases</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.add_aliases_formatting" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds the formatting information on a command’s aliases.</p>
|
||
<p>The formatting should be added to the <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.paginator" title="discord.ext.commands.MinimalHelpCommand.paginator"><code class="xref py py-attr docutils literal notranslate"><span class="pre">paginator</span></code></a>.</p>
|
||
<p>The default implementation is the <a class="reference internal" href="#discord.ext.commands.MinimalHelpCommand.aliases_heading" title="discord.ext.commands.MinimalHelpCommand.aliases_heading"><code class="xref py py-attr docutils literal notranslate"><span class="pre">aliases_heading</span></code></a> bolded
|
||
followed by a comma separated list of aliases.</p>
|
||
<p>This is not called if there are no aliases to format.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>aliases</strong> (Sequence[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – A list of aliases to format.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.add_command_formatting">
|
||
<span class="sig-name descname"><span class="pre">add_command_formatting</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="headerlink" href="#discord.ext.commands.MinimalHelpCommand.add_command_formatting" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A utility function to format commands and groups.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command to format.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MinimalHelpCommand.get_destination">
|
||
<span class="sig-name descname"><span class="pre">get_destination</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MinimalHelpCommand.get_destination" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the <a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Messageable</span></code></a> where the help command will be output.</p>
|
||
<p>You can override this method to customise the behaviour.</p>
|
||
<p>By default this returns the context’s channel.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The destination where the help command will be output.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.Messageable</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="paginator">
|
||
<h3>Paginator<a class="headerlink" href="#paginator" title="Permalink to this headline">¶</a></h3>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Paginator"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Paginator.linesep">linesep</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Paginator.max_size">max_size</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Paginator.pages">pages</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Paginator.prefix">prefix</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Paginator.suffix">suffix</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Paginator.add_line">add_line</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Paginator.clear">clear</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Paginator.close_page">close_page</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Paginator</span></span><span class="sig-paren">(</span><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">'```'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">suffix</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">max_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2000</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">linesep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'\n'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Paginator" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A class that aids in paginating code blocks for Discord messages.</p>
|
||
<div class="operations docutils container">
|
||
<dl class="describe">
|
||
<dt class="sig sig-object">
|
||
<span class="sig-name descname"><span class="pre">len(x)</span></span></dt>
|
||
<dd><p>Returns the total number of characters in the paginator.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.prefix">
|
||
<span class="sig-name descname"><span class="pre">prefix</span></span><a class="headerlink" href="#discord.ext.commands.Paginator.prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The prefix inserted to every page. e.g. three backticks.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.suffix">
|
||
<span class="sig-name descname"><span class="pre">suffix</span></span><a class="headerlink" href="#discord.ext.commands.Paginator.suffix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The suffix appended at the end of every page. e.g. three backticks.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.max_size">
|
||
<span class="sig-name descname"><span class="pre">max_size</span></span><a class="headerlink" href="#discord.ext.commands.Paginator.max_size" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The maximum amount of codepoints allowed in a page.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.linesep">
|
||
<span class="sig-name descname"><span class="pre">linesep</span></span><a class="headerlink" href="#discord.ext.commands.Paginator.linesep" title="Permalink to this definition">¶</a></dt>
|
||
<dd><dl>
|
||
<dt>The character string inserted between lines. e.g. a newline character.</dt><dd><div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
</dd>
|
||
</dl>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.clear">
|
||
<span class="sig-name descname"><span class="pre">clear</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Paginator.clear" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Clears the paginator to have no pages.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.add_line">
|
||
<span class="sig-name descname"><span class="pre">add_line</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">line</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="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">empty</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Paginator.add_line" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a line to the current page.</p>
|
||
<p>If the line exceeds the <a class="reference internal" href="#discord.ext.commands.Paginator.max_size" title="discord.ext.commands.Paginator.max_size"><code class="xref py py-attr docutils literal notranslate"><span class="pre">max_size</span></code></a> then an exception
|
||
is raised.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>line</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The line to add.</p></li>
|
||
<li><p><strong>empty</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Indicates if another empty line should be added.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#RuntimeError" title="(in Python v3.9)"><strong>RuntimeError</strong></a> – The line was too big for the current <a class="reference internal" href="#discord.ext.commands.Paginator.max_size" title="discord.ext.commands.Paginator.max_size"><code class="xref py py-attr docutils literal notranslate"><span class="pre">max_size</span></code></a>.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.close_page">
|
||
<span class="sig-name descname"><span class="pre">close_page</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Paginator.close_page" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Prematurely terminate a page.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Paginator.pages">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">pages</span></span><a class="headerlink" href="#discord.ext.commands.Paginator.pages" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the rendered list of pages.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
</section>
|
||
<section id="enums">
|
||
<h2>Enums<a class="headerlink" href="#enums" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BucketType</span></span><a class="headerlink" href="#discord.ext.commands.BucketType" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Specifies a type of bucket for, e.g. a cooldown.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.default">
|
||
<span class="sig-name descname"><span class="pre">default</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.default" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The default bucket operates on a global basis.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.user">
|
||
<span class="sig-name descname"><span class="pre">user</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.user" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The user bucket operates on a per-user basis.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.guild">
|
||
<span class="sig-name descname"><span class="pre">guild</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.guild" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The guild bucket operates on a per-guild basis.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.channel">
|
||
<span class="sig-name descname"><span class="pre">channel</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel bucket operates on a per-channel basis.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.member">
|
||
<span class="sig-name descname"><span class="pre">member</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.member" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The member bucket operates on a per-member basis.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.category">
|
||
<span class="sig-name descname"><span class="pre">category</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.category" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The category bucket operates on a per-category basis.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BucketType.role">
|
||
<span class="sig-name descname"><span class="pre">role</span></span><a class="headerlink" href="#discord.ext.commands.BucketType.role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The role bucket operates on a per-role basis.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="checks">
|
||
<span id="ext-commands-api-checks"></span><h2>Checks<a class="headerlink" href="#checks" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.check">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">check</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">predicate</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.check" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that adds a check to the <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> or its
|
||
subclasses. These checks could be accessed via <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.checks</span></code></a>.</p>
|
||
<p>These checks should be predicates that take in a single parameter taking
|
||
a <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>. If the check returns a <code class="docutils literal notranslate"><span class="pre">False</span></code>-like value then
|
||
during invocation a <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a> exception is raised and sent to
|
||
the <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> event.</p>
|
||
<p>If an exception should be thrown in the predicate then it should be a
|
||
subclass of <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>. Any exception not subclassed from it
|
||
will be propagated while those subclassed will be sent to
|
||
<a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a>.</p>
|
||
<p>A special attribute named <code class="docutils literal notranslate"><span class="pre">predicate</span></code> is bound to the value
|
||
returned by this decorator to retrieve the predicate passed to the
|
||
decorator. This allows the following introspection and chaining to be done:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">owner_or_permissions</span><span class="p">(</span><span class="o">**</span><span class="n">perms</span><span class="p">):</span>
|
||
<span class="n">original</span> <span class="o">=</span> <span class="n">commands</span><span class="o">.</span><span class="n">has_permissions</span><span class="p">(</span><span class="o">**</span><span class="n">perms</span><span class="p">)</span><span class="o">.</span><span class="n">predicate</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">extended_check</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="k">if</span> <span class="n">ctx</span><span class="o">.</span><span class="n">guild</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||
<span class="k">return</span> <span class="kc">False</span>
|
||
<span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">guild</span><span class="o">.</span><span class="n">owner_id</span> <span class="o">==</span> <span class="n">ctx</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">id</span> <span class="ow">or</span> <span class="k">await</span> <span class="n">original</span><span class="p">(</span><span class="n">ctx</span><span class="p">)</span>
|
||
<span class="k">return</span> <span class="n">commands</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">extended_check</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The function returned by <code class="docutils literal notranslate"><span class="pre">predicate</span></code> is <strong>always</strong> a coroutine,
|
||
even if the original function was not a coroutine.</p>
|
||
</div>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.3: </span>The <code class="docutils literal notranslate"><span class="pre">predicate</span></code> attribute was added.</p>
|
||
</div>
|
||
<p class="rubric">Examples</p>
|
||
<p>Creating a basic check to see if the command invoker is you.</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">check_if_it_is_me</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">message</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="mi">85309593344815104</span>
|
||
|
||
<span class="nd">@bot</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
|
||
<span class="nd">@commands</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">check_if_it_is_me</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">only_for_me</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="s1">'I know you!'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Transforming common checks into its own decorator:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">is_me</span><span class="p">():</span>
|
||
<span class="k">def</span> <span class="nf">predicate</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">message</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="mi">85309593344815104</span>
|
||
<span class="k">return</span> <span class="n">commands</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">predicate</span><span class="p">)</span>
|
||
|
||
<span class="nd">@bot</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
|
||
<span class="nd">@is_me</span><span class="p">()</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">only_me</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="s1">'Only you!'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>predicate</strong> (Callable[[<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]) – The predicate to check if the command should be invoked.</p></li>
|
||
<li><p><strong>**command_attrs</strong> (Dict[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, Any]) – key: value pairs to be added to the command’s attributes.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.check_any">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">check_any</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">checks</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.check_any" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that is added that checks if any of the checks passed
|
||
will pass, i.e. using logical OR.</p>
|
||
<p>If all checks fail then <a class="reference internal" href="#discord.ext.commands.CheckAnyFailure" title="discord.ext.commands.CheckAnyFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckAnyFailure</span></code></a> is raised to signal the failure.
|
||
It inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">predicate</span></code> attribute for this function <strong>is</strong> a coroutine.</p>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>*checks</strong> (Callable[[<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]) – An argument list of checks that have been decorated with
|
||
the <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> decorator.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – A check passed has not been decorated with the <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a>
|
||
decorator.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Examples</p>
|
||
<p>Creating a basic check to see if it’s the bot owner or
|
||
the server owner:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">is_guild_owner</span><span class="p">():</span>
|
||
<span class="k">def</span> <span class="nf">predicate</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">guild</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">ctx</span><span class="o">.</span><span class="n">guild</span><span class="o">.</span><span class="n">owner_id</span> <span class="o">==</span> <span class="n">ctx</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">id</span>
|
||
<span class="k">return</span> <span class="n">commands</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">predicate</span><span class="p">)</span>
|
||
|
||
<span class="nd">@bot</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
|
||
<span class="nd">@commands</span><span class="o">.</span><span class="n">check_any</span><span class="p">(</span><span class="n">commands</span><span class="o">.</span><span class="n">is_owner</span><span class="p">(),</span> <span class="n">is_guild_owner</span><span class="p">())</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">only_for_owners</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="s1">'Hello mister owner!'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.has_role">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">has_role</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">item</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.has_role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that is added that checks if the member invoking the
|
||
command has the role specified via the name or ID specified.</p>
|
||
<p>If a string is specified, you must give the exact name of the role, including
|
||
caps and spelling.</p>
|
||
<p>If an integer is specified, you must give the exact snowflake ID of the role.</p>
|
||
<p>If the message is invoked in a private message context then the check will
|
||
return <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
|
||
<p>This check raises one of two special exceptions, <a class="reference internal" href="#discord.ext.commands.MissingRole" title="discord.ext.commands.MissingRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingRole</span></code></a> if the user
|
||
is missing a role, or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a> if it is used in a private message.
|
||
Both inherit from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.1: </span>Raise <a class="reference internal" href="#discord.ext.commands.MissingRole" title="discord.ext.commands.MissingRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingRole</span></code></a> or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a>
|
||
instead of generic <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>item</strong> (Union[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><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/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – The name or ID of the role to check.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.has_permissions">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">has_permissions</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">perms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.has_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that is added that checks if the member has all of
|
||
the permissions necessary.</p>
|
||
<p>Note that this check operates on the current channel permissions, not the
|
||
guild wide permissions.</p>
|
||
<p>The permissions passed in must be exactly like the properties shown under
|
||
<a class="reference internal" href="../../api.html#discord.Permissions" title="discord.Permissions"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Permissions</span></code></a>.</p>
|
||
<p>This check raises a special exception, <a class="reference internal" href="#discord.ext.commands.MissingPermissions" title="discord.ext.commands.MissingPermissions"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingPermissions</span></code></a>
|
||
that is inherited from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>perms</strong> – An argument list of permissions to check for.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@bot</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
|
||
<span class="nd">@commands</span><span class="o">.</span><span class="n">has_permissions</span><span class="p">(</span><span class="n">manage_messages</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">test</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="s1">'You can manage messages.'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.has_guild_permissions">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">has_guild_permissions</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">perms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.has_guild_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Similar to <a class="reference internal" href="#discord.ext.commands.has_permissions" title="discord.ext.commands.has_permissions"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_permissions()</span></code></a>, but operates on guild wide
|
||
permissions instead of the current channel permissions.</p>
|
||
<p>If this check is called in a DM context, it will raise an
|
||
exception, <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.has_any_role">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">has_any_role</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">items</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.has_any_role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that is added that checks if the member invoking the
|
||
command has <strong>any</strong> of the roles specified. This means that if they have
|
||
one out of the three roles specified, then this check will return <cite>True</cite>.</p>
|
||
<p>Similar to <a class="reference internal" href="#discord.ext.commands.has_role" title="discord.ext.commands.has_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_role()</span></code></a>, the names or IDs passed in must be exact.</p>
|
||
<p>This check raises one of two special exceptions, <a class="reference internal" href="#discord.ext.commands.MissingAnyRole" title="discord.ext.commands.MissingAnyRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingAnyRole</span></code></a> if the user
|
||
is missing all roles, or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a> if it is used in a private message.
|
||
Both inherit from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.1: </span>Raise <a class="reference internal" href="#discord.ext.commands.MissingAnyRole" title="discord.ext.commands.MissingAnyRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingAnyRole</span></code></a> or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a>
|
||
instead of generic <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>items</strong> (List[Union[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]) – An argument list of names or IDs to check that the member has roles wise.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@bot</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
|
||
<span class="nd">@commands</span><span class="o">.</span><span class="n">has_any_role</span><span class="p">(</span><span class="s1">'Library Devs'</span><span class="p">,</span> <span class="s1">'Moderators'</span><span class="p">,</span> <span class="mi">492212595072434186</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">cool</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="s1">'You are cool indeed'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.bot_has_role">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">bot_has_role</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">item</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.bot_has_role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Similar to <a class="reference internal" href="#discord.ext.commands.has_role" title="discord.ext.commands.has_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_role()</span></code></a> except checks if the bot itself has the
|
||
role.</p>
|
||
<p>This check raises one of two special exceptions, <a class="reference internal" href="#discord.ext.commands.BotMissingRole" title="discord.ext.commands.BotMissingRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingRole</span></code></a> if the bot
|
||
is missing the role, or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a> if it is used in a private message.
|
||
Both inherit from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.1: </span>Raise <a class="reference internal" href="#discord.ext.commands.BotMissingRole" title="discord.ext.commands.BotMissingRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingRole</span></code></a> or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a>
|
||
instead of generic <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.bot_has_permissions">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">bot_has_permissions</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">perms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.bot_has_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Similar to <a class="reference internal" href="#discord.ext.commands.has_permissions" title="discord.ext.commands.has_permissions"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_permissions()</span></code></a> except checks if the bot itself has
|
||
the permissions listed.</p>
|
||
<p>This check raises a special exception, <a class="reference internal" href="#discord.ext.commands.BotMissingPermissions" title="discord.ext.commands.BotMissingPermissions"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingPermissions</span></code></a>
|
||
that is inherited from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.bot_has_guild_permissions">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">bot_has_guild_permissions</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">perms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.bot_has_guild_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Similar to <a class="reference internal" href="#discord.ext.commands.has_guild_permissions" title="discord.ext.commands.has_guild_permissions"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_guild_permissions()</span></code></a>, but checks the bot
|
||
members guild permissions.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.bot_has_any_role">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">bot_has_any_role</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">items</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.bot_has_any_role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Similar to <a class="reference internal" href="#discord.ext.commands.has_any_role" title="discord.ext.commands.has_any_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_any_role()</span></code></a> except checks if the bot itself has
|
||
any of the roles listed.</p>
|
||
<p>This check raises one of two special exceptions, <a class="reference internal" href="#discord.ext.commands.BotMissingAnyRole" title="discord.ext.commands.BotMissingAnyRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingAnyRole</span></code></a> if the bot
|
||
is missing all roles, or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a> if it is used in a private message.
|
||
Both inherit from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.1: </span>Raise <a class="reference internal" href="#discord.ext.commands.BotMissingAnyRole" title="discord.ext.commands.BotMissingAnyRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingAnyRole</span></code></a> or <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a>
|
||
instead of generic checkfailure</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.cooldown">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rate</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">per</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">discord.ext.commands.BucketType.default</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that adds a cooldown to a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a></p>
|
||
<p>A cooldown allows a command to only be used a specific amount
|
||
of times in a specific time frame. These cooldowns can be based
|
||
either on a per-guild, per-channel, per-user, per-role or global basis.
|
||
Denoted by the third argument of <code class="docutils literal notranslate"><span class="pre">type</span></code> which must be of enum
|
||
type <a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a>.</p>
|
||
<p>If a cooldown is triggered, then <a class="reference internal" href="#discord.ext.commands.CommandOnCooldown" title="discord.ext.commands.CommandOnCooldown"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandOnCooldown</span></code></a> is triggered in
|
||
<a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> and the local error handler.</p>
|
||
<p>A command can only have a single cooldown.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>rate</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The number of times a command can be used before triggering a cooldown.</p></li>
|
||
<li><p><strong>per</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – The amount of seconds to wait for a cooldown when it’s been triggered.</p></li>
|
||
<li><p><strong>type</strong> (Union[<a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a>, Callable[[<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>], Any]]) – <p>The type of cooldown to have. If callable, should return a key for the mapping.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.7: </span>Callables are now supported for custom bucket types.</p>
|
||
</div>
|
||
</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.dynamic_cooldown">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">dynamic_cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cooldown</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">BucketType.default</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.dynamic_cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that adds a dynamic cooldown to a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a></p>
|
||
<p>This differs from <a class="reference internal" href="#discord.ext.commands.cooldown" title="discord.ext.commands.cooldown"><code class="xref py py-func docutils literal notranslate"><span class="pre">cooldown()</span></code></a> in that it takes a function that
|
||
accepts a single parameter of type <a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a> and must
|
||
return a <a class="reference internal" href="#discord.ext.commands.Cooldown" title="discord.ext.commands.Cooldown"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cooldown</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>. If <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned then
|
||
that cooldown is effectively bypassed.</p>
|
||
<p>A cooldown allows a command to only be used a specific amount
|
||
of times in a specific time frame. These cooldowns can be based
|
||
either on a per-guild, per-channel, per-user, per-role or global basis.
|
||
Denoted by the third argument of <code class="docutils literal notranslate"><span class="pre">type</span></code> which must be of enum
|
||
type <a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a>.</p>
|
||
<p>If a cooldown is triggered, then <a class="reference internal" href="#discord.ext.commands.CommandOnCooldown" title="discord.ext.commands.CommandOnCooldown"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandOnCooldown</span></code></a> is triggered in
|
||
<a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> and the local error handler.</p>
|
||
<p>A command can only have a single cooldown.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>cooldown</strong> (Callable[[<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a>], Optional[<a class="reference internal" href="#discord.ext.commands.Cooldown" title="discord.ext.commands.Cooldown"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cooldown</span></code></a>]]) – A function that takes a message and returns a cooldown that will
|
||
apply to this invocation or <code class="docutils literal notranslate"><span class="pre">None</span></code> if the cooldown should be bypassed.</p></li>
|
||
<li><p><strong>type</strong> (<a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a>) – The type of cooldown to have.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.max_concurrency">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">max_concurrency</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">number</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">per</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">discord.ext.commands.BucketType.default</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">wait</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.max_concurrency" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that adds a maximum concurrency to a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> or its subclasses.</p>
|
||
<p>This enables you to only allow a certain number of command invocations at the same time,
|
||
for example if a command takes too long or if only one user can use it at a time. This
|
||
differs from a cooldown in that there is no set waiting period or token bucket – only
|
||
a set number of people can run the command.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>number</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The maximum number of invocations of this command that can be running at the same time.</p></li>
|
||
<li><p><strong>per</strong> (<a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a>) – The bucket that this concurrency is based on, e.g. <code class="docutils literal notranslate"><span class="pre">BucketType.guild</span></code> would allow
|
||
it to be used up to <code class="docutils literal notranslate"><span class="pre">number</span></code> times per guild.</p></li>
|
||
<li><p><strong>wait</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether the command should wait for the queue to be over. If this is set to <code class="docutils literal notranslate"><span class="pre">False</span></code>
|
||
then instead of waiting until the command can run again, the command raises
|
||
<a class="reference internal" href="#discord.ext.commands.MaxConcurrencyReached" title="discord.ext.commands.MaxConcurrencyReached"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MaxConcurrencyReached</span></code></a> to its error handler. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>
|
||
then the command waits until it can be executed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.before_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">before_invoke</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coro</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.before_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a pre-invoke hook.</p>
|
||
<p>This allows you to refer to one before invoke hook for several commands that
|
||
do not have to be within the same cog.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<p class="rubric">Example</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span> <span class="nf">record_usage</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span>
|
||
<span class="nb">print</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="s1">'used'</span><span class="p">,</span> <span class="n">ctx</span><span class="o">.</span><span class="n">command</span><span class="p">,</span> <span class="s1">'at'</span><span class="p">,</span> <span class="n">ctx</span><span class="o">.</span><span class="n">message</span><span class="o">.</span><span class="n">created_at</span><span class="p">)</span>
|
||
|
||
<span class="nd">@bot</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
|
||
<span class="nd">@commands</span><span class="o">.</span><span class="n">before_invoke</span><span class="p">(</span><span class="n">record_usage</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span> <span class="nf">who</span><span class="p">(</span><span class="n">ctx</span><span class="p">):</span> <span class="c1"># Output: <User> used who at <Time></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="s1">'i am a bot'</span><span class="p">)</span>
|
||
|
||
<span class="k">class</span> <span class="nc">What</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="nd">@commands</span><span class="o">.</span><span class="n">before_invoke</span><span class="p">(</span><span class="n">record_usage</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">when</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="c1"># Output: <User> used when at <Time></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">'and i have existed since </span><span class="si">{</span><span class="n">ctx</span><span class="o">.</span><span class="n">bot</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">created_at</span><span class="si">}</span><span class="s1">'</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">where</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="c1"># Output: <Nothing></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="s1">'on Discord'</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">why</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="c1"># Output: <Nothing></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="s1">'because someone made me'</span><span class="p">)</span>
|
||
|
||
<span class="n">bot</span><span class="o">.</span><span class="n">add_cog</span><span class="p">(</span><span class="n">What</span><span class="p">())</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.after_invoke">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">after_invoke</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coro</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.after_invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A decorator that registers a coroutine as a post-invoke hook.</p>
|
||
<p>This allows you to refer to one after invoke hook for several commands that
|
||
do not have to be within the same cog.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.guild_only">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">guild_only</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.guild_only" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that indicates this command must only be used in a
|
||
guild context only. Basically, no private messages are allowed when
|
||
using the command.</p>
|
||
<p>This check raises a special exception, <a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a>
|
||
that is inherited from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.dm_only">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">dm_only</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.dm_only" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that indicates this command must only be used in a
|
||
DM context. Only private messages are allowed when
|
||
using the command.</p>
|
||
<p>This check raises a special exception, <a class="reference internal" href="#discord.ext.commands.PrivateMessageOnly" title="discord.ext.commands.PrivateMessageOnly"><code class="xref py py-exc docutils literal notranslate"><span class="pre">PrivateMessageOnly</span></code></a>
|
||
that is inherited from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.is_owner">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">is_owner</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.is_owner" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that checks if the person invoking this command is the
|
||
owner of the bot.</p>
|
||
<p>This is powered by <a class="reference internal" href="#discord.ext.commands.Bot.is_owner" title="discord.ext.commands.Bot.is_owner"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.is_owner()</span></code></a>.</p>
|
||
<p>This check raises a special exception, <a class="reference internal" href="#discord.ext.commands.NotOwner" title="discord.ext.commands.NotOwner"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NotOwner</span></code></a> that is derived
|
||
from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.is_nsfw">
|
||
<span class="sig-prename descclassname"><span class="pre">@</span></span><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">is_nsfw</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.is_nsfw" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A <a class="reference internal" href="#discord.ext.commands.check" title="discord.ext.commands.check"><code class="xref py py-func docutils literal notranslate"><span class="pre">check()</span></code></a> that checks if the channel is a NSFW channel.</p>
|
||
<p>This check raises a special exception, <a class="reference internal" href="#discord.ext.commands.NSFWChannelRequired" title="discord.ext.commands.NSFWChannelRequired"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NSFWChannelRequired</span></code></a>
|
||
that is derived from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.1: </span>Raise <a class="reference internal" href="#discord.ext.commands.NSFWChannelRequired" title="discord.ext.commands.NSFWChannelRequired"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NSFWChannelRequired</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.
|
||
DM channels will also now pass this check.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="cooldown">
|
||
<span id="ext-commands-api-context"></span><h2>Cooldown<a class="headerlink" href="#cooldown" title="Permalink to this headline">¶</a></h2>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Cooldown"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Cooldown.per">per</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Cooldown.rate">rate</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cooldown.copy">copy</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cooldown.get_retry_after">get_retry_after</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cooldown.get_tokens">get_tokens</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cooldown.reset">reset</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Cooldown.update_rate_limit">update_rate_limit</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Cooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rate</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">per</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents a cooldown for a command.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.rate">
|
||
<span class="sig-name descname"><span class="pre">rate</span></span><a class="headerlink" href="#discord.ext.commands.Cooldown.rate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The total number of tokens available per <a class="reference internal" href="#discord.ext.commands.Cooldown.per" title="discord.ext.commands.Cooldown.per"><code class="xref py py-attr docutils literal notranslate"><span class="pre">per</span></code></a> seconds.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.per">
|
||
<span class="sig-name descname"><span class="pre">per</span></span><a class="headerlink" href="#discord.ext.commands.Cooldown.per" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The length of the cooldown period in seconds.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.get_tokens">
|
||
<span class="sig-name descname"><span class="pre">get_tokens</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">current</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="headerlink" href="#discord.ext.commands.Cooldown.get_tokens" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the number of available tokens before rate limiting is applied.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>current</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – The time in seconds since Unix epoch to calculate tokens at.
|
||
If not supplied then <a class="reference external" href="https://docs.python.org/3/library/time.html#time.time" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">time.time()</span></code></a> is used.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The number of tokens available before the cooldown is to be applied.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.get_retry_after">
|
||
<span class="sig-name descname"><span class="pre">get_retry_after</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">current</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="headerlink" href="#discord.ext.commands.Cooldown.get_retry_after" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the time in seconds until the cooldown will be reset.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>current</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – The current time in seconds since Unix epoch.
|
||
If not supplied, then <a class="reference external" href="https://docs.python.org/3/library/time.html#time.time" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">time.time()</span></code></a> is used.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The number of seconds to wait before this cooldown will be reset.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.update_rate_limit">
|
||
<span class="sig-name descname"><span class="pre">update_rate_limit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">current</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="headerlink" href="#discord.ext.commands.Cooldown.update_rate_limit" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Updates the cooldown rate limit.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>current</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – The time in seconds since Unix epoch to update the rate limit at.
|
||
If not supplied, then <a class="reference external" href="https://docs.python.org/3/library/time.html#time.time" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">time.time()</span></code></a> is used.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The retry-after time in seconds if rate limited.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.reset">
|
||
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cooldown.reset" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Reset the cooldown to its initial state.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Cooldown.copy">
|
||
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Cooldown.copy" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a copy of this cooldown.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A new instance of this cooldown.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.Cooldown" title="discord.ext.commands.Cooldown"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cooldown</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="context">
|
||
<h2>Context<a class="headerlink" href="#context" title="Permalink to this headline">¶</a></h2>
|
||
<div class="py-attribute-table" data-move-to-id="discord.ext.commands.Context"><div class="py-attribute-table-column">
|
||
<span>
|
||
Attributes</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.args">args</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.author">author</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.bot">bot</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.channel">channel</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.clean_prefix">clean_prefix</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.cog">cog</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.command">command</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.command_failed">command_failed</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.current_parameter">current_parameter</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.guild">guild</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.invoked_parents">invoked_parents</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.invoked_subcommand">invoked_subcommand</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.invoked_with">invoked_with</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.kwargs">kwargs</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.me">me</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.message">message</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.prefix">prefix</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.subcommand_passed">subcommand_passed</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.valid">valid</a></li><li class="py-attribute-table-entry">
|
||
<a class="reference internal" href="#discord.ext.commands.Context.voice_client">voice_client</a></li></ul>
|
||
</div><div class="py-attribute-table-column">
|
||
<span>
|
||
Methods</span><ul>
|
||
<li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Context.author_permissions">author_permissions</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.fetch_message">fetch_message</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Context.history">history</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.invoke">invoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.pins">pins</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.reinvoke">reinvoke</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.reply">reply</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.send">send</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.send_help">send_help</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="coroutine">
|
||
async</span><a class="reference internal" href="#discord.ext.commands.Context.trigger_typing">trigger_typing</a></li><li class="py-attribute-table-entry">
|
||
<span class="py-attribute-table-badge" title="method">
|
||
def</span><a class="reference internal" href="#discord.ext.commands.Context.typing">typing</a></li></ul>
|
||
</div></div><dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Context</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">message</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bot</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">view</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</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">kwargs</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">prefix</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">command</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">invoked_with</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">invoked_parents</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">invoked_subcommand</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">subcommand_passed</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">command_failed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">current_parameter</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="headerlink" href="#discord.ext.commands.Context" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents the context in which a command is being invoked under.</p>
|
||
<p>This class contains a lot of meta data to help you understand more about
|
||
the invocation context. This class is not created manually and is instead
|
||
passed around to commands as the first parameter.</p>
|
||
<p>This class implements the <a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Messageable</span></code></a> ABC.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.message">
|
||
<span class="sig-name descname"><span class="pre">message</span></span><a class="headerlink" href="#discord.ext.commands.Context.message" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The message that triggered the command being executed.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.bot">
|
||
<span class="sig-name descname"><span class="pre">bot</span></span><a class="headerlink" href="#discord.ext.commands.Context.bot" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The bot that contains the command being executed.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#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></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.args">
|
||
<span class="sig-name descname"><span class="pre">args</span></span><a class="headerlink" href="#discord.ext.commands.Context.args" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The list of transformed arguments that were passed into the command.
|
||
If this is accessed during the <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> event
|
||
then this list could be incomplete.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><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></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.kwargs">
|
||
<span class="sig-name descname"><span class="pre">kwargs</span></span><a class="headerlink" href="#discord.ext.commands.Context.kwargs" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A dictionary of transformed arguments that were passed into the command.
|
||
Similar to <a class="reference internal" href="#discord.ext.commands.Context.args" title="discord.ext.commands.Context.args"><code class="xref py py-attr docutils literal notranslate"><span class="pre">args</span></code></a>, if this is accessed in the
|
||
<a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a> event then this dict could be incomplete.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.current_parameter">
|
||
<span class="sig-name descname"><span class="pre">current_parameter</span></span><a class="headerlink" href="#discord.ext.commands.Context.current_parameter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The parameter that is currently being inspected and converted.
|
||
This is only of use for within converters.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.prefix">
|
||
<span class="sig-name descname"><span class="pre">prefix</span></span><a class="headerlink" href="#discord.ext.commands.Context.prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The prefix that was used to invoke the command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.command">
|
||
<span class="sig-name descname"><span class="pre">command</span></span><a class="headerlink" href="#discord.ext.commands.Context.command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command that is being invoked currently.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.invoked_with">
|
||
<span class="sig-name descname"><span class="pre">invoked_with</span></span><a class="headerlink" href="#discord.ext.commands.Context.invoked_with" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command name that triggered this invocation. Useful for finding out
|
||
which alias called the command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.invoked_parents">
|
||
<span class="sig-name descname"><span class="pre">invoked_parents</span></span><a class="headerlink" href="#discord.ext.commands.Context.invoked_parents" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command names of the parents that triggered this invocation. Useful for
|
||
finding out which aliases called the command.</p>
|
||
<p>For example in commands <code class="docutils literal notranslate"><span class="pre">?a</span> <span class="pre">b</span> <span class="pre">c</span> <span class="pre">test</span></code>, the invoked parents are <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c']</span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.invoked_subcommand">
|
||
<span class="sig-name descname"><span class="pre">invoked_subcommand</span></span><a class="headerlink" href="#discord.ext.commands.Context.invoked_subcommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The subcommand that was invoked.
|
||
If no valid subcommand was invoked then this is equal to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.subcommand_passed">
|
||
<span class="sig-name descname"><span class="pre">subcommand_passed</span></span><a class="headerlink" href="#discord.ext.commands.Context.subcommand_passed" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The string that was attempted to call a subcommand. This does not have
|
||
to point to a valid registered subcommand and could just point to a
|
||
nonsense string. If nothing was passed to attempt a call to a
|
||
subcommand then this is set to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.command_failed">
|
||
<span class="sig-name descname"><span class="pre">command_failed</span></span><a class="headerlink" href="#discord.ext.commands.Context.command_failed" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A boolean that indicates if the command failed to be parsed, checked,
|
||
or invoked.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><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="discord.ext.commands.Context.history">
|
||
<em class="property"><span class="pre">async</span> <span class="pre">for</span> <span class="pre">...</span> <span class="pre">in</span> </em><span class="sig-name descname"><span class="pre">history</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">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">before</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">after</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">around</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">oldest_first</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="headerlink" href="#discord.ext.commands.Context.history" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns an <a class="reference internal" href="../../api.html#discord.AsyncIterator" title="discord.AsyncIterator"><code class="xref py py-class docutils literal notranslate"><span class="pre">AsyncIterator</span></code></a> that enables receiving the destination’s message history.</p>
|
||
<p>You must have <a class="reference internal" href="../../api.html#discord.Permissions.read_message_history" title="discord.Permissions.read_message_history"><code class="xref py py-attr docutils literal notranslate"><span class="pre">read_message_history</span></code></a> permissions to use this.</p>
|
||
<p class="rubric">Examples</p>
|
||
<p>Usage</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">counter</span> <span class="o">=</span> <span class="mi">0</span>
|
||
<span class="k">async</span> <span class="k">for</span> <span class="n">message</span> <span class="ow">in</span> <span class="n">channel</span><span class="o">.</span><span class="n">history</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">200</span><span class="p">):</span>
|
||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">author</span> <span class="o">==</span> <span class="n">client</span><span class="o">.</span><span class="n">user</span><span class="p">:</span>
|
||
<span class="n">counter</span> <span class="o">+=</span> <span class="mi">1</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Flattening into a list:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">messages</span> <span class="o">=</span> <span class="k">await</span> <span class="n">channel</span><span class="o">.</span><span class="n">history</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">123</span><span class="p">)</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>
|
||
<span class="c1"># messages is now a list of Message...</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>All parameters are optional.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>limit</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – The number of messages to retrieve.
|
||
If <code class="docutils literal notranslate"><span class="pre">None</span></code>, retrieves every message in the channel. Note, however,
|
||
that this would make it a slow operation.</p></li>
|
||
<li><p><strong>before</strong> (Optional[Union[<a class="reference internal" href="../../api.html#discord.abc.Snowflake" title="discord.abc.Snowflake"><code class="xref py py-class docutils literal notranslate"><span class="pre">Snowflake</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>]]) – Retrieve messages before this date or message.
|
||
If a datetime is provided, it is recommended to use a UTC aware datetime.
|
||
If the datetime is naive, it is assumed to be local time.</p></li>
|
||
<li><p><strong>after</strong> (Optional[Union[<a class="reference internal" href="../../api.html#discord.abc.Snowflake" title="discord.abc.Snowflake"><code class="xref py py-class docutils literal notranslate"><span class="pre">Snowflake</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>]]) – Retrieve messages after this date or message.
|
||
If a datetime is provided, it is recommended to use a UTC aware datetime.
|
||
If the datetime is naive, it is assumed to be local time.</p></li>
|
||
<li><p><strong>around</strong> (Optional[Union[<a class="reference internal" href="../../api.html#discord.abc.Snowflake" title="discord.abc.Snowflake"><code class="xref py py-class docutils literal notranslate"><span class="pre">Snowflake</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>]]) – Retrieve messages around this date or message.
|
||
If a datetime is provided, it is recommended to use a UTC aware datetime.
|
||
If the datetime is naive, it is assumed to be local time.
|
||
When using this argument, the maximum limit is 101. Note that if the limit is an
|
||
even number then this will return at most limit + 1 messages.</p></li>
|
||
<li><p><strong>oldest_first</strong> (Optional[<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]) – If set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, return messages in oldest->newest order. Defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code> if
|
||
<code class="docutils literal notranslate"><span class="pre">after</span></code> is specified, otherwise <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have permissions to get channel message history.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – The request to get message history failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Yields</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a> – The message with the message data parsed.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.typing">
|
||
<em class="property"><span class="pre">async</span> <span class="pre">with</span> </em><span class="sig-name descname"><span class="pre">typing</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.typing" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns a context manager that allows you to type for an indefinite period of time.</p>
|
||
<p>This is useful for denoting long computations in your bot.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This is both a regular context manager and an async context manager.
|
||
This means that both <code class="docutils literal notranslate"><span class="pre">with</span></code> and <code class="docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code> work with this.</p>
|
||
</div>
|
||
<p>Example Usage:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">channel</span><span class="o">.</span><span class="n">typing</span><span class="p">():</span>
|
||
<span class="c1"># simulate something heavy</span>
|
||
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">10</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="s1">'done!'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.invoke">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">invoke</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</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="headerlink" href="#discord.ext.commands.Context.invoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Calls a command with the arguments given.</p>
|
||
<p>This is useful if you want to just call the callback that a
|
||
<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a> holds internally.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This does not handle converters, checks, cooldowns, pre-invoke,
|
||
or after-invoke hooks in any matter. It calls the internal callback
|
||
directly as-if it was a regular function.</p>
|
||
<p>You must take care in passing the proper arguments when
|
||
using this function.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>command</strong> (<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>) – The command that is going to be called.</p></li>
|
||
<li><p><strong>*args</strong> – The arguments to use.</p></li>
|
||
<li><p><strong>**kwargs</strong> – The keyword arguments to use.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#TypeError" title="(in Python v3.9)"><strong>TypeError</strong></a> – The command argument to invoke is missing.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.reinvoke">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">reinvoke</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">call_hooks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">restart</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.reinvoke" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Calls the command again.</p>
|
||
<p>This is similar to <a class="reference internal" href="#discord.ext.commands.Context.invoke" title="discord.ext.commands.Context.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a> except that it bypasses
|
||
checks, cooldowns, and error handlers.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>If you want to bypass <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a> derived exceptions,
|
||
it is recommended to use the regular <a class="reference internal" href="#discord.ext.commands.Context.invoke" title="discord.ext.commands.Context.invoke"><code class="xref py py-meth docutils literal notranslate"><span class="pre">invoke()</span></code></a>
|
||
as it will work more naturally. After all, this will end up
|
||
using the old arguments the user has used and will thus just
|
||
fail again.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>call_hooks</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether to call the before and after invoke hooks.</p></li>
|
||
<li><p><strong>restart</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether to start the call chain from the very beginning
|
||
or where we left off (i.e. the command that caused the error).
|
||
The default is to start where we left off.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.9)"><strong>ValueError</strong></a> – The context to reinvoke is not valid.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.valid">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">valid</span></span><a class="headerlink" href="#discord.ext.commands.Context.valid" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Checks if the invocation context is valid to be invoked with.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.clean_prefix">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">clean_prefix</span></span><a class="headerlink" href="#discord.ext.commands.Context.clean_prefix" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The cleaned up invoke prefix. i.e. mentions are <code class="docutils literal notranslate"><span class="pre">@name</span></code> instead of <code class="docutils literal notranslate"><span class="pre"><@id></span></code>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.cog">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">cog</span></span><a class="headerlink" href="#discord.ext.commands.Context.cog" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the cog associated with this context’s command. None if it does not exist.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.guild">
|
||
<span class="sig-name descname"><span class="pre">guild</span></span><a class="headerlink" href="#discord.ext.commands.Context.guild" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the guild associated with this context’s command. None if not available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.channel">
|
||
<span class="sig-name descname"><span class="pre">channel</span></span><a class="headerlink" href="#discord.ext.commands.Context.channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the channel associated with this context’s command.
|
||
Shorthand for <a class="reference internal" href="../../api.html#discord.Message.channel" title="discord.Message.channel"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Message.channel</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="../../api.html#discord.abc.Messageable" title="discord.abc.Messageable"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.Messageable</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.author">
|
||
<span class="sig-name descname"><span class="pre">author</span></span><a class="headerlink" href="#discord.ext.commands.Context.author" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Union[<a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a>, <a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a>]:
|
||
Returns the author associated with this context’s command. Shorthand for <a class="reference internal" href="../../api.html#discord.Message.author" title="discord.Message.author"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Message.author</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.me">
|
||
<span class="sig-name descname"><span class="pre">me</span></span><a class="headerlink" href="#discord.ext.commands.Context.me" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Union[<a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a>, <a class="reference internal" href="../../api.html#discord.ClientUser" title="discord.ClientUser"><code class="xref py py-class docutils literal notranslate"><span class="pre">ClientUser</span></code></a>]:
|
||
Similar to <a class="reference internal" href="../../api.html#discord.Guild.me" title="discord.Guild.me"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.me</span></code></a> except it may return the <a class="reference internal" href="../../api.html#discord.ClientUser" title="discord.ClientUser"><code class="xref py py-class docutils literal notranslate"><span class="pre">ClientUser</span></code></a> in private message contexts.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.voice_client">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">voice_client</span></span><a class="headerlink" href="#discord.ext.commands.Context.voice_client" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A shortcut to <a class="reference internal" href="../../api.html#discord.Guild.voice_client" title="discord.Guild.voice_client"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Guild.voice_client</span></code></a>, if applicable.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[<a class="reference internal" href="../../api.html#discord.VoiceProtocol" title="discord.VoiceProtocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">VoiceProtocol</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.author_permissions">
|
||
<span class="sig-name descname"><span class="pre">author_permissions</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.author_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the author permissions in the given channel.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.send_help">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send_help</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">entity=<bot></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.send_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Shows the help command for the specified entity if given.
|
||
The entity can be a command or a cog.</p>
|
||
<p>If no entity is given, then it’ll show help for the
|
||
entire bot.</p>
|
||
<p>If the entity is a string, then it looks up whether it’s a
|
||
<a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a> or a <a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Due to the way this function works, instead of returning
|
||
something similar to <a class="reference internal" href="#discord.ext.commands.HelpCommand.command_not_found" title="discord.ext.commands.HelpCommand.command_not_found"><code class="xref py py-meth docutils literal notranslate"><span class="pre">command_not_found()</span></code></a>
|
||
this returns <code class="xref py py-class docutils literal notranslate"><span class="pre">None</span></code> on bad input or no help command.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>entity</strong> (Optional[Union[<a class="reference internal" href="#discord.ext.commands.Command" title="discord.ext.commands.Command"><code class="xref py py-class docutils literal notranslate"><span class="pre">Command</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Cog" title="discord.ext.commands.Cog"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cog</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]]) – The entity to show help for.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The result of the help command, if any.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Any</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.fetch_message">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">fetch_message</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.fetch_message" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves a single <a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a> from the destination.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>id</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The message ID to look for.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.NotFound" title="discord.NotFound"><strong>NotFound</strong></a> – The specified message was not found.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have the permissions required to get a message.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the message failed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The message asked for.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.pins">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">pins</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.pins" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Retrieves all messages that are currently pinned in the channel.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Due to a limitation with the Discord API, the <a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>
|
||
objects returned by this method do not contain complete
|
||
<a class="reference internal" href="../../api.html#discord.Message.reactions" title="discord.Message.reactions"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Message.reactions</span></code></a> data.</p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Retrieving the pinned messages failed.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The messages that are currently pinned.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.trigger_typing">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">trigger_typing</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Context.trigger_typing" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Triggers a <em>typing</em> indicator to the destination.</p>
|
||
<p><em>Typing</em> indicator will go away after 10 seconds, or after a message is sent.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.send">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">send</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">content</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">return_message</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="n"><span class="pre">ephemeral</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</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="headerlink" href="#discord.ext.commands.Context.send" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A shortcut method to <a class="reference internal" href="../../api.html#discord.abc.Messageable.send" title="discord.abc.Messageable.send"><code class="xref py py-meth docutils literal notranslate"><span class="pre">abc.Messageable.send()</span></code></a> with interaction helpers.</p>
|
||
<p>This function takes all the parameters of <a class="reference internal" href="../../api.html#discord.abc.Messageable.send" title="discord.abc.Messageable.send"><code class="xref py py-meth docutils literal notranslate"><span class="pre">abc.Messageable.send()</span></code></a> plus the following:</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>return_message</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Ignored if not in a slash command context.
|
||
If this is set to False more native interaction methods will be used.</p></li>
|
||
<li><p><strong>ephemeral</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Ignored if not in a slash command context.
|
||
Indicates if the message should only be visible to the user who started the interaction.
|
||
If a view is sent with an ephemeral message and it has no timeout set then the timeout
|
||
is set to 15 minutes.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><p>In a slash command context, the message that was sent if return_message is True.</p>
|
||
<p>In a normal context, it always returns a <a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a></p>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p>Optional[Union[<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>, <a class="reference internal" href="../../api.html#discord.WebhookMessage" title="discord.WebhookMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">WebhookMessage</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Context.reply">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">reply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">content</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="headerlink" href="#discord.ext.commands.Context.reply" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>A shortcut method to <a class="reference internal" href="../../api.html#discord.abc.Messageable.send" title="discord.abc.Messageable.send"><code class="xref py py-meth docutils literal notranslate"><span class="pre">abc.Messageable.send()</span></code></a> to reply to the
|
||
<a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.6.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="../../api.html#discord.HTTPException" title="discord.HTTPException"><strong>HTTPException</strong></a> – Sending the message failed.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.Forbidden" title="discord.Forbidden"><strong>Forbidden</strong></a> – You do not have the proper permissions to send the message.</p></li>
|
||
<li><p><a class="reference internal" href="../../api.html#discord.InvalidArgument" title="discord.InvalidArgument"><strong>InvalidArgument</strong></a> – The <code class="docutils literal notranslate"><span class="pre">files</span></code> list is not of the appropriate size or
|
||
you specified both <code class="docutils literal notranslate"><span class="pre">file</span></code> and <code class="docutils literal notranslate"><span class="pre">files</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The message that was sent.</p>
|
||
</dd>
|
||
<dt class="field-odd">Return type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="converters">
|
||
<span id="ext-commands-api-converters"></span><h2>Converters<a class="headerlink" href="#converters" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Converter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Converter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Converter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The base class of custom converters that require the <a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>
|
||
to be passed to be useful.</p>
|
||
<p>This allows you to implement converters that function similar to the
|
||
special cased <code class="docutils literal notranslate"><span class="pre">discord</span></code> classes.</p>
|
||
<p>Classes that derive from this should override the <a class="reference internal" href="#discord.ext.commands.Converter.convert" title="discord.ext.commands.Converter.convert"><code class="xref py py-meth docutils literal notranslate"><span class="pre">convert()</span></code></a>
|
||
method to do its conversion logic. This method must be a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine" title="(in Python v3.9)"><span class="xref std std-ref">coroutine</span></a>.</p>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Converter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Converter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ObjectConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ObjectConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ObjectConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Object" title="discord.Object"><code class="xref py py-class docutils literal notranslate"><span class="pre">Object</span></code></a>.</p>
|
||
<p>The argument must follow the valid ID or mention formats (e.g. <cite><@80088516616269824></cite>).</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by member, role, or channel mention.</p></li>
|
||
</ol>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ObjectConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ObjectConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MemberConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MemberConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MemberConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Member" title="discord.Member"><code class="xref py py-class docutils literal notranslate"><span class="pre">Member</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name#discrim</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
<li><p>Lookup by nickname</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.MemberNotFound" title="discord.ext.commands.MemberNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MemberNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5.1: </span>This converter now lazily fetches members from the gateway and HTTP APIs,
|
||
optionally caching the result if <a class="reference internal" href="../../api.html#discord.MemberCacheFlags.joined" title="discord.MemberCacheFlags.joined"><code class="xref py py-attr docutils literal notranslate"><span class="pre">MemberCacheFlags.joined</span></code></a> is enabled.</p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MemberConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MemberConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UserConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">UserConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.UserConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.User" title="discord.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a>.</p>
|
||
<p>All lookups are via the global user cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name#discrim</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.UserNotFound" title="discord.ext.commands.UserNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.6: </span>This converter now lazily fetches users from the HTTP APIs if an ID is passed
|
||
and it’s not available in cache.</p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UserConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.UserConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MessageConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MessageConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MessageConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Message" title="discord.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.Message</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by “{channel ID}-{message ID}” (retrieved by shift-clicking on “Copy ID”)</p></li>
|
||
<li><p>Lookup by message ID (the message <strong>must</strong> be in the context channel)</p></li>
|
||
<li><p>Lookup by message URL</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.ChannelNotFound" title="discord.ext.commands.ChannelNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotFound</span></code></a>, <a class="reference internal" href="#discord.ext.commands.MessageNotFound" title="discord.ext.commands.MessageNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MessageNotFound</span></code></a> or <a class="reference internal" href="#discord.ext.commands.ChannelNotReadable" title="discord.ext.commands.ChannelNotReadable"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotReadable</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MessageConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MessageConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PartialMessageConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">PartialMessageConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.PartialMessageConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.PartialMessage" title="discord.PartialMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.PartialMessage</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<p>The creation strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>By “{channel ID}-{message ID}” (retrieved by shift-clicking on “Copy ID”)</p></li>
|
||
<li><p>By message ID (The message is assumed to be in the context channel.)</p></li>
|
||
<li><p>By message URL</p></li>
|
||
</ol>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PartialMessageConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.PartialMessageConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildChannelConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GuildChannelConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildChannelConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">GuildChannel</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name.</p></li>
|
||
</ol>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildChannelConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildChannelConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.TextChannelConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">TextChannelConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.TextChannelConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.TextChannel" title="discord.TextChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">TextChannel</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.ChannelNotFound" title="discord.ext.commands.ChannelNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.TextChannelConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.TextChannelConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.VoiceChannelConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">VoiceChannelConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.VoiceChannelConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.VoiceChannel" title="discord.VoiceChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">VoiceChannel</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.ChannelNotFound" title="discord.ext.commands.ChannelNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.VoiceChannelConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.VoiceChannelConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.StoreChannelConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">StoreChannelConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.StoreChannelConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.StoreChannel" title="discord.StoreChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">StoreChannel</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name.</p></li>
|
||
</ol>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.StoreChannelConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.StoreChannelConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.StageChannelConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">StageChannelConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.StageChannelConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.StageChannel" title="discord.StageChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">StageChannel</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.StageChannelConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.StageChannelConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CategoryChannelConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CategoryChannelConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CategoryChannelConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.CategoryChannel" title="discord.CategoryChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">CategoryChannel</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, then the lookup
|
||
is done by the global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.ChannelNotFound" title="discord.ext.commands.ChannelNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CategoryChannelConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CategoryChannelConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.InviteConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">InviteConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.InviteConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Invite" title="discord.Invite"><code class="xref py py-class docutils literal notranslate"><span class="pre">Invite</span></code></a>.</p>
|
||
<p>This is done via an HTTP request using <a class="reference internal" href="#discord.ext.commands.Bot.fetch_invite" title="discord.ext.commands.Bot.fetch_invite"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Bot.fetch_invite()</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.BadInviteArgument" title="discord.ext.commands.BadInviteArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadInviteArgument</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.InviteConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.InviteConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GuildConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Guild" title="discord.Guild"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guild</span></code></a>.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by name. (There is no disambiguation for Guilds with multiple matching names).</p></li>
|
||
</ol>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.RoleConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">RoleConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.RoleConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Role" title="discord.Role"><code class="xref py py-class docutils literal notranslate"><span class="pre">Role</span></code></a>.</p>
|
||
<p>All lookups are via the local guild. If in a DM context, the converter raises
|
||
<a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a> exception.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.RoleNotFound" title="discord.ext.commands.RoleNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RoleNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.RoleConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.RoleConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GameConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GameConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GameConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to <a class="reference internal" href="../../api.html#discord.Game" title="discord.Game"><code class="xref py py-class docutils literal notranslate"><span class="pre">Game</span></code></a>.</p>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GameConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GameConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ColourConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ColourConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ColourConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Colour" title="discord.Colour"><code class="xref py py-class docutils literal notranslate"><span class="pre">Colour</span></code></a>.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Add an alias named ColorConverter</p>
|
||
</div>
|
||
<p>The following formats are accepted:</p>
|
||
<ul>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">0x<hex></span></code></p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">#<hex></span></code></p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">0x#<hex></span></code></p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">rgb(<number>,</span> <span class="pre"><number>,</span> <span class="pre"><number>)</span></code></p></li>
|
||
<li><p>Any of the <code class="docutils literal notranslate"><span class="pre">classmethod</span></code> in <a class="reference internal" href="../../api.html#discord.Colour" title="discord.Colour"><code class="xref py py-class docutils literal notranslate"><span class="pre">Colour</span></code></a></p>
|
||
<blockquote>
|
||
<div><ul class="simple">
|
||
<li><p>The <code class="docutils literal notranslate"><span class="pre">_</span></code> in the name can be optionally replaced with spaces.</p></li>
|
||
</ul>
|
||
</div></blockquote>
|
||
</li>
|
||
</ul>
|
||
<p>Like CSS, <code class="docutils literal notranslate"><span class="pre"><number></span></code> can be either 0-255 or 0-100% and <code class="docutils literal notranslate"><span class="pre"><hex></span></code> can be
|
||
either a 6 digit hex number or a 3 digit hex shortcut (e.g. #fff).</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.BadColourArgument" title="discord.ext.commands.BadColourArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadColourArgument</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.7: </span>Added support for <code class="docutils literal notranslate"><span class="pre">rgb</span></code> function and 3-digit hex shortcuts</p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ColourConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ColourConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.EmojiConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">EmojiConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.EmojiConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.Emoji" title="discord.Emoji"><code class="xref py py-class docutils literal notranslate"><span class="pre">Emoji</span></code></a>.</p>
|
||
<p>All lookups are done for the local guild first, if available. If that lookup
|
||
fails, then it checks the client’s global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by extracting ID from the emoji.</p></li>
|
||
<li><p>Lookup by name</p></li>
|
||
</ol>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.EmojiNotFound" title="discord.ext.commands.EmojiNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">EmojiNotFound</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.EmojiConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.EmojiConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PartialEmojiConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">PartialEmojiConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.PartialEmojiConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.PartialEmoji" title="discord.PartialEmoji"><code class="xref py py-class docutils literal notranslate"><span class="pre">PartialEmoji</span></code></a>.</p>
|
||
<p>This is done by extracting the animated flag, name and ID from the emoji.</p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.5: </span>Raise <a class="reference internal" href="#discord.ext.commands.PartialEmojiConversionFailure" title="discord.ext.commands.PartialEmojiConversionFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">PartialEmojiConversionFailure</span></code></a> instead of generic <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PartialEmojiConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.PartialEmojiConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ThreadConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ThreadConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ThreadConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Coverts to a <a class="reference internal" href="../../api.html#discord.Thread" title="discord.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></a>.</p>
|
||
<p>All lookups are via the local guild.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Lookup by ID.</p></li>
|
||
<li><p>Lookup by mention.</p></li>
|
||
<li><p>Lookup by name.</p></li>
|
||
</ol>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ThreadConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ThreadConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildStickerConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GuildStickerConverter</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="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildStickerConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts to a <a class="reference internal" href="../../api.html#discord.GuildSticker" title="discord.GuildSticker"><code class="xref py py-class docutils literal notranslate"><span class="pre">GuildSticker</span></code></a>.</p>
|
||
<p>All lookups are done for the local guild first, if available. If that lookup
|
||
fails, then it checks the client’s global cache.</p>
|
||
<p>The lookup strategy is as follows (in order):</p>
|
||
<p>1. Lookup by ID.
|
||
3. Lookup by name</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildStickerConverter.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildStickerConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.clean_content">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">clean_content</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">fix_channel_mentions</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_nicknames</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="n"><span class="pre">escape_markdown</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">remove_markdown</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.clean_content" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Converts the argument to mention scrubbed version of
|
||
said content.</p>
|
||
<p>This behaves similarly to <a class="reference internal" href="../../api.html#discord.Message.clean_content" title="discord.Message.clean_content"><code class="xref py py-attr docutils literal notranslate"><span class="pre">clean_content</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.clean_content.fix_channel_mentions">
|
||
<span class="sig-name descname"><span class="pre">fix_channel_mentions</span></span><a class="headerlink" href="#discord.ext.commands.clean_content.fix_channel_mentions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to clean channel mentions.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.clean_content.use_nicknames">
|
||
<span class="sig-name descname"><span class="pre">use_nicknames</span></span><a class="headerlink" href="#discord.ext.commands.clean_content.use_nicknames" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to use nicknames when transforming mentions.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.clean_content.escape_markdown">
|
||
<span class="sig-name descname"><span class="pre">escape_markdown</span></span><a class="headerlink" href="#discord.ext.commands.clean_content.escape_markdown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to also escape special markdown characters.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.clean_content.remove_markdown">
|
||
<span class="sig-name descname"><span class="pre">remove_markdown</span></span><a class="headerlink" href="#discord.ext.commands.clean_content.remove_markdown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether to also remove special markdown characters. This option is not supported with <code class="docutils literal notranslate"><span class="pre">escape_markdown</span></code></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><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="discord.ext.commands.clean_content.convert">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.clean_content.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method to override to do conversion logic.</p>
|
||
<p>If an error is found while converting, it is recommended to
|
||
raise a <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a> derived exception as it will
|
||
properly propagate to the error handlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context that the argument is being used in.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument that is being converted.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A generic exception occurred when converting the argument.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><strong>BadArgument</strong></a> – The converter failed to convert the argument.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Greedy">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Greedy</span></span><a class="headerlink" href="#discord.ext.commands.Greedy" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special converter that greedily consumes arguments until it can’t.
|
||
As a consequence of this behaviour, most input errors are silently discarded,
|
||
since it is used as an indicator of when to stop parsing.</p>
|
||
<p>When a parser error is met the greedy converter stops converting, undoes the
|
||
internal string parsing routine, and continues parsing regularly.</p>
|
||
<p>For example, in the following code:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></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">test</span><span class="p">(</span><span class="n">ctx</span><span class="p">,</span> <span class="n">numbers</span><span class="p">:</span> <span class="n">Greedy</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">reason</span><span class="p">:</span> <span class="nb">str</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="s2">"numbers: </span><span class="si">{}</span><span class="s2">, reason: </span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">numbers</span><span class="p">,</span> <span class="n">reason</span><span class="p">))</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>An invocation of <code class="docutils literal notranslate"><span class="pre">[p]test</span> <span class="pre">1</span> <span class="pre">2</span> <span class="pre">3</span> <span class="pre">4</span> <span class="pre">5</span> <span class="pre">6</span> <span class="pre">hello</span></code> would pass <code class="docutils literal notranslate"><span class="pre">numbers</span></code> with
|
||
<code class="docutils literal notranslate"><span class="pre">[1,</span> <span class="pre">2,</span> <span class="pre">3,</span> <span class="pre">4,</span> <span class="pre">5,</span> <span class="pre">6]</span></code> and <code class="docutils literal notranslate"><span class="pre">reason</span></code> with <code class="docutils literal notranslate"><span class="pre">hello</span></code>.</p>
|
||
<p>For more information, check <a class="reference internal" href="commands.html#ext-commands-special-converters"><span class="std std-ref">Special Converters</span></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.run_converters">
|
||
<em class="property"><span class="pre">await</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">run_converters</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">converter</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">argument</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">param</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.run_converters" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>Runs converters for a given converter, argument, and parameter.</p>
|
||
<p>This function does the same work that the library does under the hood.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context to run the converters under.</p></li>
|
||
<li><p><strong>converter</strong> (<em>Any</em>) – The converter to run, this corresponds to the annotation in the function.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument to convert to.</p></li>
|
||
<li><p><strong>param</strong> (<a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a>) – The parameter being converted. This is mainly for error reporting.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – The converter failed to convert.</p>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The resulting conversion.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>Any</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<section id="option">
|
||
<h3>Option<a class="headerlink" href="#option" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Option">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Option</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default</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">description</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.Option" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A special ‘converter’ to apply a description to slash command options.</p>
|
||
<p>For example in the following code:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nd">@bot</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">ban</span><span class="p">(</span><span class="n">ctx</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="p">,</span> <span class="o">*</span><span class="p">,</span>
|
||
<span class="n">reason</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">commands</span><span class="o">.</span><span class="n">Option</span><span class="p">(</span><span class="s1">'no reason'</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s1">'the reason to ban this member'</span><span class="p">)</span>
|
||
<span class="p">):</span>
|
||
<span class="k">await</span> <span class="n">member</span><span class="o">.</span><span class="n">ban</span><span class="p">(</span><span class="n">reason</span><span class="o">=</span><span class="n">reason</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>The description would be <code class="docutils literal notranslate"><span class="pre">the</span> <span class="pre">reason</span> <span class="pre">to</span> <span class="pre">ban</span> <span class="pre">this</span> <span class="pre">member</span></code> and the default would be <code class="docutils literal notranslate"><span class="pre">no</span> <span class="pre">reason</span></code></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Option.default">
|
||
<span class="sig-name descname"><span class="pre">default</span></span><a class="headerlink" href="#discord.ext.commands.Option.default" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The default for this option, overwrites Option during parsing.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Optional[Any]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Option.description">
|
||
<span class="sig-name descname"><span class="pre">description</span></span><a class="headerlink" href="#discord.ext.commands.Option.description" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The description for this option, is unpacked to <a class="reference internal" href="#discord.ext.commands.Command.option_descriptions" title="discord.ext.commands.Command.option_descriptions"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.option_descriptions</span></code></a></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</section>
|
||
<section id="flag-converter">
|
||
<h3>Flag Converter<a class="headerlink" href="#flag-converter" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.FlagConverter">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">FlagConverter</span></span><a class="headerlink" href="#discord.ext.commands.FlagConverter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A converter that allows for a user-friendly flag syntax.</p>
|
||
<p>The flags are defined using <span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0526"><strong>PEP 526</strong></a> type annotations similar
|
||
to the <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.9)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dataclasses</span></code></a> Python module. For more information on
|
||
how this converter works, check the appropriate
|
||
<a class="reference internal" href="commands.html#ext-commands-flag-converter"><span class="std std-ref">documentation</span></a>.</p>
|
||
<div class="operations docutils container">
|
||
<dl class="describe">
|
||
<dt class="sig sig-object">
|
||
<span class="sig-name descname"><span class="pre">iter(x)</span></span></dt>
|
||
<dd><p>Returns an iterator of <code class="docutils literal notranslate"><span class="pre">(flag_name,</span> <span class="pre">flag_value)</span></code> pairs. This allows it
|
||
to be, for example, constructed as a dict or a list of pairs.
|
||
Note that aliases are not shown.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>case_insensitive</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – A class parameter to toggle case insensitivity of the flag parsing.
|
||
If <code class="docutils literal notranslate"><span class="pre">True</span></code> then flags are parsed in a case insensitive manner.
|
||
Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p></li>
|
||
<li><p><strong>prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The prefix that all flags must be prefixed with. By default
|
||
there is no prefix.</p></li>
|
||
<li><p><strong>delimiter</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The delimiter that separates a flag’s argument from the flag’s name.
|
||
By default this is <code class="docutils literal notranslate"><span class="pre">:</span></code>.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.FlagConverter.get_flags">
|
||
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">get_flags</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.FlagConverter.get_flags" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Dict[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference internal" href="#discord.ext.commands.Flag" title="discord.ext.commands.Flag"><code class="xref py py-class docutils literal notranslate"><span class="pre">Flag</span></code></a>]: A mapping of flag name to flag object this converter has.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.FlagConverter.convert">
|
||
<em class="property"><span class="pre">classmethod</span> <span class="pre">await</span> </em><span class="sig-name descname"><span class="pre">convert</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">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.FlagConverter.convert" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This function is a <a class="reference external" href="https://docs.python.org/3/library/asyncio-task.html#coroutine"><em>coroutine</em></a>.</p>
|
||
<p>The method that actually converters an argument to the flag mapping.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>cls</strong> (Type[<a class="reference internal" href="#discord.ext.commands.FlagConverter" title="discord.ext.commands.FlagConverter"><code class="xref py py-class docutils literal notranslate"><span class="pre">FlagConverter</span></code></a>]) – The flag converter class.</p></li>
|
||
<li><p><strong>ctx</strong> (<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>) – The invocation context.</p></li>
|
||
<li><p><strong>argument</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The argument to convert from.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.FlagError" title="discord.ext.commands.FlagError"><strong>FlagError</strong></a> – A flag related parsing error.</p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><strong>CommandError</strong></a> – A command related error.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The flag converter instance with all flags parsed.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p><a class="reference internal" href="#discord.ext.commands.FlagConverter" title="discord.ext.commands.FlagConverter"><code class="xref py py-class docutils literal notranslate"><span class="pre">FlagConverter</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag">
|
||
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">Flag</span></span><a class="headerlink" href="#discord.ext.commands.Flag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Represents a flag parameter for <a class="reference internal" href="#discord.ext.commands.FlagConverter" title="discord.ext.commands.FlagConverter"><code class="xref py py-class docutils literal notranslate"><span class="pre">FlagConverter</span></code></a>.</p>
|
||
<p>The <a class="reference internal" href="#discord.ext.commands.flag" title="discord.ext.commands.flag"><code class="xref py py-func docutils literal notranslate"><span class="pre">flag()</span></code></a> function helps
|
||
create these flag objects, but it is not necessary to
|
||
do so. These cannot be constructed manually.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.Flag.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The name of the flag.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.aliases">
|
||
<span class="sig-name descname"><span class="pre">aliases</span></span><a class="headerlink" href="#discord.ext.commands.Flag.aliases" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The aliases of the flag name.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.attribute">
|
||
<span class="sig-name descname"><span class="pre">attribute</span></span><a class="headerlink" href="#discord.ext.commands.Flag.attribute" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The attribute in the class that corresponds to this flag.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.default">
|
||
<span class="sig-name descname"><span class="pre">default</span></span><a class="headerlink" href="#discord.ext.commands.Flag.default" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The default value of the flag, if available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Any</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.annotation">
|
||
<span class="sig-name descname"><span class="pre">annotation</span></span><a class="headerlink" href="#discord.ext.commands.Flag.annotation" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The underlying evaluated annotation of the flag.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Any</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.max_args">
|
||
<span class="sig-name descname"><span class="pre">max_args</span></span><a class="headerlink" href="#discord.ext.commands.Flag.max_args" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The maximum number of arguments the flag can accept.
|
||
A negative value indicates an unlimited amount of arguments.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.override">
|
||
<span class="sig-name descname"><span class="pre">override</span></span><a class="headerlink" href="#discord.ext.commands.Flag.override" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether multiple given values overrides the previous value.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py property">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.Flag.required">
|
||
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">required</span></span><a class="headerlink" href="#discord.ext.commands.Flag.required" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether the flag is required.</p>
|
||
<p>A required flag has no default value.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.flag">
|
||
<span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">flag</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">name</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">aliases</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">default</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">max_args</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">override</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.flag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Override default functionality and parameters of the underlying <a class="reference internal" href="#discord.ext.commands.FlagConverter" title="discord.ext.commands.FlagConverter"><code class="xref py py-class docutils literal notranslate"><span class="pre">FlagConverter</span></code></a>
|
||
class attributes.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The flag name. If not given, defaults to the attribute name.</p></li>
|
||
<li><p><strong>aliases</strong> (List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Aliases to the flag name. If not given no aliases are set.</p></li>
|
||
<li><p><strong>default</strong> (<em>Any</em>) – The default parameter. This could be either a value or a callable that takes
|
||
<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> as its sole parameter. If not given then it defaults to
|
||
the default value given to the attribute.</p></li>
|
||
<li><p><strong>max_args</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – The maximum number of arguments the flag can accept.
|
||
A negative value indicates an unlimited amount of arguments.
|
||
The default value depends on the annotation given.</p></li>
|
||
<li><p><strong>override</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether multiple given values overrides the previous value. The default
|
||
value depends on the annotation given.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
</section>
|
||
<section id="exceptions">
|
||
<span id="ext-commands-api-errors"></span><h2>Exceptions<a class="headerlink" href="#exceptions" title="Permalink to this headline">¶</a></h2>
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CommandError</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CommandError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The base exception type for all command related errors.</p>
|
||
<p>This inherits from <a class="reference internal" href="../../api.html#discord.DiscordException" title="discord.DiscordException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">discord.DiscordException</span></code></a>.</p>
|
||
<p>This exception and exceptions inherited from it are handled
|
||
in a special way as they are caught and passed into a special event
|
||
from <a class="reference internal" href="#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>, <a class="reference internal" href="#discord.discord.ext.commands.on_command_error" title="discord.discord.ext.commands.on_command_error"><code class="xref py py-func docutils literal notranslate"><span class="pre">on_command_error()</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ConversionError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ConversionError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">converter</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">original</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ConversionError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a Converter class raises non-CommandError.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ConversionError.converter">
|
||
<span class="sig-name descname"><span class="pre">converter</span></span><a class="headerlink" href="#discord.ext.commands.ConversionError.converter" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The converter that failed.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Converter" title="discord.ext.commands.Converter"><code class="xref py py-class docutils literal notranslate"><span class="pre">discord.ext.commands.Converter</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ConversionError.original">
|
||
<span class="sig-name descname"><span class="pre">original</span></span><a class="headerlink" href="#discord.ext.commands.ConversionError.original" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The original exception that was raised. You can also get this via
|
||
the <code class="docutils literal notranslate"><span class="pre">__cause__</span></code> attribute.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.9)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingRequiredArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MissingRequiredArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">param</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MissingRequiredArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when parsing a command and a parameter
|
||
that is required is not encountered.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingRequiredArgument.param">
|
||
<span class="sig-name descname"><span class="pre">param</span></span><a class="headerlink" href="#discord.ext.commands.MissingRequiredArgument.param" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The argument that is missing.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ArgumentParsingError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ArgumentParsingError</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ArgumentParsingError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when the parser fails to parse a user’s input.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a>.</p>
|
||
<p>There are child classes that implement more granular parsing errors for
|
||
i18n purposes.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UnexpectedQuoteError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">UnexpectedQuoteError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">quote</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.UnexpectedQuoteError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when the parser encounters a quote mark inside a non-quoted string.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ArgumentParsingError" title="discord.ext.commands.ArgumentParsingError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ArgumentParsingError</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UnexpectedQuoteError.quote">
|
||
<span class="sig-name descname"><span class="pre">quote</span></span><a class="headerlink" href="#discord.ext.commands.UnexpectedQuoteError.quote" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The quote mark that was found inside the non-quoted string.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.InvalidEndOfQuotedStringError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">InvalidEndOfQuotedStringError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">char</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.InvalidEndOfQuotedStringError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when a space is expected after the closing quote in a string
|
||
but a different character is found.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ArgumentParsingError" title="discord.ext.commands.ArgumentParsingError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ArgumentParsingError</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.InvalidEndOfQuotedStringError.char">
|
||
<span class="sig-name descname"><span class="pre">char</span></span><a class="headerlink" href="#discord.ext.commands.InvalidEndOfQuotedStringError.char" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The character found instead of the expected string.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExpectedClosingQuoteError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ExpectedClosingQuoteError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">close_quote</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ExpectedClosingQuoteError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when a quote character is expected but not found.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ArgumentParsingError" title="discord.ext.commands.ArgumentParsingError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ArgumentParsingError</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExpectedClosingQuoteError.close_quote">
|
||
<span class="sig-name descname"><span class="pre">close_quote</span></span><a class="headerlink" href="#discord.ext.commands.ExpectedClosingQuoteError.close_quote" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The quote character expected.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadArgument</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a parsing or conversion failure is encountered
|
||
on an argument to pass into a command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadUnionArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadUnionArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">param</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">converters</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errors</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadUnionArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.9)"><code class="xref py py-data docutils literal notranslate"><span class="pre">typing.Union</span></code></a> converter fails for all
|
||
its associated types.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadUnionArgument.param">
|
||
<span class="sig-name descname"><span class="pre">param</span></span><a class="headerlink" href="#discord.ext.commands.BadUnionArgument.param" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The parameter that failed being converted.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadUnionArgument.converters">
|
||
<span class="sig-name descname"><span class="pre">converters</span></span><a class="headerlink" href="#discord.ext.commands.BadUnionArgument.converters" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A tuple of converters attempted in conversion, in order of failure.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Tuple[Type, <code class="docutils literal notranslate"><span class="pre">...</span></code>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadUnionArgument.errors">
|
||
<span class="sig-name descname"><span class="pre">errors</span></span><a class="headerlink" href="#discord.ext.commands.BadUnionArgument.errors" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A list of errors that were caught from failing the conversion.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandError</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadLiteralArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadLiteralArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">param</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">literals</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errors</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadLiteralArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Literal" title="(in Python v3.9)"><code class="xref py py-data docutils literal notranslate"><span class="pre">typing.Literal</span></code></a> converter fails for all
|
||
its associated values.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadLiteralArgument.param">
|
||
<span class="sig-name descname"><span class="pre">param</span></span><a class="headerlink" href="#discord.ext.commands.BadLiteralArgument.param" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The parameter that failed being converted.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/inspect.html#inspect.Parameter" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">inspect.Parameter</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadLiteralArgument.literals">
|
||
<span class="sig-name descname"><span class="pre">literals</span></span><a class="headerlink" href="#discord.ext.commands.BadLiteralArgument.literals" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A tuple of values compared against in conversion, in order of failure.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Tuple[Any, <code class="docutils literal notranslate"><span class="pre">...</span></code>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadLiteralArgument.errors">
|
||
<span class="sig-name descname"><span class="pre">errors</span></span><a class="headerlink" href="#discord.ext.commands.BadLiteralArgument.errors" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A list of errors that were caught from failing the conversion.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommandError</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PrivateMessageOnly">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">PrivateMessageOnly</span></span><span class="sig-paren">(</span><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="headerlink" href="#discord.ext.commands.PrivateMessageOnly" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when an operation does not work outside of private
|
||
message contexts.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.NoPrivateMessage">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">NoPrivateMessage</span></span><span class="sig-paren">(</span><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="headerlink" href="#discord.ext.commands.NoPrivateMessage" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when an operation does not work in private message
|
||
contexts.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CheckFailure">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CheckFailure</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CheckFailure" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the predicates in <a class="reference internal" href="#discord.ext.commands.Command.checks" title="discord.ext.commands.Command.checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.checks</span></code></a> have failed.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CheckAnyFailure">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CheckAnyFailure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">checks</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errors</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CheckAnyFailure" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when all predicates in <a class="reference internal" href="#discord.ext.commands.check_any" title="discord.ext.commands.check_any"><code class="xref py py-func docutils literal notranslate"><span class="pre">check_any()</span></code></a> fail.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.3.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CheckAnyFailure.errors">
|
||
<span class="sig-name descname"><span class="pre">errors</span></span><a class="headerlink" href="#discord.ext.commands.CheckAnyFailure.errors" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A list of errors that were caught during execution.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-class docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CheckAnyFailure.checks">
|
||
<span class="sig-name descname"><span class="pre">checks</span></span><a class="headerlink" href="#discord.ext.commands.CheckAnyFailure.checks" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A list of check predicates that failed.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[Callable[[<a class="reference internal" href="#discord.ext.commands.Context" title="discord.ext.commands.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CommandNotFound</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CommandNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a command is attempted to be invoked
|
||
but no command under that name is found.</p>
|
||
<p>This is not raised for invalid subcommands, rather just the
|
||
initial main command that is attempted to be invoked.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.DisabledCommand">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">DisabledCommand</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.DisabledCommand" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command being invoked is disabled.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandInvokeError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CommandInvokeError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">e</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CommandInvokeError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command being invoked raised an exception.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandInvokeError.original">
|
||
<span class="sig-name descname"><span class="pre">original</span></span><a class="headerlink" href="#discord.ext.commands.CommandInvokeError.original" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The original exception that was raised. You can also get this via
|
||
the <code class="docutils literal notranslate"><span class="pre">__cause__</span></code> attribute.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.9)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.TooManyArguments">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">TooManyArguments</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.TooManyArguments" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command was passed too many arguments and its
|
||
<a class="reference internal" href="#discord.ext.commands.Command.ignore_extra" title="discord.ext.commands.Command.ignore_extra"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Command.ignore_extra</span></code></a> attribute was not set to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UserInputError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">UserInputError</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.UserInputError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The base exception type for errors that involve errors
|
||
regarding user input.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandOnCooldown">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CommandOnCooldown</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cooldown</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">retry_after</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CommandOnCooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command being invoked is on cooldown.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandOnCooldown.cooldown">
|
||
<span class="sig-name descname"><span class="pre">cooldown</span></span><a class="headerlink" href="#discord.ext.commands.CommandOnCooldown.cooldown" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A class with attributes <code class="docutils literal notranslate"><span class="pre">rate</span></code> and <code class="docutils literal notranslate"><span class="pre">per</span></code> similar to the
|
||
<a class="reference internal" href="#discord.ext.commands.cooldown" title="discord.ext.commands.cooldown"><code class="xref py py-func docutils literal notranslate"><span class="pre">cooldown()</span></code></a> decorator.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Cooldown" title="discord.ext.commands.Cooldown"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cooldown</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandOnCooldown.type">
|
||
<span class="sig-name descname"><span class="pre">type</span></span><a class="headerlink" href="#discord.ext.commands.CommandOnCooldown.type" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The type associated with the cooldown.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandOnCooldown.retry_after">
|
||
<span class="sig-name descname"><span class="pre">retry_after</span></span><a class="headerlink" href="#discord.ext.commands.CommandOnCooldown.retry_after" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The amount of seconds to wait before you can retry again.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MaxConcurrencyReached">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MaxConcurrencyReached</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">number</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">per</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MaxConcurrencyReached" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command being invoked has reached its maximum concurrency.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MaxConcurrencyReached.number">
|
||
<span class="sig-name descname"><span class="pre">number</span></span><a class="headerlink" href="#discord.ext.commands.MaxConcurrencyReached.number" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The maximum number of concurrent invokers allowed.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MaxConcurrencyReached.per">
|
||
<span class="sig-name descname"><span class="pre">per</span></span><a class="headerlink" href="#discord.ext.commands.MaxConcurrencyReached.per" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The bucket type passed to the <a class="reference internal" href="#discord.ext.commands.max_concurrency" title="discord.ext.commands.max_concurrency"><code class="xref py py-func docutils literal notranslate"><span class="pre">max_concurrency()</span></code></a> decorator.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.BucketType" title="discord.ext.commands.BucketType"><code class="xref py py-class docutils literal notranslate"><span class="pre">BucketType</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.NotOwner">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">NotOwner</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.NotOwner" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the message author is not the owner of the bot.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MessageNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MessageNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MessageNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the message provided was not found in the channel.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MessageNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.MessageNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The message supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MemberNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MemberNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MemberNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the member provided was not found in the bot’s
|
||
cache.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MemberNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.MemberNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The member supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GuildNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the guild provided was not found in the bot’s cache.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.7.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.GuildNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The guild supplied by the called that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UserNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">UserNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.UserNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the user provided was not found in the bot’s
|
||
cache.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.UserNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.UserNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The user supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ChannelNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ChannelNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ChannelNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot can not find the channel.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ChannelNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.ChannelNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ChannelNotReadable">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ChannelNotReadable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ChannelNotReadable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot does not have permission to read messages
|
||
in the channel.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ChannelNotReadable.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.ChannelNotReadable.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel supplied by the caller that was not readable</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a>, <a class="reference internal" href="../../api.html#discord.Thread" title="discord.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ThreadNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ThreadNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ThreadNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot can not find the thread.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ThreadNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.ThreadNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The thread supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadColourArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadColourArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadColourArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the colour is not valid.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadColourArgument.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.BadColourArgument.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The colour supplied by the caller that was not valid</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.RoleNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">RoleNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.RoleNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot can not find the role.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.RoleNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.RoleNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The role supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadInviteArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadInviteArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadInviteArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the invite is invalid or expired.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadInviteArgument.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.BadInviteArgument.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The invite supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.EmojiNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">EmojiNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.EmojiNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot can not find the emoji.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.EmojiNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.EmojiNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The emoji supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PartialEmojiConversionFailure">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">PartialEmojiConversionFailure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.PartialEmojiConversionFailure" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the emoji provided does not match the correct
|
||
format.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.PartialEmojiConversionFailure.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.PartialEmojiConversionFailure.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The emoji supplied by the caller that did not match the regex</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildStickerNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">GuildStickerNotFound</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.GuildStickerNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot can not find the sticker.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.GuildStickerNotFound.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.GuildStickerNotFound.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The sticker supplied by the caller that was not found</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadBoolArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadBoolArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadBoolArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a boolean argument was not convertable.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.5.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadBoolArgument.argument">
|
||
<span class="sig-name descname"><span class="pre">argument</span></span><a class="headerlink" href="#discord.ext.commands.BadBoolArgument.argument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The boolean argument supplied by the caller that is not in the predefined list</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingPermissions">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MissingPermissions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">missing_permissions</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><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MissingPermissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command invoker lacks permissions to run a
|
||
command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingPermissions.missing_permissions">
|
||
<span class="sig-name descname"><span class="pre">missing_permissions</span></span><a class="headerlink" href="#discord.ext.commands.MissingPermissions.missing_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The required permissions that are missing.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BotMissingPermissions">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BotMissingPermissions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">missing_permissions</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><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BotMissingPermissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot’s member lacks permissions to run a
|
||
command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BotMissingPermissions.missing_permissions">
|
||
<span class="sig-name descname"><span class="pre">missing_permissions</span></span><a class="headerlink" href="#discord.ext.commands.BotMissingPermissions.missing_permissions" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The required permissions that are missing.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingRole">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MissingRole</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">missing_role</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MissingRole" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command invoker lacks a role to run a command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingRole.missing_role">
|
||
<span class="sig-name descname"><span class="pre">missing_role</span></span><a class="headerlink" href="#discord.ext.commands.MissingRole.missing_role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The required role that is missing.
|
||
This is the parameter passed to <a class="reference internal" href="#discord.ext.commands.has_role" title="discord.ext.commands.has_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_role()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BotMissingRole">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BotMissingRole</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">missing_role</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BotMissingRole" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot’s member lacks a role to run a command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BotMissingRole.missing_role">
|
||
<span class="sig-name descname"><span class="pre">missing_role</span></span><a class="headerlink" href="#discord.ext.commands.BotMissingRole.missing_role" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The required role that is missing.
|
||
This is the parameter passed to <a class="reference internal" href="#discord.ext.commands.has_role" title="discord.ext.commands.has_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_role()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>Union[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingAnyRole">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MissingAnyRole</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">missing_roles</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MissingAnyRole" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the command invoker lacks any of
|
||
the roles specified to run a command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingAnyRole.missing_roles">
|
||
<span class="sig-name descname"><span class="pre">missing_roles</span></span><a class="headerlink" href="#discord.ext.commands.MissingAnyRole.missing_roles" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The roles that the invoker is missing.
|
||
These are the parameters passed to <a class="reference internal" href="#discord.ext.commands.has_any_role" title="discord.ext.commands.has_any_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_any_role()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[Union[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BotMissingAnyRole">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BotMissingAnyRole</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">missing_roles</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BotMissingAnyRole" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when the bot’s member lacks any of
|
||
the roles specified to run a command.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BotMissingAnyRole.missing_roles">
|
||
<span class="sig-name descname"><span class="pre">missing_roles</span></span><a class="headerlink" href="#discord.ext.commands.BotMissingAnyRole.missing_roles" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The roles that the bot’s member is missing.
|
||
These are the parameters passed to <a class="reference internal" href="#discord.ext.commands.has_any_role" title="discord.ext.commands.has_any_role"><code class="xref py py-func docutils literal notranslate"><span class="pre">has_any_role()</span></code></a>.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[Union[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.NSFWChannelRequired">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">NSFWChannelRequired</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">channel</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.NSFWChannelRequired" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exception raised when a channel does not have the required NSFW setting.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.1.</span></p>
|
||
</div>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>channel</strong> (Union[<a class="reference internal" href="../../api.html#discord.abc.GuildChannel" title="discord.abc.GuildChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">abc.GuildChannel</span></code></a>, <a class="reference internal" href="../../api.html#discord.Thread" title="discord.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">Thread</span></code></a>]) – The channel that does not have NSFW enabled.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.FlagError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">FlagError</span></span><span class="sig-paren">(</span><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>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.FlagError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The base exception type for all flag parsing related errors.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadFlagArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">BadFlagArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.BadFlagArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when a flag failed to convert a value.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.FlagError" title="discord.ext.commands.FlagError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FlagError</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.BadFlagArgument.flag">
|
||
<span class="sig-name descname"><span class="pre">flag</span></span><a class="headerlink" href="#discord.ext.commands.BadFlagArgument.flag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The flag that failed to convert.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Flag" title="discord.ext.commands.Flag"><code class="xref py py-class docutils literal notranslate"><span class="pre">Flag</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingFlagArgument">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MissingFlagArgument</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MissingFlagArgument" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when a flag did not get a value.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.FlagError" title="discord.ext.commands.FlagError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FlagError</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingFlagArgument.flag">
|
||
<span class="sig-name descname"><span class="pre">flag</span></span><a class="headerlink" href="#discord.ext.commands.MissingFlagArgument.flag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The flag that did not get a value.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Flag" title="discord.ext.commands.Flag"><code class="xref py py-class docutils literal notranslate"><span class="pre">Flag</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.TooManyFlags">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">TooManyFlags</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.TooManyFlags" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when a flag has received too many values.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.FlagError" title="discord.ext.commands.FlagError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FlagError</span></code></a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.TooManyFlags.flag">
|
||
<span class="sig-name descname"><span class="pre">flag</span></span><a class="headerlink" href="#discord.ext.commands.TooManyFlags.flag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The flag that received too many values.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Flag" title="discord.ext.commands.Flag"><code class="xref py py-class docutils literal notranslate"><span class="pre">Flag</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.TooManyFlags.values">
|
||
<span class="sig-name descname"><span class="pre">values</span></span><a class="headerlink" href="#discord.ext.commands.TooManyFlags.values" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The values that were passed.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p>List[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingRequiredFlag">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">MissingRequiredFlag</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.MissingRequiredFlag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when a required flag was not given.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.FlagError" title="discord.ext.commands.FlagError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FlagError</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 2.0.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.MissingRequiredFlag.flag">
|
||
<span class="sig-name descname"><span class="pre">flag</span></span><a class="headerlink" href="#discord.ext.commands.MissingRequiredFlag.flag" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The required flag that was not found.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#discord.ext.commands.Flag" title="discord.ext.commands.Flag"><code class="xref py py-class docutils literal notranslate"><span class="pre">Flag</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ExtensionError</span></span><span class="sig-paren">(</span><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>, <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">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ExtensionError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Base exception for extension related errors.</p>
|
||
<p>This inherits from <a class="reference internal" href="../../api.html#discord.DiscordException" title="discord.DiscordException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DiscordException</span></code></a>.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionError.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.ExtensionError.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The extension that had an error.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionAlreadyLoaded">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ExtensionAlreadyLoaded</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="headerlink" href="#discord.ext.commands.ExtensionAlreadyLoaded" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when an extension has already been loaded.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ExtensionError" title="discord.ext.commands.ExtensionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionNotLoaded">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ExtensionNotLoaded</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="headerlink" href="#discord.ext.commands.ExtensionNotLoaded" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when an extension was not loaded.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ExtensionError" title="discord.ext.commands.ExtensionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.NoEntryPointError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">NoEntryPointError</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="headerlink" href="#discord.ext.commands.NoEntryPointError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when an extension does not have a <code class="docutils literal notranslate"><span class="pre">setup</span></code> entry point function.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ExtensionError" title="discord.ext.commands.ExtensionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionError</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionFailed">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ExtensionFailed</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">original</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.ExtensionFailed" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when an extension failed to load during execution of the module or <code class="docutils literal notranslate"><span class="pre">setup</span></code> entry point.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ExtensionError" title="discord.ext.commands.ExtensionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionError</span></code></a></p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionFailed.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.ExtensionFailed.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The extension that had the error.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionFailed.original">
|
||
<span class="sig-name descname"><span class="pre">original</span></span><a class="headerlink" href="#discord.ext.commands.ExtensionFailed.original" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The original exception that was raised. You can also get this via
|
||
the <code class="docutils literal notranslate"><span class="pre">__cause__</span></code> attribute.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.9)"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionNotFound">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">ExtensionNotFound</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="headerlink" href="#discord.ext.commands.ExtensionNotFound" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when an extension is not found.</p>
|
||
<p>This inherits from <a class="reference internal" href="#discord.ext.commands.ExtensionError" title="discord.ext.commands.ExtensionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionError</span></code></a></p>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 1.3: </span>Made the <code class="docutils literal notranslate"><span class="pre">original</span></code> attribute always None.</p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.ExtensionNotFound.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.ExtensionNotFound.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The extension that had the error.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandRegistrationError">
|
||
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">discord.ext.commands.</span></span><span class="sig-name descname"><span class="pre">CommandRegistrationError</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="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alias_conflict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#discord.ext.commands.CommandRegistrationError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An exception raised when the command can’t be added
|
||
because the name is already taken by a different command.</p>
|
||
<p>This inherits from <a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">discord.ClientException</span></code></a></p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">New in version 1.4.</span></p>
|
||
</div>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandRegistrationError.name">
|
||
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#discord.ext.commands.CommandRegistrationError.name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The command name that had the error.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="discord.ext.commands.CommandRegistrationError.alias_conflict">
|
||
<span class="sig-name descname"><span class="pre">alias_conflict</span></span><a class="headerlink" href="#discord.ext.commands.CommandRegistrationError.alias_conflict" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether the name that conflicts is an alias of the command we try to add.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Type</dt>
|
||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<section id="exception-hierarchy">
|
||
<h3>Exception Hierarchy<a class="headerlink" href="#exception-hierarchy" title="Permalink to this headline">¶</a></h3>
|
||
<div class="exception-hierarchy-content">
|
||
<ul class="simple">
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="../../api.html#discord.DiscordException" title="discord.DiscordException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DiscordException</span></code></a></dt><dd><ul>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.CommandError" title="discord.ext.commands.CommandError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandError</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ConversionError" title="discord.ext.commands.ConversionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ConversionError</span></code></a></p></li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.UserInputError" title="discord.ext.commands.UserInputError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserInputError</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MissingRequiredArgument" title="discord.ext.commands.MissingRequiredArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingRequiredArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.TooManyArguments" title="discord.ext.commands.TooManyArguments"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TooManyArguments</span></code></a></p></li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.BadArgument" title="discord.ext.commands.BadArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadArgument</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MessageNotFound" title="discord.ext.commands.MessageNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MessageNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MemberNotFound" title="discord.ext.commands.MemberNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MemberNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.GuildNotFound" title="discord.ext.commands.GuildNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">GuildNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.UserNotFound" title="discord.ext.commands.UserNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ChannelNotFound" title="discord.ext.commands.ChannelNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ChannelNotReadable" title="discord.ext.commands.ChannelNotReadable"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ChannelNotReadable</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadColourArgument" title="discord.ext.commands.BadColourArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadColourArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.RoleNotFound" title="discord.ext.commands.RoleNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RoleNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadInviteArgument" title="discord.ext.commands.BadInviteArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadInviteArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.EmojiNotFound" title="discord.ext.commands.EmojiNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">EmojiNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.GuildStickerNotFound" title="discord.ext.commands.GuildStickerNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">GuildStickerNotFound</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.PartialEmojiConversionFailure" title="discord.ext.commands.PartialEmojiConversionFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">PartialEmojiConversionFailure</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadBoolArgument" title="discord.ext.commands.BadBoolArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadBoolArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ThreadNotFound" title="discord.ext.commands.ThreadNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ThreadNotFound</span></code></a></p></li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.FlagError" title="discord.ext.commands.FlagError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FlagError</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadFlagArgument" title="discord.ext.commands.BadFlagArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadFlagArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MissingFlagArgument" title="discord.ext.commands.MissingFlagArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingFlagArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.TooManyFlags" title="discord.ext.commands.TooManyFlags"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TooManyFlags</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MissingRequiredFlag" title="discord.ext.commands.MissingRequiredFlag"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingRequiredFlag</span></code></a></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadUnionArgument" title="discord.ext.commands.BadUnionArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadUnionArgument</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BadLiteralArgument" title="discord.ext.commands.BadLiteralArgument"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BadLiteralArgument</span></code></a></p></li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.ArgumentParsingError" title="discord.ext.commands.ArgumentParsingError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ArgumentParsingError</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.UnexpectedQuoteError" title="discord.ext.commands.UnexpectedQuoteError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnexpectedQuoteError</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.InvalidEndOfQuotedStringError" title="discord.ext.commands.InvalidEndOfQuotedStringError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">InvalidEndOfQuotedStringError</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExpectedClosingQuoteError" title="discord.ext.commands.ExpectedClosingQuoteError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExpectedClosingQuoteError</span></code></a></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandNotFound" title="discord.ext.commands.CommandNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandNotFound</span></code></a></p></li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.CheckFailure" title="discord.ext.commands.CheckFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckFailure</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CheckAnyFailure" title="discord.ext.commands.CheckAnyFailure"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CheckAnyFailure</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.PrivateMessageOnly" title="discord.ext.commands.PrivateMessageOnly"><code class="xref py py-exc docutils literal notranslate"><span class="pre">PrivateMessageOnly</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.NoPrivateMessage" title="discord.ext.commands.NoPrivateMessage"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoPrivateMessage</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.NotOwner" title="discord.ext.commands.NotOwner"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NotOwner</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MissingPermissions" title="discord.ext.commands.MissingPermissions"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingPermissions</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BotMissingPermissions" title="discord.ext.commands.BotMissingPermissions"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingPermissions</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MissingRole" title="discord.ext.commands.MissingRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingRole</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BotMissingRole" title="discord.ext.commands.BotMissingRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingRole</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MissingAnyRole" title="discord.ext.commands.MissingAnyRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MissingAnyRole</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.BotMissingAnyRole" title="discord.ext.commands.BotMissingAnyRole"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BotMissingAnyRole</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.NSFWChannelRequired" title="discord.ext.commands.NSFWChannelRequired"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NSFWChannelRequired</span></code></a></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.DisabledCommand" title="discord.ext.commands.DisabledCommand"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DisabledCommand</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandInvokeError" title="discord.ext.commands.CommandInvokeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandInvokeError</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandOnCooldown" title="discord.ext.commands.CommandOnCooldown"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandOnCooldown</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.MaxConcurrencyReached" title="discord.ext.commands.MaxConcurrencyReached"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MaxConcurrencyReached</span></code></a></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="#discord.ext.commands.ExtensionError" title="discord.ext.commands.ExtensionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionError</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionAlreadyLoaded" title="discord.ext.commands.ExtensionAlreadyLoaded"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionAlreadyLoaded</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotLoaded" title="discord.ext.commands.ExtensionNotLoaded"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionNotLoaded</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.NoEntryPointError" title="discord.ext.commands.NoEntryPointError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoEntryPointError</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionFailed" title="discord.ext.commands.ExtensionFailed"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionFailed</span></code></a></p></li>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.ExtensionNotFound" title="discord.ext.commands.ExtensionNotFound"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExtensionNotFound</span></code></a></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
<li><dl class="simple">
|
||
<dt><a class="reference internal" href="../../api.html#discord.ClientException" title="discord.ClientException"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ClientException</span></code></a></dt><dd><ul>
|
||
<li><p><a class="reference internal" href="#discord.ext.commands.CommandRegistrationError" title="discord.ext.commands.CommandRegistrationError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">CommandRegistrationError</span></code></a></p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</main>
|
||
<footer class="grid-item">
|
||
© 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> |