mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-10 04:20:25 +00:00
Fix loop, make megacheck happy
This commit is contained in:
parent
c4b75e5754
commit
7aabe12acf
@ -180,18 +180,23 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) {
|
|||||||
return msg.ID, b.mc.DeleteMessage(msg.ID)
|
return msg.ID, b.mc.DeleteMessage(msg.ID)
|
||||||
}
|
}
|
||||||
if msg.Extra != nil {
|
if msg.Extra != nil {
|
||||||
for _, f := range msg.Extra["file"] {
|
if len(msg.Extra["file"]) > 0 {
|
||||||
fi := f.(config.FileInfo)
|
var err error
|
||||||
id, err := b.mc.UploadFile(*fi.Data, b.mc.GetChannelId(channel, ""), fi.Name)
|
var res, id string
|
||||||
if err != nil {
|
for _, f := range msg.Extra["file"] {
|
||||||
flog.Debugf("ERROR %#v", err)
|
fi := f.(config.FileInfo)
|
||||||
return "", err
|
id, err = b.mc.UploadFile(*fi.Data, b.mc.GetChannelId(channel, ""), fi.Name)
|
||||||
|
if err != nil {
|
||||||
|
flog.Debugf("ERROR %#v", err)
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
message = "uploaded a file: " + fi.Name
|
||||||
|
if b.Config.PrefixMessagesWithNick {
|
||||||
|
message = nick + "uploaded a file: " + fi.Name
|
||||||
|
}
|
||||||
|
res, err = b.mc.PostMessageWithFiles(b.mc.GetChannelId(channel, ""), message, []string{id})
|
||||||
}
|
}
|
||||||
message = "uploaded a file: " + fi.Name
|
return res, err
|
||||||
if b.Config.PrefixMessagesWithNick {
|
|
||||||
message = nick + "uploaded a file: " + fi.Name
|
|
||||||
}
|
|
||||||
return b.mc.PostMessageWithFiles(b.mc.GetChannelId(channel, ""), message, []string{id})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if msg.ID != "" {
|
if msg.ID != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user