mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 16:39:24 +00:00
Send chat notification if media is too big to be re-uploaded to MediaServer. See #359
This commit is contained in:
@ -2,6 +2,8 @@ package helper
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/42wim/matterbridge/bridge/config"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
@ -38,3 +40,18 @@ func SplitStringLength(input string, length int) string {
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
// handle all the stuff we put into extra
|
||||
func HandleExtra(msg *config.Message, general *config.Protocol) []config.Message {
|
||||
extra := msg.Extra
|
||||
rmsg := []config.Message{}
|
||||
if len(extra[config.EVENT_FILE_FAILURE_SIZE]) > 0 {
|
||||
for _, f := range extra[config.EVENT_FILE_FAILURE_SIZE] {
|
||||
fi := f.(config.FileInfo)
|
||||
text := fmt.Sprintf("file %s too big to download (%#v > allowed size: %#v)", fi.Name, fi.Size, general.MediaDownloadSize)
|
||||
rmsg = append(rmsg, config.Message{Text: text, Username: "<system> ", Channel: msg.Channel})
|
||||
}
|
||||
return rmsg
|
||||
}
|
||||
return rmsg
|
||||
}
|
||||
|
Reference in New Issue
Block a user