Closed kendricktan closed 7 years ago
Solved it, credits to @TRManderson
testTo :: Command -> IO Text
testTo cmd = do
putStrLn ("+ Incoming command: " <> show cmd)
config <- slackConfig
message <- runExceptT (messageOfCommand cmd)
case (debug, message) of
(False, Right m) -> do
putStrLn ("+ Outgoing message: " <> show (encode m))
eitherResult <- runExceptT $ say m config
case eitherResult of
(Left e) -> return "error"
(Right _) -> return ""
return ""
(False, Left e) ->
return ("popslave encountered an error " <> (e ^. packed))
(True, Right m) -> do
putStrLn ("+ Outgoing message: " <> show (encode m))
return ""
(True, Left e) -> do
putStrLn ("+ Outgoing ERROR: " <> e)
return ""
where debug = False
I'm just trying to make a very simple 'EchoBot' that echos whatever the input query is. E.g.
/echo hello
. Bot replies withhello
.However, I'm having some trouble replying to the user, I'm getting this error on compile:
Code:
Any help would be appreciated.