@@ -47,25 +47,28 @@ runBot yogaToken discordToken = do
47 messageUpdatedHandler _ msg = printErrors msg do
47 messageUpdatedHandler _ msg = printErrors msg do
48 when (isMention msg.content) do
48 when (isMention msg.content) do
49 msg # react rewindEmoji
49 msg # react rewindEmoji
50− messageHandler msg
50+ evaluate msg (pure unit)
52− messageHandler msg@{ content, channel } = printErrors msg do
52+ messageHandler msg = printErrors msg do
53− when (isMention content) do
53+ when (isMention msg.content) do
54− case parseCodeBlock content of
56− sendBasicInstructions msg
54+ evaluate msg (sendBasicInstructions msg)
56+ evaluate msg@{ content, channel } doNothing = do
57+ case parseCodeBlock content of
57− Just code -> do
60+ Just code -> do
58− res <- compileAndRun yogaToken { code: prepareCode code }
61+ res <- compileAndRun yogaToken { code: prepareCode code }
59− case res of
62+ case res of
60− Left cr -> sendCompileProblem msg code cr
63+ Left cr -> sendCompileProblem msg code cr
61− Right rr -> case NES.fromString rr.stdout, NES.fromString rr.stderr of
64+ Right rr -> case NES.fromString rr.stdout, NES.fromString rr.stderr of
62− Just _, _ -> do
65+ Just _, _ -> do
63− msg # react robotMuscleEmoji
66+ msg # react robotMuscleEmoji
64− channel # sendString (NonEmptyString (prepareOutput rr.stdout))
67+ channel # sendString (NonEmptyString (prepareOutput rr.stdout))
65− Nothing, Just _ -> do
68+ Nothing, Just _ -> do
66− msg # react sirenEmoji
69+ msg # react sirenEmoji
67− sendRunProblem msg code rr.stderr
70+ sendRunProblem msg code rr.stderr
68− _, _ -> channel # sendString (NonEmptyString "Something is weird")
71+ _, _ -> channel # sendString (NonEmptyString "Something is weird")
70sendBasicInstructions :: Message -> Aff Unit
73sendBasicInstructions :: Message -> Aff Unit
71sendBasicInstructions msg = do
74sendBasicInstructions msg = do