Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 82aea9c338d8861db85fdc8defac40c2383517b5 Author: Wim <wim@42.be> Date: Sat Jun 24 23:17:57 2017 +0000 Add ShowEmbeds option (discord). #202 diff --git a/bridge/config/config.go b/bridge/config/config.go index 7f27115..246d6b8 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -686 +687 @@ type Protocol struct {   RemoteNickFormat string // all protocols   Server string // IRC,mattermost,XMPP,discord   ShowJoinPart bool // all protocols + ShowEmbeds bool // discord   SkipTLSVerify bool // IRC, mattermost   Team string // mattermost   Token string // gitter, slack, discord, api diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 3d24496..8c7d971 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -1417 +14115 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat   }   m.Message.Content = b.stripCustomoji(m.Message.Content)   m.Message.Content = b.replaceChannelMentions(m.Message.Content) - b.Remote <- config.Message{Username: username, Text: m.ContentWithMentionsReplaced(), Channel: channelName, + + text := m.ContentWithMentionsReplaced() + if b.Config.ShowEmbeds && m.Message.Embeds != nil { + for _, embed := range m.Message.Embeds { + text = text + "embed: " + embed.Title + " - " + embed.Description + " - " + embed.URL + "\n" + } + } + + b.Remote <- config.Message{Username: username, Text: text, Channel: channelName,   Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg",   UserID: m.Author.ID}  } diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 2fd8adb..53a584a 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -4506 +45010 @@ Token="Yourtokenhere"  #REQUIRED  Server="yourservername"   +#Shows title, description and URL of embedded messages (sent by other bots) +#OPTIONAL (default false) +ShowEmbeds=false +  #Disable sending of edits to other bridges  #OPTIONAL (default false)  EditDisable=false