Make megacheck happy again

This commit is contained in:
Wim 2017-11-03 20:13:58 +01:00
parent d1e8ff814b
commit 0530503ef2
1 changed files with 4 additions and 6 deletions

View File

@ -146,17 +146,15 @@ func (b *bdiscord) Send(msg config.Message) (string, error) {
if msg.Extra != nil { if msg.Extra != nil {
// check if we have files to upload (from slack, telegram or mattermost) // check if we have files to upload (from slack, telegram or mattermost)
if len(msg.Extra["file"]) > 0 { if len(msg.Extra["file"]) > 0 {
var err error
var res *discordgo.Message
for _, f := range msg.Extra["file"] { for _, f := range msg.Extra["file"] {
fi := f.(config.FileInfo) fi := f.(config.FileInfo)
files := []*discordgo.File{} files := []*discordgo.File{}
files = append(files, &discordgo.File{fi.Name, "", bytes.NewReader(*fi.Data)}) files = append(files, &discordgo.File{fi.Name, "", bytes.NewReader(*fi.Data)})
res, err := b.c.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{Content: msg.Text, Files: files}) res, err = b.c.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{Content: msg.Text, Files: files})
if err != nil {
flog.Debugf("ERROR channelMessageSendComplex: %#v", err)
return "", err
}
return res.ID, err
} }
return res.ID, err
} }
} }
res, err := b.c.ChannelMessageSend(channelID, msg.Username+msg.Text) res, err := b.c.ChannelMessageSend(channelID, msg.Username+msg.Text)