Discord Bot Construction Kit

Can we use it without spawning when using the console on Discourse?

I see the bot telling me errors when I try to do a remap :smiling_face_with_tear:

Im not entirely sure what you mean by that. The only interaction is supposed to happen on Discord.

However what errors are you getting? Ill take a look at some point

1 Like

I have this issue as well, entering the discourse container and starting the rails c prompt causes another instance of the bot to spawn. Results in commands like Ping! returning Pong! twice and other things like not being able to change the username or nickname through discordrb.

Running the ::DiscordBot::Bot.discord_bot.stop command causes the instance spawned by rails c to exit but it cant interact with the bot spawned when Discourse starts.

1 Like

Thanks for the report. Ill record this as a known issue (edit: done - added to OP Known Issues section). I suspect it has behaved like this since inception though and given this has only been reported a couple of times and only very recently, so I suspect its not generally considered a big issue as it is an edge case.

Given you appear to be technically able, PR welcome though, if you can solve it.

1 Like

It might be a core issue with Discordrb to be honest, I see no way to list other running bots or even select them in their documentation, if I find out I will let you know. As for this bot, Ive forked the project and modified it to the best of my ability to work as a chat bridge instead of post bridge.

image
image

1 Like

Yeah, what we need to do is be able to test if an instance is running and not run a new one if one exists.

Thats a danger zone for race conditions, but would be a really nice improvement.

If I had more time Id take a look sooner, but if you want to have a go feel free.

It appears that when the rails console starts it binds the @@DiscordBot variable to another bot in another thread while the original is left alone. Im not sure if its possible to detect that the rails console is starting and not start a second bot, but this explains why I can run the stop command on the bot through rails and not affect the one that started with Discourse.

1 Like

Hey,

Nice work, i want to use this but first i have a question which is somewhat related to this, kinda

I use Discourse WP-Connect to use Wordpress as my master for SSO (this also can use Discord login) do you know what user variables i would need to pass in the SSO request for this plugin to match it with a discord user? or is it just email (im assuming not)

I already send some extra values so im hoping i could just send an additional one?

As per OP it requires Auth via Discord (using the inbuilt core logic) to establish the relationship.

A hard coded SSO from Wordpress will prevent that especially for new users.

PR or additional documentation welcome if you find a way around that.

Nice bit of work, well done. Thats a useful insight.

Right, not really what i asked though, maybe best to ask in support since Discord login is built in to Discourse now though.

1 Like

Yeah, its beyond the scope of this plugin to support Wordpress SSO.

But to point you in the right direction, you need an entry in this table:

This is done automatically when you log in via Discord.

I doubt Wordpress SSO could populate that on behalf of Discord, but am prepared to be proven wrong.

1 Like

I also have an OAuth source that I need users to use instead of Discord. To get around this I have the Discord OAuth on per the OP but Ive used custom CSS to hide all other login sources except the one I want my users to use with the display: none; CSS option. The ability to OAuth with Discord is technically still in the HTML but a normal end user is never going to find it.

Users can then connect their Discord to the account my other OAuth source creates under their user preferences.


image

Nice, that could be a workaround, i might investigate a actual code solution though, does this show under the Discourse preferences then? maybe we could DM to not bloat this topic?

Why do you match Discord Channels with Discourse Categories instead of Topics? is it because there can be duplicate named topics? id like to have 5 channels go to the relevant topics in 3 categories, but seems this isnt possible?

Because announcements of a single Topic would get pretty boring?

Its deliberately high level so you can announce new Topics in specific Categories.

2 Likes

Sorry i mean for this

2 Likes

That was a client request :moneybag:

All chat iirc goes into one Topic per Category to avoid a mess across too many Topics.

2 Likes

I see

Of course, however as its using categories i cant have for example a #ford-support thread in my Ford Category that is synced from the #ford-support channel in discord, Ruby is not my language of choice so i doubt i could fork it and tweak it (like i do for many other things not in Ruby)

Would it be easy to make it do it based on topic/thread name instead? or is there some limitation perhaps?

Side note images (interestingly GIFs do) dont sync to the topic, not sure if this is known?

EDIT: oh wait i can just move the topic after its created it seems

Threads were not available in the Ruby Discord API last time I checked but Im told it was in the works (two years ago!)

Id definitely welcome a PR to add support for Threads when that becomes possible.

Im afraid Im spread too thin these days to focus on much feature building on plugins outside of paid work but happy to review a PR.

1 Like