|
|
|
@ -69,11 +69,12 @@ func chessCommand(m chat1.MsgSummary) {
@@ -69,11 +69,12 @@ func chessCommand(m chat1.MsgSummary) {
|
|
|
|
|
func showBoard(m chat1.MsgSummary, g *Game) { |
|
|
|
|
defer log.PanicSafe("showBoard") |
|
|
|
|
// create file
|
|
|
|
|
log.LogInfo("Creating file for %+v.svg", m.ConvID) |
|
|
|
|
f, err := os.Create(fmt.Sprintf("/home/chessbot/chessbot/games/%+v.svg", m.ConvID)) |
|
|
|
|
if err != nil { |
|
|
|
|
log.LogError(fmt.Sprintf("Error in ShowBoard os.Create: %+v\n", err)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.LogInfo("Creating board position (g.Game.Position().String())") |
|
|
|
|
// create board position
|
|
|
|
|
fenStr := g.Game.Position().String() |
|
|
|
|
pos := &chess.Position{} |
|
|
|
@ -95,6 +96,7 @@ func showBoard(m chat1.MsgSummary, g *Game) {
@@ -95,6 +96,7 @@ func showBoard(m chat1.MsgSummary, g *Game) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
log.LogInfo("Closing file.") |
|
|
|
|
f.Close() |
|
|
|
|
if svgToPNG(fmt.Sprintf("/home/chessbot/chessbot/games/%+v", m.ConvID)) { |
|
|
|
|
k.UploadToConversation(m.ConvID, "", fmt.Sprintf("/home/chessbot/chessbot/games/%+v.png", m.ConvID)) |
|
|
|
|