Skip to content

Commit

Permalink
fixed activity not ending when timed out
Browse files Browse the repository at this point in the history
  • Loading branch information
Haydz6 committed Dec 11, 2022
1 parent 1ca307c commit 1182333
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Binary file modified RobloxStudioPresence.exe
Binary file not shown.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/Haydz6/RobloxStudioPresence
go 1.19

require (
github.com/Haydz6/rich-go v0.0.0-20221211020756-a49c7642fb34 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.8.1 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/hugolgst/rich-go v0.0.0-20210925091458-d59fb695d9c0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
Expand All @@ -23,5 +23,6 @@ require (
golang.org/x/text v0.3.6 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/Haydz6/rich-go v0.0.0-20221211020756-a49c7642fb34 h1:qFn3sypvW2/IOTkGlV2N9w6teJksnptMxQM/wnYlJ1g=
github.com/Haydz6/rich-go v0.0.0-20221211020756-a49c7642fb34/go.mod h1:afSscIlhN6wMp1sy17cVbV74xLhe/IVwHe5ttkqsDjI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -17,8 +19,6 @@ github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGF
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/hugolgst/rich-go v0.0.0-20210925091458-d59fb695d9c0 h1:IkZfZBWufGFLvci1vXLiUu8PWVtG6wlz920CMtHobMo=
github.com/hugolgst/rich-go v0.0.0-20210925091458-d59fb695d9c0/go.mod h1:nGaW7CGfNZnhtiFxMpc4OZdqIexGXjUlBnlmpZmjEKA=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down
15 changes: 13 additions & 2 deletions setpresence.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"
"time"

"github.com/Haydz6/rich-go/client"
"github.com/gin-gonic/gin"
"github.com/hugolgst/rich-go/client"
)

var LastGameId = 0
Expand Down Expand Up @@ -78,14 +78,25 @@ func SetPresence(c *gin.Context) {
c.String(http.StatusOK, "")
}

func KillActivity() {
err := client.SetActivity(client.Activity{
State: "end",
})

if err != nil {
println(err)
}
}

func TimeoutCheck() {
for range time.Tick(time.Second) {
println(time.Now().Unix() - LastPresenceUpdate)
if time.Now().Unix()-LastPresenceUpdate >= 3 {
if LoggedIn {
LoggedIn = false
KillActivity()
client.Logout()
}
break
}
}
}

0 comments on commit 1182333

Please sign in to comment.