Respond with e5 if initial move was given else e4

This commit is contained in:
ekzyis 2024-10-18 23:07:09 +02:00
parent 8347bf0cbc
commit da5f67df46
1 changed files with 7 additions and 3 deletions

10
main.go
View File

@ -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)