Compare commits
2 Commits
c29d02423f
...
58eca5ea06
Author | SHA1 | Date | |
---|---|---|---|
58eca5ea06 | |||
6abccc2e03 |
13
domain/domainModels.go
Normal file
13
domain/domainModels.go
Normal file
@ -0,0 +1,13 @@
|
||||
package domainUtils
|
||||
|
||||
import "git.gregbrzezinski.com/Skirda/skirdagoutils/gameUtils"
|
||||
|
||||
type Domain struct {
|
||||
DiscordGroupID string
|
||||
Games gameUtils.Games
|
||||
Sessions gameUtils.Sessions
|
||||
}
|
||||
|
||||
type Domains struct {
|
||||
Domains []Domain
|
||||
}
|
15
domain/domainUtils.go
Normal file
15
domain/domainUtils.go
Normal file
@ -0,0 +1,15 @@
|
||||
package domainUtils
|
||||
|
||||
import "git.gregbrzezinski.com/Skirda/skirdagoutils/gameUtils"
|
||||
|
||||
var fakeDomains = Domains{
|
||||
Domains: []Domain{defaultDomain},
|
||||
}
|
||||
|
||||
var defaultDomain = Domain{
|
||||
DiscordGroupID: "0",
|
||||
Games: gameUtils.Games{
|
||||
SteamGames: gameUtils.SteamFakeGamesList,
|
||||
},
|
||||
Sessions: gameUtils.FakeSessions,
|
||||
}
|
29
gameUtils/sessionTypes.go
Normal file
29
gameUtils/sessionTypes.go
Normal file
@ -0,0 +1,29 @@
|
||||
package gameUtils
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
SessionId string
|
||||
GameId string
|
||||
Icon string
|
||||
Title string
|
||||
Status string
|
||||
Version string
|
||||
Expires time.Time
|
||||
Arguments []Argument
|
||||
}
|
||||
|
||||
type Sessions struct {
|
||||
Sessions []Session
|
||||
}
|
||||
|
||||
type JSSessionInterface struct {
|
||||
GameID string `json:"gameId"`
|
||||
Icon string `json:"icon"`
|
||||
Title string `json:"title"`
|
||||
Status string `json:"status"`
|
||||
Version string `json:"version"`
|
||||
Expires time.Time `json:"expires"`
|
||||
}
|
55
gameUtils/sessionUtils.go
Normal file
55
gameUtils/sessionUtils.go
Normal file
@ -0,0 +1,55 @@
|
||||
package gameUtils
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
func ConvertServerSessionsToJSON(s Session) []byte {
|
||||
s_json, err := json.Marshal(s)
|
||||
_ = err //TODO: Check Errors
|
||||
return s_json
|
||||
}
|
||||
|
||||
var FakeSessions = Sessions{
|
||||
Sessions: []Session{
|
||||
{
|
||||
GameId: "garrysmod",
|
||||
SessionId: "gmod-test",
|
||||
Icon: "",
|
||||
Title: "Regular Skirda Gmod server",
|
||||
Status: "Super fake session",
|
||||
Version: "",
|
||||
Expires: time.Time{},
|
||||
Arguments: []Argument{
|
||||
{
|
||||
Body: "+connect",
|
||||
Value: "127.0.0.1:27015",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
GameId: "half-lide-1",
|
||||
Title: "Half-Life 1 МЯСО",
|
||||
Status: "Retro shit",
|
||||
Expires: time.Time{},
|
||||
},
|
||||
{
|
||||
GameId: "minecraft",
|
||||
Title: "Test 3",
|
||||
Status: "Testing session",
|
||||
Version: "1.54.7",
|
||||
Expires: time.Time{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func FindSessionByID(sessionId string, sessions []Session) Session {
|
||||
for _, session := range sessions {
|
||||
if session.SessionId == sessionId {
|
||||
return session
|
||||
}
|
||||
}
|
||||
var temp Session = Session{}
|
||||
return temp
|
||||
}
|
Loading…
Reference in New Issue
Block a user