Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server-commands): send chat message #105

Merged

Conversation

Arthurk12
Copy link
Collaborator

@Arthurk12 Arthurk12 commented Jul 25, 2024

What does this PR do?

This PR adds the sendPublicChatMessage and sendCustomPublicChatMessage server commands which allows plugins to send a message in the public chat. When a plugin calls any of this methods, its name is registered to the message metadata so that it is possible to later identify which plugin sent the given message. Additionally plugins may send a custom metadata to be saved in the messages metadata.

  • sendPublicChatMessage: sends a message in the public chat which is displayed as sent by the client user
  • sendCustomPublicChatMessage: sends a custom message in the public chat which is not rendered by the BBB client. This message is meant to be custom-rendered by plugins.

Lastly, this PR adds a sample application for this feature:
plugin

More

Depends on:

Adds the `sendPublicChatMessage` server command which allows plugins to
send a message in the public chat. When a plugin calls this method, its
name is registered to the message metadata so that it is possible to
later identify which plugin sent the given message. Additionaly plugins
may send a custom metadata to be saved in the messages metadata.
Adds metadata to the loaded chat message type, allowing plugins to
identify the message owner and custom metadata sent via the
`sendPublicChatMessage` server command. This is essential for
plugins to custom-render their own messages based on the metadata.
Implements the `sendCustomPublicChatMessage` command that sends a custom
chat message in the public chat which is not rendered by the BBB client
itself. This type of message is meant to be custom-rendered by plugins.
This commit adds the `sendCustomPublicChatMessage` server command to the
chat server command sample.
Adds a logic to track which messages were already styled. Also adds
missing semicolon and comma.
Copy link
Collaborator

@GuiLeme GuiLeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks very good, just that typo.

By the way, one comment that is worth mentioning, after this PR is merged of course, we should add a server-command to send message to private chats. And also, perhaps in the same next PR, add a data-consumption hook to look out for private chat creations. Tell me what you think of this idea!

src/server-commands/chat/commands.ts Outdated Show resolved Hide resolved
Co-authored-by: Guilherme Pereira Leme <[email protected]>
@Arthurk12
Copy link
Collaborator Author

By the way, one comment that is worth mentioning, after this PR is merged of course, we should add a server-command to send message to private chats. And also, perhaps in the same next PR, add a data-consumption hook to look out for private chat creations. Tell me what you think of this idea!

I think it's a good idea! Adding the server command for sending private chat messages should be trivial once this PR is merged, because the chat server commands are all translated to a generic SEND_MESSAGE event, which allows passing any valid chat ID.

@Arthurk12 Arthurk12 requested a review from GuiLeme August 1, 2024 13:40
Copy link
Collaborator

@GuiLeme GuiLeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TiagoJacobs TiagoJacobs merged commit 4c1b9ba into bigbluebutton:main Aug 1, 2024
3 checks passed
@TiagoJacobs
Copy link
Member

published in version 0.0.56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants