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๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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

2๊ฐœ์˜ ์ข‹์•„์š”

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

2๊ฐœ์˜ ์ข‹์•„์š”

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

2๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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

ยฟIt has supposed to read slug names on Discourse or just titles?

1๊ฐœ์˜ ์ข‹์•„์š”

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

2๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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

2๊ฐœ์˜ ์ข‹์•„์š”

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

2๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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:

4๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”

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๊ฐœ์˜ ์ข‹์•„์š”