Discord Bot Construction Kit šŸ¤–

Allright. Thatā€™s a bit of a bummer since I just enforced threads in the support chans of our Discord to get a better overview of support cases. And I am not sure it actually gives that - but luckily thereā€™s other advantages.

Do you have an ETA on the API and an idea of what it would cost to back the feature?

Thanks!

/k

2 Likes

I did chase recently and itā€™s been in development for some time. Iā€™ll chase again and revert, but be warned, the last time they told me ā€œitā€™ll be done when itā€™s doneā€ ā€¦ the problem with open source is often a lack of a good way of directing appropriate levels of community funding (or lack thereof) to assist with focus and prioritisation ā€¦ weā€™ll see ā€¦

From my end Iā€™d have to see the final implementation to estimate the effort.

The challenge might be that whilst itā€™s straightforward to copy across messages, keeping Threads in sync with Topics may require some kind of mapping maintained in Discourse, e.g. a custom field or table that maps Discord Threads to Discourse Topics, so when a new message gets added to a Thread you know where to put it in Discourse.

Can you elaborate on exactly the functionality/behaviour you are seeking?

2 Likes

Yeah that sucks to be depending on something you canā€™t influence.

My idea is very inspired on the article and the discoussion on the Discourse blog on how well Discord and Discourse supplement each other. When we started our Discord server almost two months ago we didnā€™t really know how it would evolve and how it would affect our existing (but barely configured) Discourse forum but it looks like people still use it as well as our Discord for asking technical support questions (I am with the FOSS project CrowdSec). So basically I completely buy in on the idea to use Discourse as a more long term memory and sync Discord threads to Discourse under topics matching Discord channels (and vice versa). The way I see it, it can be done much more effectively (e.g. automated) by using threads.

As I said I recently enforced threads on Discord which means that itā€™s not always very easy to get an overview of threads for those of our developers that are assigned to user support. So I want to use the sync to Discourse also as a good way for them to keep updated on questions to answer whilst not being sucked too much into the Discord chitter-chatter.

Does that makes sense? And is there some other way to achieve this on a shorter time frame maybe?

2 Likes

Hi @merefield !

Iā€™m reaching out to you here because I donā€™t think my github Issue was seen, and Iā€™m thinking this is the next best place.

image

Weā€™ve been getting an error that weā€™ve tracked down to the discord bot plugin. The above image shows the inspect element error, but any user who sends a PM also gets a ā€œ500 Errorā€ visual when their PM is sent. The PM is still sent successfully, but this error makes it seem otherwise. After disabling the plugin, the issue no longer exists.

Iā€™m pretty sure the issue is coming from /lib/discourse_event_handlers.rb. Iā€™m assuming that a PM is triggering the post_created DiscourseEvent which makes it try to access the postā€™s category via posted_category = post.topic.category.id, which causes the error.

I hope this helps and I hope this can be resolved soon. Thanks

3 Likes

Thanks for the report. Sounds about right. Might get chance to look at it this week ā€¦

3 Likes

Fantastic, thank you! Weā€™ll keep an eye out for the update. :+1:

3 Likes

Heads up that Iā€™m drowning in client work atm so this may not get looked at for a little while.

In the meantime PR accepted.

In general I would welcome more community contribution to the free plugins.

2 Likes

Things are preeeetty busy for me atm, but Iā€™ve pushed what I believe is a fix:

FIX: exclude private messages from bot event considerations Ā· merefield/discourse-discord-bot@82b2109 (github.com)

Seems to work now and the dreaded 500 on PMā€™s is gone ā€¦

2 Likes

Oh, thatā€™s wonderful and replaces Discord Chat!

ĀæIt has supposed to read slug names on Discourse or just titles?

1 Like

Discord does not manage by slugs in the same way, so iirc it is titles.

2 Likes

Hello, I donā€™t know if this was questioned before but, the OAuth credentials must be the same as the app? Cause right now we are using another discord sync integration and the OAuth fields are already filled. Thanks.

1 Like

This plugin is compatible with the official social login solution in core. The bot needs a token from an authorised Discord app. The social login allows the plugin to identify the same user across the two platforms.

2 Likes

thanks for the answer! Iā€™ll debug a little bit more to see what Iā€™m missing on the setup.

2 Likes

I donā€™t think it needs to be the same discord app but try it!

2 Likes

Hello here!
Searching the forum for a way to give the Discourse users a different Trust Level based on a Discord account brought me here.

We already have a pretty active community on Discord and brought in Discourse lately for more organized discussions.

I am looking for a solution that goes like this. A member that logins with their Discord account and has a specific role on Discord automatically receives a Trust Level 1 on Discourse.

Would this Bot Kit be the right starting point for such an implementation?

Thank you

1 Like

This bot afaik is ā€œone-wayā€ from Discourse to Discord. There arenā€™t any functions that are the opposite that are built.

Personally I think youā€™d find it a bit easier to accomplish this with outside code that is watching the user events webhook of your discourse install.

Webhook event out ā†’ Grab discord user ID from Discourse database (requires using Discord authentication) ā†’ Grab roles using discord.js, .py, etc. ā†’ Assign role with Discourse API request

In order to get the Discord ID you need to use the Data Explorer plugin and create the following query:

-- [params]
-- string :user
SELECT u.username, u.id, a.user_id, a.provider_name, a.provider_uid
FROM users u
JOIN user_associated_accounts a on a.user_id = u.id
WHERE u.username = :user

You can then look up the Data Explorer plugin documentation and hit that query with an API request to get the ID.

Hope this helps somewhat.

1 Like

Whilst this is true for role sync, this is otherwise not correct.

From the OP:

So plenty of Discord ā†’ Discourse behaviour and far from just a ā€˜role syncā€™ bot.

As ever PR welcome for any generally useful additional functionality. It would be good to have some additions from the community. :eyes:

3 Likes

Thank you for this post @merefield

Could I get your discord? I would like to ask you some questions if thatā€™s okay.

To keep knowledge open and indexed for everyone itā€™s probably best to ask the questions here. Discord is a black hole for information. Stuff goes in and is then never found again :slight_smile: And otherwise, we also have chat here on Discourse.

1 Like

Hi Kene, if itā€™s not of a commercial nature, would appreciate if you could ask your questions here so that the community might benefit from (or even answer) them

3 Likes