Restructure Discord.markdown to clarify process (#22410)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Stevie Robinson 2022-06-28 21:10:11 +02:00 committed by Franck Nijhof
parent 3fde86da35
commit d01ef2978a
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -16,31 +16,34 @@ ha_integration_type: integration
The [Discord service](https://discordapp.com/) is a platform for the notify component. This allows integrations to send messages to the user using Discord.
In order to get a token you need to go to the [Discord My Apps page](https://discordapp.com/developers/applications/me) and create a new application. Once the application is ready, create a [bot](https://discordapp.com/developers/docs/topics/oauth2#bots) user (**Create a Bot User**).
## Prerequisites
Retrieve the **Client ID** from the information section and the (hidden) **Token** of your bot for later.
### Creating a Discord Application
In order to create a bot user a Discord Application is required. Go to the [Discord My Apps page](https://discordapp.com/developers/applications/me) and create a new application.
When setting up the application you can use this [icon](/images/favicon-192x192-full.png).
{% include integrations/config_flow.md %}
Once the application is ready, create a [bot](https://discordapp.com/developers/docs/topics/oauth2#bots) user (**Create a Bot User**).
Retrieve the **Application ID** from the 'General Information' section and the (hidden) **Token** of your bot for later.
<div class='note'>
The name you give your application on the [Discord My Apps page](https://discordapp.com/developers/applications/me) will determine the name of the notify service. For example: if you enter "Discord Chat", the service will be named `notify.discord_chat`.
</div>
## Setting up the bot
### Setting up the bot
Bots can send messages to servers and users or attach local available images. To add the bot to a server you are an admin on, get the details of the bot from the [Discord My Apps page](https://discordapp.com/developers/applications/me).
Bots can send messages to servers and users or attach locally available images. To add the bot to a server you are an admin on use the **Application ID** you noted above, found on the [Discord My Apps page](https://discordapp.com/developers/applications/me).
<p class='img'>
<img src='/images/screenshots/discord-bot.png' />
</p>
Now use the Discord Authorization page with the **Client ID** of your [bot](https://discordapp.com/developers/docs/topics/oauth2#bots).
Now use the Discord Authorization page with the **Application ID** of your [application](https://discordapp.com/developers/docs/topics/oauth2#bots).
`https://discordapp.com/api/oauth2/authorize?client_id=[CLIENT_ID]&scope=bot&permissions=0`
`https://discordapp.com/api/oauth2/authorize?client_id=[APPLICATION_ID]&scope=bot&permissions=0`
<p class='img'>
<img src='/images/screenshots/discord-auth.png' />
@ -56,7 +59,13 @@ Once the bot has been added to your server, get the channel ID of the channel yo
Right click channel name and copy the channel ID (**Copy ID**).
This channel or user ID has to be used as the target when calling the notification service. Multiple channel or user IDs can be specified, across multiple servers or direct messages.
This channel or a user ID has to be used as the target when calling the notification service. Multiple channel or user IDs can be specified, across multiple servers or direct messages.
## Add Discord integration to Home Assistant
{% include integrations/config_flow.md %}
When adding the Discord integration you will be asked for an API Key. Enter the hidden **Token** of your bot to link your Discord integration to the bot you created and allow Home Assistant to send messages as that bot.
## Discord Service Data