From da5f67df46a2834a1a160172292f4028e7bd6bc7 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 18 Oct 2024 23:07:09 +0200 Subject: [PATCH] Respond with e5 if initial move was given else e4 --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index eee074f..03c1416 100644 --- a/main.go +++ b/main.go @@ -147,9 +147,13 @@ func handleGameStart(req *sn.Item) error { } // reply with algebraic notation, image and info - info := "_A new chess game has been started!_\n\n" + - "_Reply with a move like `d5` to continue the game. " + - "See [here](https://stacker.news/chess#how-to-continue) for details._" + infoMove := "e4" + if len(b.Moves) > 0 { + infoMove = "e5" + } + info := fmt.Sprintf("_A new chess game has been started!_\n\n"+ + "_Reply with a move like `%s` to continue the game. "+ + "See [here](https://stacker.news/chess#how-to-continue) for details._", infoMove) res = strings.Trim(fmt.Sprintf("%s\n\n%s\n\n%s", b.AlgebraicNotation(), imgUrl, info), " ") if _, err = createComment(req.Id, res); err != nil { return fmt.Errorf("failed to reply to item %d: %v\n", req.Id, err)