diff --git a/Makefile b/Makefile index f5e0f1e..1e2ea90 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ .PHONY: all init deps install test lint run stop -run: - make migrate-up +run: migrate-up go build ./gralias start diff --git a/components/room.html b/components/room.html index 207e242..9836e34 100644 --- a/components/room.html +++ b/components/room.html @@ -53,7 +53,7 @@ Server says:
diff --git a/llmapi/main.go b/llmapi/main.go index 5e0749c..041349a 100644 --- a/llmapi/main.go +++ b/llmapi/main.go @@ -188,7 +188,8 @@ func (b *Bot) BotMove() { b.log.Error("bot loop", "error", err) return } - eventName := models.NotifyBacklogPrefix + room.ID + // eventName := models.NotifyBacklogPrefix + room.ID + eventName := models.NotifyRoomUpdatePrefix + room.ID eventPayload := "" defer func() { // save room if err := saveRoom(room); err != nil { @@ -247,11 +248,15 @@ func (b *Bot) BotMove() { room.ActionHistory = append(room.ActionHistory, action) room.MimeDone = true entry := fmt.Sprintf("meant to open: %v", tempMap["words_I_mean_my_team_to_open"]) - room.LogJournal = append(room.LogJournal, models.Journal{ + lj := models.Journal{ Entry: entry, Username: b.BotName, RoomID: room.ID, - }) + } + room.LogJournal = append(room.LogJournal, lj) + if err := repo.JournalCreate(context.Background(), &lj); err != nil { + b.log.Warn("failed to write to journal", "entry", lj) + } eventPayload = mimeResp.Clue + mimeResp.Number guessLimitU64, err := strconv.ParseUint(mimeResp.Number, 10, 8) if err != nil { @@ -267,6 +272,7 @@ func (b *Bot) BotMove() { b.log.Error("failed to create action", "error", err) return } + // StartTurnTimer(fi.Room.ID, fi.Room.Settings.RoundTime) if err := saveRoom(room); err != nil { b.log.Error("failed to save room", "error", err) return @@ -291,13 +297,17 @@ func (b *Bot) BotMove() { b.log.Warn("failed to parse could_be", "bot_resp", tempMap, "bot_name", b.BotName) } entry := fmt.Sprintf("also considered this: %v", couldBe) - room.LogJournal = append(room.LogJournal, models.Journal{ + lj := models.Journal{ Entry: entry, Username: b.BotName, RoomID: room.ID, - }) - eventName = models.NotifyRoomUpdatePrefix + room.ID - eventPayload = "" + } + room.LogJournal = append(room.LogJournal, lj) + if err := repo.JournalCreate(context.Background(), &lj); err != nil { + b.log.Warn("failed to write to journal", "entry", lj) + } + // eventName = models.NotifyRoomUpdatePrefix + room.ID + // eventPayload = "" // TODO: needs to decide if it wants to open the next cardword or end turn // or end turn on limit default: diff --git a/todos.md b/todos.md index 3d9fd62..1da6725 100644 --- a/todos.md +++ b/todos.md @@ -78,3 +78,10 @@ - bot mime makes a clue -> no update in the room for players; - red moves after bot gave (metal - 3) ended after two guesses (showed in logs, that opened 3. double click on the same card? or somewhere counter is not dropped?); the first guess moved counter to 2, in logs only two requests as expected; +- bot mime gve a blue -> timer did not start; timer should be in third package, maybe in crons; +- log journal is not shown on the page; +- marks did not clear after end of the turn (feature?) + +- start new game satrted timer for a mime; (feature? in other cases mime has no timer); +- old cards are still around; +- timer ended and went to 300;