Kit de construcción para Discord Bot 🤖

Whoops, I deleted the wrong link from the OP. (There were two plugins, I should have deleted the OAuth one, but instead I deleted the link to the bot!)

Uninstall that plugin asap, as Core now supports Discord OAuth out of the box.

The bot plugin is THIS one:

I’ve altered the OP accordingly, sorry about that!!

3 Me gusta

Do we know what the status might be of us getting this plugin to automatically update users at the time of their group joining instead of manually syncing? And potentially a way to tell it what groups/roles to sync together instead of it taking over / creating the roles itself?

2 Me gusta

First time that’s been requested so as you might imagine, it’s not even in backlog as it were.

That would be quite tricky as the bot runs on a discrete thread. You’d have to add a method to message the bot and ensure it’s listening for the request. An interesting exercise technically but not trivial.

Alternatively it might be better to explore a direct API call alternative instead of using the bot. Then you have to decide whether that warrants delivery in a different plugin based on discrete calls, not a bot.

That’s a not a bad idea but why do you need them to be different out of interest?

This is more practical.

PR accepted. Unfortunately my time is very limited to work on significant features without funding.

3 Me gusta

Well as it is now, it appears to base the roles off of the “name” instead of the title. Which means my roles on discord end up having dashing and no spaces for example. So I suppose an alternative solution is to have it base the roles not on the name but instead the full name, or default title.

That said, there are potentially groups on discourse that I would not want it to sync at all to discord.

Appreciate the responses :slight_smile:

2 Me gusta

This is on purpose to avoid keying off a description field which can:

a) have spaces in it
b) not be unique

(and is usually a terrible idea in computer science)

However, if there is a safe way of improving this I’m all ears. I appreciate it doesn’t ‘look’ very nice :slight_smile:

The plugin could definitely have additional functionality added to turn sync off for specific groups, at the admin’s discretion. PR accepted.

4 Me gusta

Could we have the bot auto sync at a scheduled time in the meantime while an API method is explored? Something like, check once every hour, or 24, etc ?

1 me gusta

I believe it would be possible to add ‘repeat this again after x hours’ like functionality no problem.

The problem with that though is that will stop every time the bot goes down (e.g. on a reboot).

The absolute best approach would be to either:

a) add a discrete API call connected to a sidekiq job to this plugin OR
b) write a new plugin that used normal API calls instead of utilising a bot (and incorporate a batch sync in that).

Either of those things are going to need sponsorship or a PR.

1 me gusta

Fair enough. Thanks for the help.

2 Me gusta

Hola.

Estoy usando tu plugin actualmente y tengo todo en un punto funcional. Parece realmente bueno, ¡buen trabajo!

Sin embargo, tengo algunas preguntas: ahora que tengo todo funcionando, necesito que mis usuarios inicien sesión a través de Discord OAuth. Esto crea una nueva cuenta.

¿Cuál es la mejor manera de gestionar esto? ¿Necesito fusionar las cuentas nueva y antigua? Intenté hacerlo con mi cuenta de administrador y obtuve el error “No tienes permiso para ejecutar el comando discsync!” al intentar ejecutar manualmente !discsync.

Además, aún no ha copiado ningún rol desde mi Discourse.

Para tu información, mi cuenta de Discord aparece en mis opciones como una cuenta asociada.

¡Gracias de antemano por tu ayuda!

2 Me gusta

¡Gracias por tu interés en el plugin!

Esto no es una característica del plugin, es una función central. OAuth de Discord viene incluido con Discourse de forma predeterminada:

La configuración anterior aparece independientemente de si agregas este plugin a tu Discourse.

Si inicias sesión con la cuenta de redes sociales, siempre que los correos electrónicos de registro coincidan, la cuenta debería ser reconocida y no se creará una nueva cuenta. Sin embargo, si el usuario se registró en Discord con un correo electrónico diferente al de Discourse, por supuesto, no hay forma de que el sistema sepa que es el mismo usuario, por lo que se creará una nueva cuenta.

¿Tu cuenta de administrador en el servidor de Discord? ¿También autorizaste al bot?

¿Cuál es el resultado de Ping!?

4 Me gusta

Coincido con eso. En el peor de los casos, puedo simplemente fusionar cuentas con correos electrónicos que no coinciden.

Sí, es correcto. Soy el propietario de las instancias de Discord y Discourse. El resultado de “Ping!” es “Pong!”. Ningún rol ha sido migrado de Discourse a Discord.

El bot está en mi servidor de Discord y tiene privilegios de administrador. ¿Puedo aclarar qué quieres decir con «autorizar»?

3 Me gusta

¿Has completado este paso? (solo verifico todos los requisitos previos; casi con seguridad ya lo has hecho).

2 Me gusta

Sí, tengo :slight_smile:

1 me gusta

Mi corazonada es que tus derechos o los del bot en el servidor de Discord no están configurados correctamente de alguna manera. Solo estoy repasando este plugin mientras trabajo en docenas de ellos. ¡Mi último cambio en este fue hace un tiempo!

1 me gusta

¡Roger! He hecho una verificación rápida de mi parte, así que para tu información, figuro como propietario del servidor y tengo derechos de administrador.

EDITA: ¿Podemos aclarar qué derechos requiere el bot? Actualmente figura como administrador (esto le fue otorgado a través de un rol y no mediante la invitación OAuth, sin embargo).

1 me gusta

Mi bot tiene esto:

1 me gusta

Aquí están los míos (lo siento, como soy un nuevo usuario aquí

necesito hacer 3 publicaciones…)

1 me gusta

¿Podrías verificar los permisos del canal? Los permisos del canal en Discord anulan los permisos del servidor.

1 me gusta

Sí, está bien en el canal. No hay permisos desactivados allí que impidan enviar o recibir mensajes.

Puede enviar ¡Pong!, y me indica que no tengo los permisos necesarios para ejecutar !discsync.

1 me gusta

OK, estoy intentando replicarlo, pero hasta ahora puedo ejecutar ambos comandos.

1 me gusta