From 8e3e170ecf1184fc22a3d3fa096258ae554bb5d7 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sun, 21 Apr 2024 22:17:02 +0200 Subject: [PATCH] add map as tag --- main.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 9893749..e3aaaa1 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,6 @@ type TF2Server string var ( server = flag.String("server", "", "comma seperated list of addresses to query") - oldIDs = flag.Bool("oldids", false, "use old gamedig IDs") ) func main() { @@ -49,10 +48,10 @@ func main() { enc.StartLine("tf2server") enc.AddTag("address", string(ip)) + enc.AddTag("map", tStat.Map) enc.AddTag("name", tStat.Name) enc.AddField("player", lineprotocol.IntValue(int64(tStat.NumPlayers))) enc.AddField("maxplayer", lineprotocol.IntValue(int64(tStat.MaxPlayers))) - enc.AddField("map", lineprotocol.MustNewValue(tStat.Map)) enc.AddField("ping", lineprotocol.IntValue(int64(tStat.Ping))) enc.EndLine(time.Now()) fmt.Print(string(enc.Bytes())) @@ -60,12 +59,7 @@ func main() { } func (ip TF2Server) Stats() (*TF2Stat, error) { - gameID := "teamfortress2" - if *oldIDs { - gameID = "tf2" - } - - cmd := exec.Command("gamedig", "--type", gameID, string(ip)) + cmd := exec.Command("gamedig", "--type", "teamfortress2", string(ip)) bOut, err := cmd.CombinedOutput() if err != nil { return nil, err