Skip to content

Fix incorrect chat grouping of Discord messages #6547

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Exairnous
Copy link
Contributor

@Exairnous Exairnous commented May 4, 2025

What?

Prevents Discord messages from different users that are sent within a minute of each other from being grouped together under the first user that sends a message by also checking the name given for the sender instead of just the sender's id. This mostly ensures that all chat messages are attributed to the correct user.

Why?

Users in Hubs can have the same name so the chat messages are grouped by a sender id, but because all the messages from Discord come through the Discord bot, the sender id is the same for all of them regardless of who sent them in Discord.

Examples

Not easy to get and the change is very small, easily seen, and is described in other parts of this pull request.

How to test

  1. Redeploy your instance using a Hubs Client image generated from this PR (e.g. ghcr.io/exairnous/hubs:fix-discord-bot-mixing-chat-messages-34).
  2. Follow the instructions for hacking on the bot locally that are listed in PR Update/Improve Readme hubs-discord-bot#146 and set up the Hubs bot against your Community Edition instance.
  3. Create a room with the Hubs bot with !hubs create.
  4. Join the Hubs room that has been bridged to Discord.
  5. In your Discord server, in the channel you've set the bot up in, send a Discord message and have someone else send a Discord message immediately after.
  6. See that they are listed as from the correct people in the chat panel (previously they would both be listed under the name of the person who first sent the message).

Documentation of functionality

This is an implementation detail and doesn't need to be documented. It is also immediately obvious.

Limitations

This will still group messages improperly if the Discord users have the same display name in the Discord server but preventing that would likely require much more extensive and broad reaching changes (probably in reticulum and the Hubs Discord bot repository as well) and it would do little to reduce confusion.

Alternatives considered

None.

Open questions

None.

Additional details or related context

None.

What: Prevents Discord messages from different users that are sent within a minute of each other from being grouped together under the first user that sends a message by also checking the name given for the sender instead of just the sender's id.  This mostly ensures that all chat messages are attributed to the correct user.

Why: Users in Hubs can have the same name so the chat messages are grouped by a sender id, but because all the messages from Discord come through the Discord bot, the sender id is the same for all of them regardless of who sent them in Discord.

Note: this will still group messages improperly if the Discord users have the same display name in the Discord server but preventing that would likely require much more extensive and broad reaching changes (probably in reticulum and the Hubs Discord bot repository as well) and it would do little to reduce confusion.
@Exairnous Exairnous requested a review from DougReeder May 4, 2025 13:38
@Exairnous
Copy link
Contributor Author

@hrithikwins I'd also appreciate your review on this.

Copy link
Contributor

@DougReeder DougReeder left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@DougReeder DougReeder left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants