Skip to main content

Custom Discord Application

In this article, we will guide you through creating a custom Discord application and linking it with Drivers Hub, rather than using the application and bot we provided by default.
[NOTE] The guide might be difficult if you have little knowledge on Discord Developer Portal and URL. Please keep in mind that it is not mandatory for the Drivers Hub to operate.

  1. Open Discord Developer Portal and click New Application.

  2. Enter the name of the application, check the "agree box" and click create.
    There's no requirement on the name, it could be anything you want.

  3. (Optional) Customize the application.
    App Icon will be displayed when users authorize their Discord Account. Description will be the About Me of the bot that we will create later.

  4. Navigate to OAuth2 - General and reset Client Reset.
    i) Click Reset Secret.

    ii) A prompt will be shown. Click Yes, do it!

    iii) You'll be asked for 2FA Code if enabled. Enter the code and click Submit.

  5. Copy Client ID and Client Secret, switch to Drivers Hub tab, navigate to Configuration - Discord & Steam API, and paste them in the field for Discord Client ID and Discord Client Secret.

  6. In order for the Discord Application to verify your identity on the Hub and perform various redirects, click the Add Redirect button in the "OAuth2 - General > Redirects" section to create a new redirect by entering the https://{your_hub_domain}/auth/discord/callback value and save the changes with the Save Changes button.
    You have to enter your own hub address instead of the {your_hub_domain} placeholder.

  7. Switch to Discord Developers Portal, create a bot.
    i) Navigate to Bot, and click Add Bot.

    ii) A prompt will be shown. Click Yes, do it!

  8. (Optional) Customize the bot.
    Icon will be the bot's avatar.

  9. Scroll down, enable all Privileged Gateway Intents.

  10. Reset the bot's token, just like when you reset the client secret.

  11. Copy Token, switch to Drivers Hub tab and paste it in the field for Discord Bot Token.

  12. Open Discord Application, go to the VTC's Discord Server, right click it's name, then click Copy ID.
    Note that you have to enable Developer Mode to make Copy ID button show. We won't provide guide on enabling Developer Mode here and you will have to search it out by yourself.

  13. Switch to Drivers Hub tab, paste the ID in the field for Discord Server ID.

  14. Save and reload config.

  15. Invite the bot to VTC's Discord Server. This could be done by changing the scopes in URL Generator to bot and application.commands, and checking Manage Roles, Send Messages, Read Message History in bot permissions (note that these permissions are required by Drivers Hub Discord Integration, it might need more permissions if you use the bot for other purposes). Then copy the generated URL and open it in browser to add the bot to a Discord Server.
    Please search on the Internet if you need more guide on inviting a bot to a Discord Server.

  16. The API reload usually takes up to 60 seconds. You will have to clear browser cache for the website before trying to login with Discord (because the discord_client_id is cached forever).
    Also, keep in mind that discord_client_secret and discord_bot_token will be empty when you load the config again for security reasons, they are stored in the server so don't worry!

  17. To support Linked Roles, set https://{your_hub_domain}/auth/discord/redirect as the value of General Information - Linked Roles Verification URL.
    Similar to step 6, you have to enter your own hub address instead of the {your_hub_domain} placeholder.

  18. Navigate to API (JSON) tab in Drivers Hub - Configuration, scroll to the bottom and click Enable in the left, to officially enable Linked Roles in Discord.