Discord Bot Construction Kit 🤖

Sorry, old school forum speak, Threads being Discourse Topics not the Discord Threads.

I’m happy to pay for custom functionality but i think i have found a workaround by just moving the topic after it’s created :thinking: i feel like that was too simple

Discord threads were around 2 years ago? jeez, i’m getting old :laughing: losing track of time

But yeah, i wonder if it would be easy to add Image and Mention support :thinking: ?

give me a quote :wink:

image

image
image

1 Like

Yes, please continue this convo here on Discourse!

I, too, am implementing this plugin for synchronizing with a Discord server!

Does this mean that roles on Discord are copied into Discourse? Or vice versa? Ultimately, it would be better to allow both options anyway

1 Like

Looking forward to your PR

1 Like

Like mine? PR? What PR?

@merefield Hi! Great work on this. Like many I’m sure, I found this post by trying to search for plugins or bots that can bridge Discourse and Discord in one way or another.

At this point I was just about to give up and hire a developer to handle it for me, but I’m a believer in open source and grateful I stumbled upon this topic first.

On one of the discord communities I help moderate, there are multiple libraries from different authors whose communities overlap and thus they use that Discord and the relevant channel for tech support on that library.

The ideal solution for SEO, knowledge base building, and convenience would be to have everyone use a Discourse forum, but all things equal people simply prefer posting their questions on Discord and the responding party is left to find some manual solution to replicating that conversation into Discourse.

In an effort to combat this inefficiency without forcing a poor UX on the user (e.g. “Welcome to Discord, now go use the Discourse and repeat the same question again”), I’d like to have it so that each library channel main comment has the potential to automatically generate a new topic in the Discourse forum. This would get spammy fast, so I would want it so that it is only triggered if:

  1. it turns into a thread (implying it was a question that was actually responded to)

  2. it was responded with a chosen emoji to by an authorized role (tech support, moderator, admin, etc)

From there, any followup comments in that Discord thread would automatically be followed and posted as responses on the same parent Discourse topic as well. (Note: It’s not important that any user accounts exist – sending as “system” or a designated bot would be acceptable, so long as it mentions the username it originated from in the body of the posts)

Based on these requirements, I have a few questions:

  1. is the bot in question in this topic ready for this?

  2. If not, what parts are not ready yet or not yet planned? (I see threads is something “in the works”, but if it’s a matter of financial priorities I can post a healthy bounty to make it a reality)

  3. If it comes to needing to post said bounty for development, what is the appropriate method for commission? What are the requirements and expectations (costs, timelines, etc)?

Appreciate the work you (and everyone!) has done so far and looking forward to your timely response.

~carrot

Hey @carrotcypher,

This free plugin is maintained by myself (as part of Pavilion) on a best efforts basis.

There is no roadmap and work on features only happens when there is an outside sponsor.

Your use case is an interesting one.

This 'bot" relies on this Ruby gem which is a critical dependency.

This doesn’t yet support Threading on an official release, however it looks as if some support has been added to the main branch but I’m not sure to what extent, that would be a bit of work in itself to find out and maybe discuss with them if they plan a release at some point. Their documentation is only brought up to date at each release. It is not enough to have support on main branch, they need to update the gem, ideally.

If you are serious about this project I would recommend you discuss the project with Pavilion’s project management team in first instance, though you are free to post in marketplace of course.

Go here and hit contact and follow the instructions: Pavilion

1 Like

@merefield Hi, I installed the plugin but I can’t get the bot to respond to commands on my server.
It correctly displays the “The Discourse admin bot has started his shift!” message, but after that it doesn’t react to anything.

Oddly enough, it works when I send it a direct message on Discord. I have checked the permissions on the server and they seem to be configured correctly (I gave the bot admin permissions).

Weird, I’ve checked it on the very latest Discourse and it is behaving.

What happens when you type Ping! on Discord (capitals important)?

Check your logs, see any error messages?

it doesn’t react to Ping! (but it works in direct messages)

logs

Well it’s struggling with the token in your setting somehow.

Did you put any funny chars in it or not enter it at all?

image

I gave up on it. I don’t think it was the right tool for my use case anyway.
I don’t know why it didn’t work. I did everything carefully, multiple times.
Maybe Discord is acting funny?
Anyway, thanks for trying to help me.

1 Like

What were you trying to do functionally?

Yep, good solution, and the required command is this:

::DiscordBot::Bot.discord_bot.stop

That will stop the additional bot in the rails console session and leave the current main server one running.

@matenauta you might like this solution.

I’ve added this info to the OP.

2 Likes

Sorry, just looking back through Posts here and noticed that I gave you incorrect advice and have since implemented hooks which respond to Discourse events that can act in Discord. Some of these may already be useful for you and this technique can be extended to other events:

1 Like

With thanks to my sponsor & for additional help from @RGJ, I bring you some important updates:

  • FEATURE; Adds ability to easily copy discrete Discord Threads to Discourse, by extending and improving the existing !disccopy command
  • IMPROVE: Brings the plugin up to date with the latest discordrb code (3.5.0)
  • FEATURE: Adds multisite support (thanks @RGJ !!)
  • FEATURE: Restarts the bot thread if the token is changed, or if it becomes enabled (so you don’t need to restart the host server) (thanks again @RGJ !!)

@klausagnoletti, @Fma965 with this API update we finally we now have the ability to interact with Discord Threads via the API which are essentially just additional “channels”.

2 Likes

Ah, finally!

A working check to prevent the bot spawning at inappropriate points in process*!

You will not spawn a new bot any longer when:

  • migrating database changes
  • opening the rails console (so there is now no need to stop it).

As a result rebuild bot chatter is reduced by at least 50%, so it should only announce itself twice now :sweat_smile:

Let me know if you have any issues with this latest change.

Credit to @RGJ for the suggestion! :pray:

*mostly! :slight_smile:

1 Like

Just to say I recently:

  • FIX:ed auto-syncing of messages Discord → Discourse which apparently had been broken since last update!!
  • FEATURE: Added a level of support for auto-syncing of Discord Embeds.

Enjoy!

Hi, good job on the script! thanks for making this. I had a few questions… how often does the bot sync the members in the roles? I just setup discourse and this was one of the first plugins I installed. I created a group on www, added myself and if I manually type !discsync it’ll add the discord tag on my name just fine, now if I remove myself from the group on www, or add someone else… nothing happens unless I manually type !discsync on discord. Is that as intended or should it be syncing every few minutes every 10 mins?

It’s manual.

You could look at this fork: Discord Sync: sync a Discourse forum with a Discord server but it is unmaintained and broken I believe (I did request that person PR’d too, but hey!).

Feel free to PR a more automated solution or you can hire me to work on it, or marketplace

It’s a “construction kit” after all :slight_smile: