diff --git a/config.json b/config.json index cdd2a4d..fe7521a 100644 --- a/config.json +++ b/config.json @@ -10,7 +10,7 @@ "RefreshToken": "171417741bf762b99b0b9f9137491b7a69874a77", "AccessToken": "e63db98f92d2db7ac7f56914a2030c889b378e9b", "RefreshURI": "https://api.imgur.com/oauth2/token", - "RefreshFormat": "refresh_token=%s&client_id=%s&client_secret=%s&grant_type=refresh_token", + "RefreshFormat": "refresh_token=%s\u0026client_id=%s\u0026client_secret=%s\u0026grant_type=refresh_token", "RefreshMethod": "POST", "UploadURI": "https://api.imgur.com/3/image", "UploadMethod": "POST" @@ -29,7 +29,7 @@ "IDs": { "Matrix": "@belandbroc:matrix.org" }, - "Available": 5642107200 + "Available": 5642452800 }, "caleb": { "States": [ @@ -56,7 +56,7 @@ "Message": { "Matrix": { "ReceiveEnabled": true, - "Mock": false, + "Mock": true, "Homeserver": "https://matrix-client.matrix.org", "Username": "@breellocaldev:matrix.org", "Token": "syt_YnJlZWxsb2NhbGRldg_HTewKMMePdEcLvceAKEz_2fHsHa", diff --git a/main.go b/main.go index 7498534..4e98855 100644 --- a/main.go +++ b/main.go @@ -60,6 +60,9 @@ func matrixrecv() error { log.Printf("looking for states") states := map[string]map[config.State]struct{}{} for _, msg := range messages { + if !strings.HasPrefix(msg.Content, "!state") { + continue + } if _, ok := states[msg.Sender]; ok { continue } @@ -74,10 +77,10 @@ func matrixrecv() error { log.Printf("looking for pauses") pauses := map[string]time.Time{} for _, msg := range messages { - if _, ok := pauses[msg.Sender]; ok { + if !strings.HasPrefix(msg.Content, "!available ") { continue } - if !strings.HasPrefix(msg.Content, "!available ") { + if _, ok := pauses[msg.Sender]; ok { continue } t, err := time.ParseInLocation(