From 7ca63192445137fc7ffb5a63fcfe4ab4afb2660e Mon Sep 17 00:00:00 2001 From: semblanceofsense Date: Sat, 1 Feb 2025 12:04:30 -0700 Subject: [PATCH] Reimplemnt slash command --- internal/bot/bot.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/bot/bot.go b/internal/bot/bot.go index 4f914a6..b42a26f 100644 --- a/internal/bot/bot.go +++ b/internal/bot/bot.go @@ -50,8 +50,19 @@ func Run(BotToken string) { switch data.Name { case "solve-maze": - - } + maze, err := getMaze.GetMaze(i.ApplicationCommandData().Options[0].Value.(string)) + if err != nil { + responseData = "You must provide an image! Select the maze, click \"open in browser\", and copy the link of the image" + } else { + if (len(maze) < 1) { + responseData = "You must provide an image! Select the maze, click \"open in browser\", and copy the link of the image" + } else { + points := solvemaze.FindPath(maze) + if (len(points) < 1) { + responseData = "You must provide an image! Select the maze, click \"open in browser\", and copy the link of the image" + } else { + outputmaze.EditMaze(points, "/tmp/maze.png", "/tmp/outputmaze.png") + }}}} if responseData != "" { err = s.InteractionRespond(