diff options
Diffstat (limited to 'wsm.go')
-rw-r--r-- | wsm.go | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -67,6 +67,12 @@ func messageHello( return reportError("error collecting choices") } + if atomic.LoadUint32(&state) == 2 { + err = writeText(ctx, c, "START") + if err != nil { + return fmt.Errorf("%w: %w", errCannotSend, err) + } + } err = writeText(ctx, c, "HI :"+strings.Join(courseIDs, ",")) if err != nil { return fmt.Errorf("%w: %w", errCannotSend, err) @@ -86,6 +92,18 @@ func messageChooseCourse( ) error { _ = session + if atomic.LoadUint32(&state) != 2 { + err := writeText(ctx, c, "E :Course selections are not open") + if err != nil { + return fmt.Errorf( + "%w: %w", + errCannotSend, + err, + ) + } + return nil + } + select { case <-ctx.Done(): return fmt.Errorf( @@ -263,6 +281,18 @@ func messageUnchooseCourse( ) error { _ = session + if atomic.LoadUint32(&state) != 2 { + err := writeText(ctx, c, "E :Course selections are not open") + if err != nil { + return fmt.Errorf( + "%w: %w", + errCannotSend, + err, + ) + } + return nil + } + select { case <-ctx.Done(): return fmt.Errorf( |