Discord Bot Construction Kit 🤖



Whoops, I deleted the wrong link from the OP. (There were two plugins, I should have deleted the OAuth one, but instead I deleted the link to the bot!)

Uninstall that plugin asap, as Core now supports Discord OAuth out of the box.

The bot plugin is THIS one:


I’ve altered the OP accordingly, sorry about that!!


Do we know what the status might be of us getting this plugin to automatically update users at the time of their group joining instead of manually syncing? And potentially a way to tell it what groups/roles to sync together instead of it taking over / creating the roles itself?


First time that’s been requested so as you might imagine, it’s not even in backlog as it were.

That would be quite tricky as the bot runs on a discrete thread. You’d have to add a method to message the bot and ensure it’s listening for the request. An interesting exercise technically but not trivial.

Alternatively it might be better to explore a direct API call alternative instead of using the bot. Then you have to decide whether that warrants delivery in a different plugin based on discrete calls, not a bot.

That’s a not a bad idea but why do you need them to be different out of interest?

This is more practical.

PR accepted. Unfortunately my time is very limited to work on significant features without funding.


Well as it is now, it appears to base the roles off of the “name” instead of the title. Which means my roles on discord end up having dashing and no spaces for example. So I suppose an alternative solution is to have it base the roles not on the name but instead the full name, or default title.

That said, there are potentially groups on discourse that I would not want it to sync at all to discord.

Appreciate the responses :slight_smile:


This is on purpose to avoid keying off a description field which can:

a) have spaces in it
b) not be unique

(and is usually a terrible idea in computer science)

However, if there is a safe way of improving this I’m all ears. I appreciate it doesn’t ‘look’ very nice :slight_smile:

The plugin could definitely have additional functionality added to turn sync off for specific groups, at the admin’s discretion. PR accepted.


Could we have the bot auto sync at a scheduled time in the meantime while an API method is explored? Something like, check once every hour, or 24, etc ?

1 Like

I believe it would be possible to add ‘repeat this again after x hours’ like functionality no problem.

The problem with that though is that will stop every time the bot goes down (e.g. on a reboot).

The absolute best approach would be to either:

a) add a discrete API call connected to a sidekiq job to this plugin OR
b) write a new plugin that used normal API calls instead of utilising a bot (and incorporate a batch sync in that).

Either of those things are going to need sponsorship or a PR.

1 Like

Fair enough. Thanks for the help.



I’m using your plugin currently and have everything at a workable point. It seems really nice, good work!

However, I have some questions: now that I have everything running I need my users to login via Discord OAuth. This creates a new account.

What is the best way for me to manage this? Do I need to merge the new and old accounts? I tried this with my Admin account and get the error “You don’t have permission to execute command discsync!” when trying to manually !discsync.

Additionally, it has not yet copied across any roles from my discourse.

For awareness, my discord account shows in my options as being an associated account.

Thanks in advance for your help!


Thanks for your interest in the plugin!

This is not a feature of the plugin, this is a core feature. Discord OAuth is shipped with Discourse by default.:


The above settings appear regardless of you adding this plugin to your Discourse.

If you login via the social account, so long as the registration emails match, the account should be recognised and no new account will be created. If however, the user has signed up for Discord using a different email to Discourse, yes, of course, there is no way for it to know it is the same user, so a new account will be created.

Your admin account on the Discord server? Also did you authorise the bot?

What is the result of Ping!?


Ack to that. I can just merge accounts with non-matching emails in a worst case scenario.

Yep, that’s right. I’m the owner of the discord and discourse instances. The result of “Ping!” Is “Pong!”. No roles have been migrated from the Discourse to Discord.

The bot is on my Discord server and has admin privs. Can I clarify what you mean by authorising?


Have you completed this step? (just checking all prerequisites, you almost certainly have).


Yeah, I have :slight_smile:

1 Like

My hunch is that your rights or that of the bot on the Discord server are not set up correctly somehow. I’m just refreshing my memory with this plugin as I work on dozens. My last change to this one was a while back!

1 Like

Roger! I’ve had a quick check on my side, so for your awareness I am listed as the server owner and I have admin rights.

EDIT: Can we clarify what rights the bot requires? It’s currently listed as an admin (this was granted to it by a role as opposed to the OAuth invite, though).

1 Like

My bot has these:


1 Like

Here are mine (sorry, as a new user here

I need to make 3 posts…)

1 Like

Could you check the channel permissions? Channel permissions on Discord override Server permissions.

1 Like

Yeah, it’s in the channel fine. There aren’t any permissions off in there that would prevent it from sending/receiving messages.

It can send Pong!, and it tells me I don’t have the required permissions to launch !discsync

1 Like