Skip to main content

Custom Discord Application

In this article, we will guide you through creating a custom Discord application, 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 JSON Format. Please keep in mind that it is not mandatory for the Drivers Hub to operate. If you met any problems, or need to revert to the default application we provide, please reach out to support team in ticket.

  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 and paste them as discord_client_id and discord_client_secret in JSON Config.

  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}/discord-auth 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.
    Example: Screenshot_8.png

  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 as discord_bot_token in JSON Config.

  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 as there's hundreds of existing guide on the Internet.

  13. Switch to Drivers Hub tab, paste the ID as guild_id in JSON Config.

  14. Save config. (You cannot reload until you enable MFA)

  15. Switch to settings and enable MFA.

  16. Switch to configuration and reload API.

  17. 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.

  18. 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!

[NOTE] You may want to configure the Verify Linked Role URL to enable linked roles in Discord. We'll update the documentation in the future~