Enha: bot guesser
This commit is contained in:
		| @@ -74,9 +74,6 @@ func saveFullInfo(fi *models.FullInfo) error { | ||||
| 	if err := saveState(fi.State.Username, fi.State); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	// if fi.Room == nil { // can be null on exit | ||||
| 	// 	return nil | ||||
| 	// } | ||||
| 	if err := saveRoom(fi.Room); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| @@ -85,14 +82,6 @@ func saveFullInfo(fi *models.FullInfo) error { | ||||
|  | ||||
| func notifyBotIfNeeded(fi *models.FullInfo) { | ||||
| 	if botName := fi.Room.WhichBotToMove(); botName != "" { | ||||
| 		// // get bot from memcache | ||||
| 		// bot, err := loadBot(botName, fi.Room.ID) | ||||
| 		// if err != nil { | ||||
| 		// 	log.Error("failed to load bot", "bot_name", botName, "room_id", fi.Room.ID) | ||||
| 		// 	// abortWithError(w, err.Error()) | ||||
| 		// 	// return | ||||
| 		// } | ||||
| 		// send signal to bot | ||||
| 		llmapi.SignalChanMap[botName] <- true | ||||
| 	} | ||||
| 	log.Debug("no bot", "room_id", fi.Room.ID) | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package handlers | ||||
|  | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"golias/llmapi" | ||||
| 	"golias/models" | ||||
| 	"html/template" | ||||
| @@ -147,7 +148,8 @@ func HandleAddBot(w http.ResponseWriter, r *http.Request) { | ||||
| 	} | ||||
| 	// TODO: what if bot exists already? | ||||
| 	// control number and names of bots | ||||
| 	bot, err := llmapi.NewBot(role, team, "bot1", fi.Room.ID, cfg) | ||||
| 	botname := fmt.Sprintf("bot_%d", len(llmapi.SignalChanMap)+1) // what if many rooms? | ||||
| 	bot, err := llmapi.NewBot(role, team, botname, fi.Room.ID, cfg) | ||||
| 	if err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder