check msg prefix before parse for both new-!state, !available
parent
75409a11b9
commit
09e87c66d8
|
|
@ -10,7 +10,7 @@
|
||||||
"RefreshToken": "171417741bf762b99b0b9f9137491b7a69874a77",
|
"RefreshToken": "171417741bf762b99b0b9f9137491b7a69874a77",
|
||||||
"AccessToken": "e63db98f92d2db7ac7f56914a2030c889b378e9b",
|
"AccessToken": "e63db98f92d2db7ac7f56914a2030c889b378e9b",
|
||||||
"RefreshURI": "https://api.imgur.com/oauth2/token",
|
"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",
|
"RefreshMethod": "POST",
|
||||||
"UploadURI": "https://api.imgur.com/3/image",
|
"UploadURI": "https://api.imgur.com/3/image",
|
||||||
"UploadMethod": "POST"
|
"UploadMethod": "POST"
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
"IDs": {
|
"IDs": {
|
||||||
"Matrix": "@belandbroc:matrix.org"
|
"Matrix": "@belandbroc:matrix.org"
|
||||||
},
|
},
|
||||||
"Available": 5642107200
|
"Available": 5642452800
|
||||||
},
|
},
|
||||||
"caleb": {
|
"caleb": {
|
||||||
"States": [
|
"States": [
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
"Message": {
|
"Message": {
|
||||||
"Matrix": {
|
"Matrix": {
|
||||||
"ReceiveEnabled": true,
|
"ReceiveEnabled": true,
|
||||||
"Mock": false,
|
"Mock": true,
|
||||||
"Homeserver": "https://matrix-client.matrix.org",
|
"Homeserver": "https://matrix-client.matrix.org",
|
||||||
"Username": "@breellocaldev:matrix.org",
|
"Username": "@breellocaldev:matrix.org",
|
||||||
"Token": "syt_YnJlZWxsb2NhbGRldg_HTewKMMePdEcLvceAKEz_2fHsHa",
|
"Token": "syt_YnJlZWxsb2NhbGRldg_HTewKMMePdEcLvceAKEz_2fHsHa",
|
||||||
|
|
|
||||||
7
main.go
7
main.go
|
|
@ -60,6 +60,9 @@ func matrixrecv() error {
|
||||||
log.Printf("looking for states")
|
log.Printf("looking for states")
|
||||||
states := map[string]map[config.State]struct{}{}
|
states := map[string]map[config.State]struct{}{}
|
||||||
for _, msg := range messages {
|
for _, msg := range messages {
|
||||||
|
if !strings.HasPrefix(msg.Content, "!state") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if _, ok := states[msg.Sender]; ok {
|
if _, ok := states[msg.Sender]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -74,10 +77,10 @@ func matrixrecv() error {
|
||||||
log.Printf("looking for pauses")
|
log.Printf("looking for pauses")
|
||||||
pauses := map[string]time.Time{}
|
pauses := map[string]time.Time{}
|
||||||
for _, msg := range messages {
|
for _, msg := range messages {
|
||||||
if _, ok := pauses[msg.Sender]; ok {
|
if !strings.HasPrefix(msg.Content, "!available ") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(msg.Content, "!available ") {
|
if _, ok := pauses[msg.Sender]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t, err := time.ParseInLocation(
|
t, err := time.ParseInLocation(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue