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

Support (Discord) reply context in IRC #2132

Open
PointMeAtTheDawn opened this issue Apr 18, 2024 · 0 comments
Open

Support (Discord) reply context in IRC #2132

PointMeAtTheDawn opened this issue Apr 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@PointMeAtTheDawn
Copy link

PointMeAtTheDawn commented Apr 18, 2024

Is your feature request related to a problem? Please describe.
Discord replies have no context in IRC (even that they ARE a reply), leading to confusion.

Describe the solution you'd like
Discord replies -> IRC should include some level of context: that it's a reply at all, reply to a particular user, reply to a message at a particular timestamp, or the beginning of the parent message.

Additional context
Quick and dirty pseudocode if there's interest in merging a tested PR:
In https://github.com/42wim/matterbridge/blob/master/bridge/discord/handlers.go#L85
In

    // Add our parent id if it exists, and if it's not referring to a message in another channel
    if ref := m.MessageReference; ref != nil && ref.ChannelID == m.ChannelID {
        rmsg.ParentID = ref.MessageID
    }

(MessageReference is just an id, ReferencedMessage has the actual content)

I would do something along the lines of this (but better typed :p)

DESIRED_SNIPPET_LENGTH := 25
DISCORD_PARENT_CONTENT := "discord_parent_content"
    // Add our parent id if it exists, and if it's not referring to a message in another channel.
        // Also, include a snippet of the parent to let bridges include it when the id is unusable.
    if ref := m.MessageReference; ref != nil && ref.ChannelID == m.ChannelID {
        rmsg.ParentID = ref.MessageID
                // Proper null safety here for best practice

                rmsg.Extra[DISCORD_PARENT_CONTENT] = ref.ReferencedMessage.content[:DESIRED_SNIPPET_LENGTH-1]
    }

Then in IRC https://github.com/42wim/matterbridge/blob/master/bridge/irc/irc.go#L140

if msg.Extra[DISCORD_PARENT_CONTENT] != "" (or w.e) {
    msg.Text = msg.Extra[DISCORD_PARENT_CONTENT].prettyFormatOrWhatever() + msg.Text
}
@PointMeAtTheDawn PointMeAtTheDawn added the enhancement New feature or request label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant