Compare commits

..

No commits in common. "ca2ccc569d17f9b613fa10ed849e7a354812687f" and "58b1eabadf7836c824d99e38ad50aa52d8fd3b2f" have entirely different histories.

2 changed files with 6 additions and 10 deletions

View File

@ -1,3 +1,3 @@
SN_BASE_URL=
SN_API_KEY=
SN_API_TOKEN=
SN_MEDIA_URL=

14
main.go
View File

@ -263,12 +263,11 @@ func parseGameStart(input string) (string, error) {
for _, line := range strings.Split(input, "\n") {
line = strings.Trim(line, " ")
var found bool
if line, found = strings.CutPrefix(line, "@chess"); !found {
if !strings.HasPrefix(line, "@chess") {
continue
}
return strings.Trim(line, " "), nil
return strings.Trim(strings.ReplaceAll(line, "@chess", ""), " "), nil
}
return "", errors.New("failed to parse game start")
@ -279,18 +278,15 @@ func parseGameProgress(input string) (string, error) {
words := strings.Split(input, " ")
if len(lines) == 1 && len(words) == 1 {
return strings.Trim(strings.ReplaceAll(input, "@chess", ""), " "), nil
return strings.Trim(input, " "), nil
}
for _, line := range strings.Split(input, "\n") {
line = strings.Trim(line, " ")
var found bool
if line, found = strings.CutPrefix(line, "@chess"); !found {
if !strings.Contains(line, "@chess") {
continue
}
return strings.Trim(line, " "), nil
return strings.Trim(strings.ReplaceAll(line, "@chess", ""), " "), nil
}
return "", errors.New("failed to parse game update")