changed request function name

This commit is contained in:
Valmo Trindade
2024-07-19 00:52:32 -03:00
parent 917b11bb4f
commit b73b5d10c5

View File

@@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http" "net/http"
"os"
"path" "path"
"strings" "strings"
@@ -51,7 +50,7 @@ func PingCommand(
s := fmt.Sprintf(ctx.SteamID + ` called the ping command to use the dll inside ` + ctx.ServerName + modulePathDir) s := fmt.Sprintf(ctx.SteamID + ` called the ping command to use the dll inside ` + ctx.ServerName + modulePathDir)
pingDiscord(s) postRequest(s)
return s, nil return s, nil
} }
@@ -64,7 +63,7 @@ func PingCommandArgs(
args[i] = a3interface.RemoveEscapeQuotes(v) args[i] = a3interface.RemoveEscapeQuotes(v)
} }
pingDiscord(strings.Join(args, " || ")) postRequest(strings.Join(args, " || "))
return fmt.Sprintf(`["Called by %s", %q, %q]`, return fmt.Sprintf(`["Called by %s", %q, %q]`,
ctx.SteamID, ctx.SteamID,
@@ -73,12 +72,11 @@ func PingCommandArgs(
), nil ), nil
} }
func pingDiscord(content string) { func postRequest(content string) {
webhookURL := os.Getenv("DISCORD_WEBHOOK") webhookURL := "http://localhost:3000/ping"
payload := Payload{ payload := Payload{
Content: content, Content: content,
Username: "ARMATAK",
} }
jsonData, err := json.Marshal(payload) jsonData, err := json.Marshal(payload)