Add option to disable custom emoji reactions

This commit is contained in:
Tulir Asokan
2023-01-27 21:23:10 +02:00
parent 039764e081
commit 09a94010d8
4 changed files with 9 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ type BridgeConfig struct {
MuteChannelsOnCreate bool `yaml:"mute_channels_on_create"` MuteChannelsOnCreate bool `yaml:"mute_channels_on_create"`
SyncDirectChatList bool `yaml:"sync_direct_chat_list"` SyncDirectChatList bool `yaml:"sync_direct_chat_list"`
ResendBridgeInfo bool `yaml:"resend_bridge_info"` ResendBridgeInfo bool `yaml:"resend_bridge_info"`
CustomEmojiReactions bool `yaml:"custom_emoji_reactions"`
DeletePortalOnChannelDelete bool `yaml:"delete_portal_on_channel_delete"` DeletePortalOnChannelDelete bool `yaml:"delete_portal_on_channel_delete"`
DeleteGuildOnLeave bool `yaml:"delete_guild_on_leave"` DeleteGuildOnLeave bool `yaml:"delete_guild_on_leave"`
FederateRooms bool `yaml:"federate_rooms"` FederateRooms bool `yaml:"federate_rooms"`

View File

@@ -40,6 +40,7 @@ func DoUpgrade(helper *up.Helper) {
helper.Copy(up.Bool, "bridge", "mute_channels_on_create") helper.Copy(up.Bool, "bridge", "mute_channels_on_create")
helper.Copy(up.Bool, "bridge", "sync_direct_chat_list") helper.Copy(up.Bool, "bridge", "sync_direct_chat_list")
helper.Copy(up.Bool, "bridge", "resend_bridge_info") 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_portal_on_channel_delete")
helper.Copy(up.Bool, "bridge", "delete_guild_on_leave") helper.Copy(up.Bool, "bridge", "delete_guild_on_leave")
helper.Copy(up.Bool, "bridge", "federate_rooms") helper.Copy(up.Bool, "bridge", "federate_rooms")

View File

@@ -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. # 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. # This field will automatically be changed back to false after it, except if the config file is not writable.
resend_bridge_info: false 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? # 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. # 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 delete_portal_on_channel_delete: false

View File

@@ -1522,6 +1522,10 @@ func (portal *Portal) handleDiscordReaction(user *User, reaction *discordgo.Mess
extraContent["fi.mau.discord.reaction"] = map[string]any{ extraContent["fi.mau.discord.reaction"] = map[string]any{
"id": reaction.Emoji.ID, "id": reaction.Emoji.ID,
"name": reaction.Emoji.Name, "name": reaction.Emoji.Name,
"mxc": matrixReaction,
}
if !portal.bridge.Config.Bridge.CustomEmojiReactions {
content.RelatesTo.Key = fmt.Sprintf(":%s:", reaction.Emoji.Name)
} }
} }