mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
refactor: remove roblox code
unused
This commit is contained in:
parent
723813839d
commit
57816301f9
7 changed files with 1 additions and 85 deletions
|
|
@ -1,40 +0,0 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"api/internal/model"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func GetRobloxGrowARobloxianLikesCount() int {
|
||||
url := fmt.Sprintf("https://games.roblox.com/v1/games/votes?universeIds=%s", os.Getenv("GROWAROBLOXIAN_UNIVERSE_ID"))
|
||||
res, err := http.Get(url)
|
||||
if err != nil {
|
||||
slog.Error("Error requesting Roblox votes API", slog.Any("error", err))
|
||||
return 0
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
slog.Error("Error reading body", slog.Any("error", err))
|
||||
return 0
|
||||
}
|
||||
|
||||
var apiData model.RobloxGameVotesAPI
|
||||
err = json.Unmarshal(body, &apiData)
|
||||
if err != nil {
|
||||
slog.Error("Error unmarshalling JSON", slog.Any("error", err))
|
||||
return 0
|
||||
}
|
||||
|
||||
if apiData.Data == nil {
|
||||
slog.Warn("No data returned from Roblox votes API")
|
||||
return 0
|
||||
}
|
||||
|
||||
return apiData.Data[0].Upvotes
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue