2021-10-03 16:18:46 +05:30

234 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Creating a Bot Account</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" />
</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="#" selected>discord</option>
<option value="ext/commands/index.html" >discord.ext.commands</option>
<option value="ext/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="#">Creating a Bot Account</a><ul>
<li><a class="reference internal" href="#inviting-your-bot">Inviting Your Bot</a></li>
</ul>
</li>
</ul>
</div>
</aside>
<main class="grid-item" role="main">
<section id="creating-a-bot-account">
<span id="discord-intro"></span><h1>Creating a Bot Account<a class="headerlink" href="#creating-a-bot-account" title="Permalink to this headline"></a></h1>
<p>In order to work with the library and the Discord API in general, we must first create a Discord Bot account.</p>
<p>Creating a Bot account is a pretty straightforward process.</p>
<ol class="arabic">
<li><p>Make sure youre logged on to the <a class="reference external" href="https://discord.com">Discord website</a>.</p></li>
<li><p>Navigate to the <a class="reference external" href="https://discord.com/developers/applications">application page</a></p></li>
<li><p>Click on the “New Application” button.</p>
<blockquote>
<div><img alt="The new application button." src="_images/discord_create_app_button.png" />
</div></blockquote>
</li>
<li><p>Give the application a name and click “Create”.</p>
<blockquote>
<div><img alt="The new application form filled in." src="_images/discord_create_app_form.png" />
</div></blockquote>
</li>
<li><p>Create a Bot User by navigating to the “Bot” tab and clicking “Add Bot”.</p>
<blockquote>
<div><ul class="simple">
<li><p>Click “Yes, do it!” to continue.</p></li>
</ul>
<img alt="The Add Bot button." src="_images/discord_create_bot_user.png" />
</div></blockquote>
</li>
<li><p>Make sure that <strong>Public Bot</strong> is ticked if you want others to invite your bot.</p>
<blockquote>
<div><ul class="simple">
<li><p>You should also make sure that <strong>Require OAuth2 Code Grant</strong> is unchecked unless you
are developing a service that needs it. If youre unsure, then <strong>leave it unchecked</strong>.</p></li>
</ul>
<img alt="How the Bot User options should look like for most people." src="_images/discord_bot_user_options.png" />
</div></blockquote>
</li>
<li><p>Copy the token using the “Copy” button.</p>
<blockquote>
<div><ul class="simple">
<li><p><strong>This is not the Client Secret at the General Information page.</strong></p></li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>It should be worth noting that this token is essentially your bots
password. You should <strong>never</strong> share this with someone else. In doing so,
someone can log in to your bot and do malicious things, such as leaving
servers, ban all members inside a server, or pinging everyone maliciously.</p>
<p>The possibilities are endless, so <strong>do not share this token.</strong></p>
<p>If you accidentally leaked your token, click the “Regenerate” button as soon
as possible. This revokes your old token and re-generates a new one.
Now you need to use the new token to login.</p>
</div>
</div></blockquote>
</li>
</ol>
<p>And thats it. You now have a bot account and you can login with that token.</p>
<section id="inviting-your-bot">
<span id="discord-invite-bot"></span><h2>Inviting Your Bot<a class="headerlink" href="#inviting-your-bot" title="Permalink to this headline"></a></h2>
<p>So youve made a Bot User but its not actually in any server.</p>
<p>If you want to invite your bot you must create an invite URL for it.</p>
<ol class="arabic">
<li><p>Make sure youre logged on to the <a class="reference external" href="https://discord.com">Discord website</a>.</p></li>
<li><p>Navigate to the <a class="reference external" href="https://discord.com/developers/applications">application page</a></p></li>
<li><p>Click on your bots page.</p></li>
<li><p>Go to the “OAuth2” tab.</p>
<blockquote>
<div><img alt="How the OAuth2 page should look like." src="_images/discord_oauth2.png" />
</div></blockquote>
</li>
<li><p>Tick the “bot” checkbox under “scopes”.</p>
<blockquote>
<div><img alt="The scopes checkbox with &quot;bot&quot; ticked." src="_images/discord_oauth2_scope.png" />
</div></blockquote>
</li>
<li><p>Tick the permissions required for your bot to function under “Bot Permissions”.</p>
<blockquote>
<div><ul class="simple">
<li><p>Please be aware of the consequences of requiring your bot to have the “Administrator” permission.</p></li>
<li><p>Bot owners must have 2FA enabled for certain actions and permissions when added in servers that have Server-Wide 2FA enabled. Check the <a class="reference external" href="https://support.discord.com/hc/en-us/articles/219576828-Setting-up-Two-Factor-Authentication">2FA support page</a> for more information.</p></li>
</ul>
<img alt="The permission checkboxes with some permissions checked." src="_images/discord_oauth2_perms.png" />
</div></blockquote>
</li>
<li><p>Now the resulting URL can be used to add your bot to a server. Copy and paste the URL into your browser, choose a server to invite the bot to, and click “Authorize”.</p></li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The person adding the bot needs “Manage Server” permissions to do so.</p>
</div>
<p>If you want to generate this URL dynamically at run-time inside your bot and using the
<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> interface, you can use <a class="reference internal" href="api.html#discord.utils.oauth_url" title="discord.utils.oauth_url"><code class="xref py py-func docutils literal notranslate"><span class="pre">discord.utils.oauth_url()</span></code></a>.</p>
</section>
</section>
</main>
<footer class="grid-item">
&#169; Copyright 2015-present, Rapptz.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
</footer>
</div>
<div id="settings" class="modal" onclick="if (event.target == this){ settingsModal.close(); }" hidden>
<div class="modal-content">
<span class="close" onclick="settingsModal.close();" title="Close">
<span class="material-icons">close</span>
</span>
<h1>Settings</h1>
<h2>Font</h2>
<div class="setting">
<h3>Use a serif font:
<label class="toggle"
title="Use a serif font? Your system font will be used, falling back to serif.">
<input type="checkbox" name="useSerifFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
<h2>Theme</h2>
<div class="setting">
<h3>
<label class="toggle" title="Set your theme based on your system preferences">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="automatic" checked>
</label>
Automatic
</h3>
<h3>
<label class="toggle" title="Set your theme to light theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="light">
</label>
Light
</h3>
<h3>
<label class="toggle" title="Set your theme to dark theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="dark">
</label>
Dark
</h3>
</div>
</div>
</div>
<div id="to-top" onclick="scrollToTop()" hidden>
<span><span class="material-icons">arrow_upward</span> to top</span>
</div>
</body>
</html>