diff --git a/go.mod b/go.mod index 3739fc5..5c088f2 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( require ( github.com/bwmarrin/discordgo v0.27.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/ekzyis/sn-goapi v0.1.1 // indirect + github.com/ekzyis/sn-goapi v0.2.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect diff --git a/go.sum b/go.sum index 7fdc6b1..aa43a71 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,10 @@ github.com/ekzyis/sn-goapi v0.1.0 h1:B/v120DgYlpuzqkyiRTMb6C7JIoU3RaYE9M8D6m6OLQ github.com/ekzyis/sn-goapi v0.1.0/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo= github.com/ekzyis/sn-goapi v0.1.1 h1:FLCbaAIZ1qngtFZTfzkrp4HPFzHUPStdUgLHUPz82Jo= github.com/ekzyis/sn-goapi v0.1.1/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo= +github.com/ekzyis/sn-goapi v0.1.2-0.20230815195350-cab35b4a3731 h1:BukOC3+ljt0LVIRnsmnWjeqwcCZpVkGzI4W0GdIm1RY= +github.com/ekzyis/sn-goapi v0.1.2-0.20230815195350-cab35b4a3731/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo= +github.com/ekzyis/sn-goapi v0.2.0 h1:k5YJlG+OguQEQRlbS5KghUttbfJaEkfvIfqB8B133FY= +github.com/ekzyis/sn-goapi v0.2.0/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= diff --git a/main.go b/main.go index faa2d57..2aab953 100644 --- a/main.go +++ b/main.go @@ -43,8 +43,17 @@ func CheckNotifications() { } } +func SessionKeepAlive() { + for { + log.Println("Refresh session using GET /api/auth/session ...") + sn.RefreshSession() + WaitUntilNextHour() + } +} + func main() { go CheckNotifications() + go SessionKeepAlive() for { stories, err := FetchHackerNewsTopStories()