Discord Bot Construction Kit 🤖

Increase your Visibility Level. The standard automated Groups default to Visibility 1 (“Logged on users”), so if this value is zero you exclude the default automated Groups:

Zero will only include Groups visible to everyone including anonymous.

3 Likes

That is me squared away. Thank you very much - greatly appreciated.

Can I help out, in return, by writing some of what I have learned into your guide? If not, no dramas; I’m just hoping to pay forward your support.

3 Likes

That’s very kind. Would be delighted to have you edit it. You should be able to already? It’s a wiki

You helped me also to refresh my memory :slight_smile:

2 Likes

I don’t really need role syncing but a discord bot that posts in specific channels of the discord server when new topics are made in the forum, would be nice. Is there any plugin that can do that?

1 Like

Yeah this plugin is probably not the right tool for that. The bot is powered by your Discourse and can access your Discourse data (where permitted and prompted by command) but runs in a separate thread so will not be signalled by Discourse events.

I guess it might be feasible to extend it at some point to eg watch for a new Topics within a specific category. Not the best use of this architecture but PR welcome.

Sounds like you need to investigate?:

Or

1 Like

Yep, I investigated both of those options. The first option, Zapier, isn’t free. You can make up to 5 free Zaps and those are single-step zaps. This is exactly what was said in that thread, so the alternative that was proposed was the discourse-chat-integration which is supposedly an official plugin. I think this is the closest way to do what I want to do.

The last option seems to be an RSS feed plugin:

Update: After learning to properly setup the rules and configuring the webhooks, the chat-integration does exactly what I wanted! Thanks.

4 Likes

Hey @merefield,

thanks again for reaching out with this plugin!

I installed everything like described in the docs. I use this command: !discsync and everything is looking good to me. :smiling_face_with_three_hearts:

However for some users (not for all) I get for all of their groups this error:

Discourse Sync:  [11/31] Adding member 'MaxMustermann' to 'Member'
Discourse Sync:  I dont appear to have rights to do this though!
ERROR on server XYZ (ID: 123123123123) for command ^add_role, undefined method add_role' for nil:NilClass

Other users are able to be sync for the same group :thinking:

1 Like

That suggests your provider_uid in Discourse is not set for that user. Please investigate.

https://github.com/merefield/discourse-discord-bot/blob/b3b3d7f2315b9ecf6a35b27cb0b089cf0766aa54/plugin.rb#L132

Well done for setting this up btw. It’s quite complex and not for the faint hearted! :).

2 Likes

I ran this query in the Knowledge Explorer Plugin:

SELECT *
FROM   user_associated_accounts  u 
WHERE  u.provider_name = 'discord' 

I can’t post the result for reasons :smile: but I checked every user for their provider_uid and each user has one. Is there anything else I could debug?

1 Like

Then the next most likely issue is that the currently mapped Discord UID is wrong.

ie the data in Discourse is not mapping to a valid UID in Discord.

Check this users record in Discord manually and confirm it is correct.

2 Likes

Hey, I can confirm this. The user has another UID in Discourse than in Discord.

How can this issue be reproduced?

1 Like

Could you delete the association and ask the user to recreate by associating Discord once more? If it happens again, something is buggy with the social login?

2 Likes

Hey,

I just wanted to do an follow up. I was talking to the people who had these issues. We could determine the possible issue.

The User signed up with his old discord account which he didn’t joined the server with. So the Sync Bot could not find the discord user I guess and errored.

2 Likes

Thanks for clarifying. Can you confirm how you resolved? Did you delete his association and then get him to reassociate?

1 Like

That’s what we did. :blush:

2 Likes

Great. Btw I will gladly consider any useful generic improvements to this plugin in case you decide to get coding again :wink:

2 Likes

Okay let’s start slow. I just submitted my first pull request to this repo :smile:.
https://github.com/merefield/discourse-discord-bot/pull/3

4 Likes

merged :slight_smile: danke!

4 Likes

Hey! I’ve been trying to find a plugin that will give users in Discord a role based on the badges they have on their Discourse profile. Is this possible with your plugin? If not, is it even possible? Thanks!

2 Likes

Not at present but no reason why you couldn’t fork it and add an appropriate command to implement that!

If implemented well I would consider merging a PR. However it might be a little specific for general use because presumably you’d have to maintain some kind of mapping unless the badge names were same as role names? In any case you’d have to filter out most of them? That might get messy for general use. If you find a really clean way to manage that which would work for general users of the plugin let me know.

But fork away, fill your boots!

2 Likes