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