diff options
author | Wim <wim@42.be> | 2018-05-06 16:32:24 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-05-06 16:32:24 +0200 |
commit | 346a7284f75373bd5a852dcdccda6d508bed6c5a (patch) | |
tree | 41fca8f116d637000ce21233ffd258fc3d19ee57 /bridge/steam/steam.go | |
parent | ee4ac67081a4155a2b5852b9c9c2161084adefe0 (diff) | |
download | matterbridge-msglm-346a7284f75373bd5a852dcdccda6d508bed6c5a.tar.gz matterbridge-msglm-346a7284f75373bd5a852dcdccda6d508bed6c5a.tar.bz2 matterbridge-msglm-346a7284f75373bd5a852dcdccda6d508bed6c5a.zip |
Handle file uploads to mediaserver (steam)
Diffstat (limited to 'bridge/steam/steam.go')
-rw-r--r-- | bridge/steam/steam.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bridge/steam/steam.go b/bridge/steam/steam.go index 6065b2a8..27bf284a 100644 --- a/bridge/steam/steam.go +++ b/bridge/steam/steam.go @@ -2,8 +2,10 @@ package bsteam import ( "fmt" + "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" + "github.com/42wim/matterbridge/bridge/helper" "github.com/Philipp15b/go-steam" "github.com/Philipp15b/go-steam/protocol/steamlang" "github.com/Philipp15b/go-steam/steamid" @@ -66,6 +68,30 @@ func (b *Bsteam) Send(msg config.Message) (string, error) { if err != nil { return "", err } + + // Handle files + if msg.Extra != nil { + for _, rmsg := range helper.HandleExtra(&msg, b.General) { + b.c.Social.SendMessage(id, steamlang.EChatEntryType_ChatMsg, rmsg.Username+rmsg.Text) + } + if len(msg.Extra["file"]) > 0 { + for _, f := range msg.Extra["file"] { + fi := f.(config.FileInfo) + if fi.Comment != "" { + msg.Text += fi.Comment + ": " + } + if fi.URL != "" { + msg.Text = fi.URL + if fi.Comment != "" { + msg.Text = fi.Comment + ": " + fi.URL + } + } + b.c.Social.SendMessage(id, steamlang.EChatEntryType_ChatMsg, msg.Username+msg.Text) + } + return "", nil + } + } + b.c.Social.SendMessage(id, steamlang.EChatEntryType_ChatMsg, msg.Username+msg.Text) return "", nil } |