Tutorial — Cómo funciona EFB

EH Forwarder Bot es un marco de desarrollo extensible que permite al usuario controlar y administrar las cuentas de diferentes plataformas de chat en una interfaz unificada. Consta de 4 partes: Un canal maestro, algunos canales esclavos, algunos middlewares y un coordinador.

EFB Project Structure
master channel

The channel that directly interact with the User. It is guaranteed to have one and only one master channel in an EFB session.

slave channel

The channel that delivers messages to and from their relative platform. There is at lease one slave channel in an EFB session.

coordinator

Componente del framework que mantiene las instancias de canales y la entrega de mensajes entre los canales.

middleware

Módulo que procesa los mensajes y estados entregados entre canales, y realiza modificaciones cuando es necesario.

Conceptos a saber

module

A common term that refers to both channels and middlewares.

the User
the User Themself

This term 1 can refer to the user of the current instance of EH Forwarder Bot, operating the master channel, and the account of an IM platform logged in by a slave channel.

chat

A place where conversations happen, it can be either a private chat, a group chat, or a system chat.

private chat

A conversation with a single person on the IM platform. Messages from a private conversation shall only has an author of the User Themself, the other person, or a “system member”.

For platforms that support bot or something similar, they would also be considered as a “user”, unless messages in such chat can be sent from any user other than the bot.

For chats that the User receive messages, but cannot send message to, it should also be considered as a private chat, only to raise an exception when messages was trying to send to the chat.

group chat

A chat that involves more than two members. A group chat MUST provide a list of members that is involved in the conversation.

system chat

A chat that is a part of the system. Usually used for chats that are either a part of the IM platform, the slave channel, or a middleware. Slave channels can use this chat type to send system message and notifications to the master channel.

chat member

A participant of a chat. It can be the User Themself, another person or bot in the chat, or a virtual one created by the IM platform, the slave channel, or a middleware.

message

Los mensajes son entregados estrictamente entre el canal maestro y el canal esclavo. Usualmente lleva información de cierto tipo.

Cada mensaje debe tener al menos una ID única que sea distinta dentro del canal esclavo relacionado con ella. Cualquier mensaje editado debe identificarse con la misma ID única.

status

Información que no está formateada en un mensaje. Usualmente incluye actualizaciones de chats y miembros de chats, y eliminación de mensajes.

Canales Esclavos

El trabajo de los canales esclavos es relativamente simple.

  1. Entrega mensajes para y desde el canal principal.

  2. Mantiene una lista de todos los chats disponibles, y los miembros del grupo.

  3. Monitorea los cambios de los chat y notifica al canal principal.

Las características que no encajen dentro del modelo estándar del canal esclavo EFB pueden ser ofrecidas como Características adicionales.

Canales Maestros

Master channels is relatively more complicated and also more flexible. As it directly faces the User, its user interface should be user-friendly, or at least friendly to the targeted users.

El trabajo del canal maestro incluye:

  1. Recibe, procesa y muestra mensajes de los canales esclavos.

  2. Muestra una lista completa de todos los chats de los canales esclavos.

  3. Offer an interface for the User to use «extra functions» from slave channels.

  4. Procesar las actualizaciones de canales esclavos.

  5. Proporcionar una interfaz fácil de usar en la medida de lo posible.

Middlewares

Los middleewares pueden monitorear y hacer cambios para anular mensajes y estados entregados entre canales. Los middlewares son ejecutados por orden de registro, uno tras otro. Un middleware siempre va a recibir los mensajes procesados por el middleware anterior si está disponible. Una vez que un middleware anule un mensaje o un estado, el mensaje no será procesado ni entregado.

Footnotes

1

“Themself” here is used as a derived form of a gender-neutral singular third-person pronoun.