summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-06-24 23:17:57 +0200
committerWim <wim@42.be>2017-06-24 23:17:57 +0200
commit1b837b3dc7579351a6018b52b58613c446ce08a5 (patch)
tree7ceb5a5a2ca175e931cb6bd3ba8074bef78c855e /bridge
parent2ece724f751ece1a7d037b138b27df00834833fc (diff)
downloadmatterbridge-msglm-1b837b3dc7579351a6018b52b58613c446ce08a5.tar.gz
matterbridge-msglm-1b837b3dc7579351a6018b52b58613c446ce08a5.tar.bz2
matterbridge-msglm-1b837b3dc7579351a6018b52b58613c446ce08a5.zip
Add ShowEmbeds option (discord). #202
Diffstat (limited to 'bridge')
-rw-r--r--bridge/config/config.go1
-rw-r--r--bridge/discord/discord.go10
2 files changed, 10 insertions, 1 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 7f27115b..246d6b82 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -68,6 +68,7 @@ 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 3d244962..8c7d9711 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -141,7 +141,15 @@ 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}
}