Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 09f62d70403cf5facb4bcd7681fd29a671173f0b Author: Wim <wim@42.be> Date: Sun May 06 16:32:24 2018 +0000 Handle file uploads to mediaserver (steam) diff --git a/bridge/steam/steam.go b/bridge/steam/steam.go index 6065b2a..27bf284 100644 --- a/bridge/steam/steam.go +++ b/bridge/steam/steam.go @@ -28 +210 @@ 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" @@ -666 +6830 @@ 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  }