diff --git a/config/bridge.go b/config/bridge.go index 2c1f60c..fb5cf33 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -45,6 +45,7 @@ type BridgeConfig struct { MuteChannelsOnCreate bool `yaml:"mute_channels_on_create"` SyncDirectChatList bool `yaml:"sync_direct_chat_list"` ResendBridgeInfo bool `yaml:"resend_bridge_info"` + CustomEmojiReactions bool `yaml:"custom_emoji_reactions"` DeletePortalOnChannelDelete bool `yaml:"delete_portal_on_channel_delete"` DeleteGuildOnLeave bool `yaml:"delete_guild_on_leave"` FederateRooms bool `yaml:"federate_rooms"` diff --git a/config/upgrade.go b/config/upgrade.go index 8b4c3d4..99b892e 100644 --- a/config/upgrade.go +++ b/config/upgrade.go @@ -40,6 +40,7 @@ func DoUpgrade(helper *up.Helper) { helper.Copy(up.Bool, "bridge", "mute_channels_on_create") helper.Copy(up.Bool, "bridge", "sync_direct_chat_list") helper.Copy(up.Bool, "bridge", "resend_bridge_info") + helper.Copy(up.Bool, "bridge", "custom_emoji_reactions") helper.Copy(up.Bool, "bridge", "delete_portal_on_channel_delete") helper.Copy(up.Bool, "bridge", "delete_guild_on_leave") helper.Copy(up.Bool, "bridge", "federate_rooms") diff --git a/example-config.yaml b/example-config.yaml index 8fe8f0f..52fb084 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -125,6 +125,9 @@ bridge: # Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run. # This field will automatically be changed back to false after it, except if the config file is not writable. resend_bridge_info: false + # Should incoming custom emoji reactions be bridged as mxc:// URIs? + # If set to false, custom emoji reactions will be bridged as the shortcode instead, and the image won't be available. + custom_emoji_reactions: true # Should the bridge attempt to completely delete portal rooms when a channel is deleted on Discord? # If true, the bridge will try to kick Matrix users from the room. Otherwise, the bridge only makes ghosts leave. delete_portal_on_channel_delete: false diff --git a/portal.go b/portal.go index 2c8c540..7c3c258 100644 --- a/portal.go +++ b/portal.go @@ -1522,6 +1522,10 @@ func (portal *Portal) handleDiscordReaction(user *User, reaction *discordgo.Mess extraContent["fi.mau.discord.reaction"] = map[string]any{ "id": reaction.Emoji.ID, "name": reaction.Emoji.Name, + "mxc": matrixReaction, + } + if !portal.bridge.Config.Bridge.CustomEmojiReactions { + content.RelatesTo.Key = fmt.Sprintf(":%s:", reaction.Emoji.Name) } }