Add ShowEmbeds option (discord). #202

This commit is contained in:
Wim 2017-06-24 23:17:57 +02:00
parent 2ece724f75
commit 1b837b3dc7
3 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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}
}

View File

@ -450,6 +450,10 @@ 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