5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-25 20:11:36 +00:00

Add support for discord attachments. Fixes #59

This commit is contained in:
Wim 2016-10-26 00:09:22 +02:00
parent e7107cf782
commit d3a34af073

View File

@ -106,6 +106,11 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
if m.Author.Username == b.Nick { if m.Author.Username == b.Nick {
return return
} }
if len(m.Attachments) > 0 {
for _, attach := range m.Attachments {
m.Content = m.Content + "\n" + attach.URL
}
}
flog.Debugf("Sending message from %s on %s to gateway", m.Author.Username, b.FullOrigin()) flog.Debugf("Sending message from %s on %s to gateway", m.Author.Username, b.FullOrigin())
b.Remote <- config.Message{Username: m.Author.Username, Text: m.Content, Channel: b.getChannelName(m.ChannelID), b.Remote <- config.Message{Username: m.Author.Username, Text: m.Content, Channel: b.getChannelName(m.ChannelID),
Origin: b.origin, Protocol: b.protocol, FullOrigin: b.FullOrigin()} Origin: b.origin, Protocol: b.protocol, FullOrigin: b.FullOrigin()}