summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-11-04 14:47:14 +0100
committerWim <wim@42.be>2017-11-04 14:47:14 +0100
commit7dbebd3ea7fec1715b6d18a7ecf0c0c56797db05 (patch)
treec5d783b6ad21db2214527a8a7878210830ab8936 /bridge
parent6f187903522dc629c4c4f3171775f83021dcc4e5 (diff)
downloadmatterbridge-msglm-7dbebd3ea7fec1715b6d18a7ecf0c0c56797db05.tar.gz
matterbridge-msglm-7dbebd3ea7fec1715b6d18a7ecf0c0c56797db05.tar.bz2
matterbridge-msglm-7dbebd3ea7fec1715b6d18a7ecf0c0c56797db05.zip
Show error message when file upload fails (discord)
Diffstat (limited to 'bridge')
-rw-r--r--bridge/discord/discord.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index fdc20c18..12e0d827 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -147,16 +147,18 @@ func (b *bdiscord) Send(msg config.Message) (string, error) {
// check if we have files to upload (from slack, telegram or mattermost)
if len(msg.Extra["file"]) > 0 {
var err error
- var res *discordgo.Message
for _, f := range msg.Extra["file"] {
fi := f.(config.FileInfo)
files := []*discordgo.File{}
files = append(files, &discordgo.File{fi.Name, "", bytes.NewReader(*fi.Data)})
- res, err = b.c.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{Content: msg.Text, Files: files})
+ _, err = b.c.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{Content: msg.Text, Files: files})
+ if err != nil {
+ flog.Errorf("file upload failed: %#v", err)
+ }
}
- return res.ID, err
}
}
+
res, err := b.c.ChannelMessageSend(channelID, msg.Username+msg.Text)
if err != nil {
return "", err