diff --git a/.gitignore b/.gitignore index 3221188..2a3c0b9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ awp-cli awp-cli.* players.json .DS_Store +.vscode # air-related stuff tmp diff --git a/cmd/cli/cmd/check.go b/cmd/cli/cmd/check.go index f0cfd56..f93bd9e 100644 --- a/cmd/cli/cmd/check.go +++ b/cmd/cli/cmd/check.go @@ -15,13 +15,17 @@ import ( func isAttending(body string) string { body = strings.ToLower(body) lines := strings.Fields(body) - if strings.Contains(lines[0], "yes") { - return "yes" - } else if strings.Contains(lines[0], "no") { - return "no" - } else { - return "unknown" + + for _, l := range lines { + line := strings.Trim(l, " \t\r\n") + if strings.HasPrefix(line, "yes") { + return "yes" + } else if strings.HasPrefix(line, "no") { + return "no" + } } + + return "unknown" } // checkCmd represents the check command @@ -41,6 +45,7 @@ will attend the next session.`, if len(emails) == 0 { log.Default().Println("No new emails") } else { + log.Default().Println("Reading new emails") session, err := data.ReadSessionData() if err != nil { log.Default().Println(err)