Update docs, mostly Inviting Your Bot
@ -8,23 +8,23 @@ In order to work with the library and the Discord API in general, we must first
|
||||
Creating a Bot account is a pretty straightforward process.
|
||||
|
||||
1. Make sure you're logged on to the `Discord website <https://discordapp.com>`_.
|
||||
2. Navigate to the `application page <https://discordapp.com/developers/applications/me>`_
|
||||
3. Click on the "New App" button.
|
||||
2. Navigate to the `application page <https://discordapp.com/developers/applications>`_
|
||||
3. Click on the "New Application" button.
|
||||
|
||||
.. image:: /images/discord_create_app_button.png
|
||||
:alt: The new app button.
|
||||
:alt: The new application button.
|
||||
|
||||
4. Give the application a name and a description if wanted and click "Create App".
|
||||
|
||||
- You can also put an avatar you want your bot to use, don't worry you can change this later.
|
||||
- **Leave the Redirect URI(s) blank** unless are creating a service.
|
||||
4. Give the application a name and click "Create".
|
||||
|
||||
.. image:: /images/discord_create_app_form.png
|
||||
:alt: The new application form filled in.
|
||||
5. Create a Bot User by clicking on the accompanying button and confirming it.
|
||||
|
||||
5. Create a Bot User by navigating to the "Bot" tab and clicking "Add Bot".
|
||||
|
||||
- Click "Yes, do it!" to continue.
|
||||
|
||||
.. image:: /images/discord_create_bot_user.png
|
||||
:alt: The Create a Bot User button.
|
||||
:alt: The Add Bot button.
|
||||
6. Make sure that **Public Bot** is ticked if you want others to invite your bot.
|
||||
|
||||
- You should also make sure that **Require OAuth2 Code Grant** is unchecked unless you
|
||||
@ -33,10 +33,9 @@ Creating a Bot account is a pretty straightforward process.
|
||||
.. image:: /images/discord_bot_user_options.png
|
||||
:alt: How the Bot User options should look like for most people.
|
||||
|
||||
7. Click to reveal the token.
|
||||
7. Copy the token using the "Copy" button.
|
||||
|
||||
- **This is not the Client Secret**
|
||||
- Look at the image above to see where the **Token** is.
|
||||
- **This is not the Client Secret at the General Information page**
|
||||
|
||||
.. warning::
|
||||
|
||||
@ -47,6 +46,10 @@ Creating a Bot account is a pretty straightforward process.
|
||||
|
||||
The possibilities are endless, so **do not share this token.**
|
||||
|
||||
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.
|
||||
|
||||
And that's it. You now have a bot account and you can login with that token.
|
||||
|
||||
.. _discord_invite_bot:
|
||||
@ -56,42 +59,36 @@ Inviting Your Bot
|
||||
|
||||
So you've made a Bot User but it's not actually in any server.
|
||||
|
||||
If you want to invite your bot you must create an invite URL for your bot.
|
||||
If you want to invite your bot you must create an invite URL for it.
|
||||
|
||||
First, you must fetch the Client ID of the Bot. You can find this in the Bot's application page.
|
||||
1. Make sure you're logged on to the `Discord website <https://discordapp.com>`_.
|
||||
2. Navigate to the `application page <https://discordapp.com/developers/applications>`_
|
||||
3. Click on your bot's page.
|
||||
4. Go to the "OAuth2" tab.
|
||||
|
||||
.. image:: /images/discord_client_id.png
|
||||
:alt: The Bot's Client ID.
|
||||
.. image:: /images/discord_oauth2.png
|
||||
:alt: How the OAuth2 page should look like.
|
||||
|
||||
Copy paste that into the pre-formatted URL:
|
||||
5. Tick the "bot" checkbox under "scopes".
|
||||
|
||||
.. code-block:: none
|
||||
.. image:: /images/discord_oauth2_scope.png
|
||||
:alt: The scopes checkbox with "bot" ticked.
|
||||
|
||||
https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=0
|
||||
6. Tick the permissions required for your bot to function under "Bot Permissions".
|
||||
|
||||
Replace ``YOUR_CLIENT_ID`` with the Client ID we got in the previous step. For example,
|
||||
in the image above our client ID is 312777964700041216 so the resulting URL would be
|
||||
https://discordapp.com/oauth2/authorize?client_id=312777964700041216&scope=bot&permissions=0
|
||||
(note that this bot has been deleted).
|
||||
- Please be aware of the consequences of requiring your bot to have the "Administrator" permission.
|
||||
|
||||
Now you can click the link and invite your bot to any server you have "Manage Server" permissions on.
|
||||
- Bot owners must have 2FA enabled for certain actions and permissions when added in servers that have Server-Wide 2FA enabled. Check the `2FA support page <https://support.discordapp.com/hc/en-us/articles/219576828-Setting-up-Two-Factor-Authentication>`_ for more information.
|
||||
|
||||
Adding Permissions
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
.. image:: /images/discord_oauth2_perms.png
|
||||
:alt: The permission checkboxes with some permissions checked.
|
||||
|
||||
In the above URL, you might have noticed an interesting bit, the ``permissions=0`` fragment.
|
||||
7. 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".
|
||||
|
||||
Bot accounts can request specific permissions to be granted upon joining. When the bot joins
|
||||
the guild, they will be granted a managed role that contains the permissions you requested.
|
||||
If the permissions is 0, then no special role is created.
|
||||
|
||||
This ``permissions`` value is calculated based on bit-wise arithmetic. Thankfully, people have
|
||||
created a calculator that makes it easy to calculate the permissions necessary visually.
|
||||
.. note::
|
||||
|
||||
- https://discordapi.com/permissions.html
|
||||
- https://finitereality.github.io/permissions/
|
||||
|
||||
Feel free to use whichever is easier for you to grasp.
|
||||
The person adding the bot needs "Manage Server" permissions to do so.
|
||||
|
||||
If you want to generate this URL dynamically at run-time inside your bot and using the
|
||||
:class:`discord.Permissions` interface, you can use :func:`discord.utils.oauth_url`.
|
||||
|
@ -215,8 +215,8 @@ one of the following functions:
|
||||
|
||||
The following use an HTTP request:
|
||||
|
||||
- :meth:`abc.Messageable.get_message`
|
||||
- :meth:`Client.get_user_info`
|
||||
- :meth:`abc.Messageable.fetch_message`
|
||||
- :meth:`Client.fetch_user`
|
||||
|
||||
|
||||
If the functions above do not help you, then use of :func:`utils.find` or :func:`utils.get` would serve some use in finding
|
||||
@ -297,4 +297,3 @@ Example: ::
|
||||
await ctx.send('Pushing to {} {}'.format(remote, branch))
|
||||
|
||||
This could then be used as ``?git push origin master``.
|
||||
|
||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 16 KiB |
BIN
docs/images/discord_oauth2.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/discord_oauth2_perms.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
docs/images/discord_oauth2_scope.png
Normal file
After Width: | Height: | Size: 31 KiB |