Discord Sync: sync a Discourse forum with a Discord server

:warning: This plugin is automatic; it does not have any command. If you are looking for manual syncing or trust-level based restrictions, please check @merefield solution here.

Discord Sync Sync a Discourse forum with a Discord server :discourse:

This plugin allows syncing certain user-related stuff between a Discourse forum instance and a Discord server. It will create a Discord Bot to handle all permissions and trigger with some actions in the server.


  • Sync Discourse groups to Discord roles
    It will automatically manage roles in the Discord server based in the groups that a user has access in Discourse.

    • Verified Role
      You can add a “verified role” that will be granted to all Discord users who have linked a Discord account.

    • Safe Roles
      As this plugin will force having the same roles in Discord than groups in Discourse, you can set a list of roles that the bot will ignore and you can manually manage in the Discord server

  • Sync Discourse username to Discord nickname
    If you want to recognize users by their forum username, you can force them to have the same Discord server nickname as the username they have in Discord


The plugin will run a complete Discourse-to-Discord sync (nickname and roles) in the following cases:

  • Discourse
    • User is added to a group
    • User is removed from a group
    • User profile is updated
      Intended for username-nickname syncing
    • User is authenticated
      It will only run if the auth provider is Discord, to make sure a first sync is executed just right after linking accounts
  • Discord
    • User joins a Discord server
      It will search in the database for an user with the given Discord ID, and then run the sync job


:exclamation: This plugin depends on Discord OAuth2 to identify and link Discourse-Discord accounts. If you don’t want to allow users to login with Discord, but you wish to keep linking account, check the solution to this topic.


This plugin requires libsodium (required by the Discord Ruby gem). To install it, modify your .yml file and add the following code:

       - exec:
                - apt-get update
                - apt-get install -y libsodium-dev

Installation steps

  1. Follow the standard guide at How to install a plugin with this repository URL: https://github.com/barreeeiroo/discourse-discord-sync.git
  2. Follow this guide to set up Login with Discord in your Discourse instance.
  3. In the Discord Developer portal, go to Bot, and add it to your server. Make sure you grant him the highest possible role.
  4. In Discourse, in Plugin Settings, set discord sync token with the Bot token that appears in the previous step.

Configuration options

  • discord sync enabled: Whether or not to enable the integration
  • discord sync token: Bot token from Discord
  • discord sync prefix: Prefix for commands (just !ping by now)
  • discord sync admin channel id: Channel to post logging messages (nick changes, role changes)
  • discord sync username: If true, it will sync all Discord server nicknames to their Discourse username
  • discord sync verified role: Role to add to all users who have a Discourse account
  • discord sync safe roles: List of roles that bot will ignore and will mark as manually granted in Discord

How To

To link accounts, if you allow users to authenticate with Discord, they can just use that provider. If not, they will have to their Account Preferences, scroll down to Associated Accounts and hit Connect in the Discord row.

Live Demo

We are currently using this plugin in our Discourse instance at Kodular Community, with the Discord server at kodul.ar/discord:


I’m going to install this plugin right now! :grinning:



I was thinking about building a similar Discord integration myself but now I don’t have to! Excited to try this one out @barreeeiroo


This is really cool! I’m more of a Telegram fan myself, but Discord is great too! I feel like Telegram would pair well with Discourse, both being well known open-source projects focused on communication.

That would be cool if this had a cross-posting feature. If someone said something in the Discord chat, it would create a reply in a specific Discord thread known as the “chat room thread”. Thus giving your Discourse website an SEO boost because of all the new content within the chat thread.


I also like Telegram a lot, and we were using it with a public chat group. But a few days ago we switched to Discord, because we had over 1k members and it’s quite hard to moderate such a large group. It was easy to do it with Discord with their role system.


Nice work :slight_smile:

In addition to @merefield’s Discord Bot, there’s also a pure OAuth2 (bot free) Discord role <> Discourse group sync plugin (e.g. sync trust level 3 with a Discord role) here