Discord integration¶
A Discord integration can be added to your Drovio Server instance. It lets users
start Drovio sessions right from Discord, in a server channel or in their direct
messages: /drovio start posts a message with a Join button, which follows the
session while it runs, then tells how long it lasted. Users can also invite someone
to a session or ask them to become their Drovio contact.
Sessions are hosted and joined in the browser, or in the Drovio app, which adds remote control with several cursors.
The first time, a user signs in to your Drovio Server instance once, to link their Discord account to their Drovio account. Their Drovio account has to exist already.
HTTPS only
Discord sends the commands to your server over HTTPS only. The interactions
endpoint of your Drovio Server, /discord/interactions, has to be reachable over
HTTPS from the internet. The pages linking the accounts are opened by the browser
of your users and only need to be reachable from it.
Create a Discord application¶
Go to the Discord Developer Portal and select New Application. Give it the name your users will see (Drovio for instance) and accept the terms.
General Information¶
Note the Application ID and the Public Key, then set the Interactions Endpoint URL to the interactions endpoint of your server:
Discord checks the endpoint before saving it, by sending it a request signed with the public key of the application. Configure and enable the integration first, as described in Configure the integration, then come back to save the URL.
The App Icon and the Description are what your users see when they add the application.
OAuth2¶
Select Reset Secret and note the Client Secret. The integration registers the commands of the application with it.
Bot¶
Select Reset Token and note the Token of the bot. No privileged gateway intent is needed: the integration never reads the messages of the channels.
The bot sends the contact requests and keeps the message of a session up to date
once a quarter of an hour has passed. Without it, /drovio add is not available
and the message of a session stops changing after a quarter of an hour.
Installation¶
Under Installation Contexts, check User Install and Guild Install, keep the Install Link on Discord Provided Link, then set the Default Install Settings:
| Context | Scopes | Permissions |
|---|---|---|
| User Install | applications.commands |
|
| Guild Install | applications.commands, bot |
View Channels, Send Messages |
Guild Install adds the application to a server, where everyone can use it. User Install adds it to the account of a user, who can then use it in their direct messages and in any server.
Configure the integration¶
In the administration panel, open Integrations, then Configure on the Discord card.
| Field | Where it comes from |
|---|---|
| Status | Enabled or Disabled |
| Application ID | General Information of the Discord application |
| Public key | General Information of the Discord application |
| Client secret | OAuth2 of the Discord application |
| Bot token | Bot of the Discord application |
The page never shows the client secret nor the bot token once saved: leave their field empty to keep them. Enabling the integration takes the application ID, the public key and the client secret.
The page also shows the Interactions Endpoint URL to enter in General Information. Once the application ID is saved, it shows the install link of the application too.
Saving takes effect on the next request, with no restart to perform. Once enabled,
the integration registers the /drovio command and the entries of the Apps
menu with Discord. Discord can take a few minutes to show them. Restarting the
Discord app sometimes helps.
Turning the status to Disabled refuses the requests coming from Discord, while leaving the page available to configure the integration.
Configuration reference¶
These are the keys of the discord element of settings.conf, should you prefer
to edit it directly. In a cluster, the administration panel cannot save them: each
server reads its own settings file, which has to be edited on every one of them.
| Key | Default | Meaning |
|---|---|---|
enabled |
false |
Enable the integration |
application_id |
Application ID, in General Information | |
public_key |
Public Key, in General Information, which Discord signs the commands with | |
client_secret |
Client Secret, in OAuth2, which the commands are registered with | |
bot_token |
Token of the bot, in Bot. Empty, no contact request goes out and the message of a session stops changing after a quarter of an hour |
Add the application¶
The Integrations page of the Drovio account of each user offers to add Discord. It opens the install link of the application, where Discord lets the user choose:
- Add to server, to add it to a server the user manages: everyone in the server can then use it;
- Add to my apps, to use it in their direct messages and in any server.
The install link is also on the Discord page of the administration panel and in Installation of the Developer Portal, to share it with the administrators of your Discord servers.
In a private channel, add the bot to the members of the channel. Otherwise it does not see the channel and the message of a session stops changing after a quarter of an hour.
Use the integration¶
| Command | What it does |
|---|---|
/drovio start |
Starts a Drovio session and posts its link in the channel |
/drovio start user:@someone |
Starts a Drovio session and invites someone to it |
/drovio add user:@someone |
Asks someone to become your Drovio contact |
/drovio help |
Shows what the Drovio commands do, to you only |
The menu of a user also offers, under Apps:
| Entry | What it does |
|---|---|
| Start a Drovio session | Starts a Drovio session and invites the user to it |
| Add to Drovio contacts | Asks the user to become your Drovio contact |
The commands, the answers and the buttons follow the language of the Discord app of each user: English, French, German, Spanish, Italian or Brazilian Portuguese.
Link the Drovio account¶
The first time, the answer to a command offers a Connect Drovio button. It opens a page of your Drovio Server instance to link the Discord account of the user to their Drovio account:
- a user already signed in to Drovio in their browser is asked to confirm the account to link, with Connect;
- any other user signs in first, with their password or with single sign-on, then confirms.
The link holds until the user disconnects it, from the Integrations page of their Drovio account.
The message of a session¶
/drovio start posts a message with a Join button. While the session runs, the
message shows when it started and who is in it. Once it ends, the button goes away
and the message tells how long the session lasted.
Discord lets the integration change the message during a quarter of an hour. After that, the bot keeps it up to date, as long as it is a member of the server and sees the channel. In direct messages, the message stops changing after a quarter of an hour.
Contact requests¶
/drovio add sends the person asked a direct message from the bot, with
Accept and Decline. Once accepted, both become Drovio contacts. A request
left unanswered expires after seven days.
The bot can only write to people who share a server with it and accept direct messages from the members of that server. Otherwise, the answer to the command tells that the person could not be reached.