Discord Sync Sync a Discourse forum with a Discord server
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.
You can add a “verified role” that will be granted to all Discord users who have linked a Discord account.
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:
- 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
- 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
- User joins a Discord server
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:
hooks: before_code: - exec: cmd: - apt-get update - apt-get install -y libsodium-dev
- Follow the standard guide at How to install a plugin with this repository URL:
- Follow this guide to set up Login with Discord in your Discourse instance.
- In the Discord Developer portal, go to Bot, and add it to your server. Make sure you grant him the highest possible role.
- In Discourse, in Plugin Settings, set
discord sync tokenwith the Bot token that appears in the previous step.
discord sync enabled: Whether or not to enable the integration
discord sync token: Bot token from Discord
discord sync prefix: Prefix for commands (just
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
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.
We are currently using this plugin in our Discourse instance at Kodular Community, with the Discord server at kodul.ar/discord:
Discourse Bot, made by @merefield
Thanks a lot to Robert for providing the skeleton of this plugin. It has certainly helped to set up the base of this entire plugin, allowing to run a Discord bot in a Discourse instance (and kudos for his trick on getting
Login with Discord, made by Discourse team
This plugin wouldn’t be possible without the Discord OAuth2 integration (formerly a plugin), to link both Discourse and Discord accounts.
This plugin relies on the
discordrbgem, which allows connecting to the Discord API using Ruby.