~singpolyma/cheogram

3ad0a8de8189baccb225015c7ca770521db12523 — Stephen Paul Weber 30 days ago 259ebb8
Log ad-hoc bot command error for debugging
1 files changed, 3 insertions(+), 1 deletions(-)

M Adhoc.hs
M Adhoc.hs => Adhoc.hs +3 -1
@@ 572,7 572,9 @@ adhocBotRunCommand db componentJid routeFrom sendMessage sendIQ getMessage from 
				| IQResult == iqType resultIQ,
				  [cmd] <- isNamed (s"{http://jabber.org/protocol/commands}command") =<< (justZ $ iqPayload resultIQ),
				  attributeText (s"status") cmd `elem` [Just (s"completed"), Just (s"canceled")] -> return ()
				| otherwise -> sendMessage $ mkSMS componentJid from (s"Command error")
				| otherwise -> do
					log "COMMAND ERROR" resultIQ
					sendMessage $ mkSMS componentJid from (s"Command error")
			Nothing -> sendMessage $ mkSMS componentJid from (s"Command timed out")

adhocBotSession :: (UIO.Unexceptional m) => DB.DB -> JID -> (XMPP.Message -> m ()) -> (XMPP.IQ -> UIO.UIO (STM (Maybe XMPP.IQ))) -> STM XMPP.Message -> XMPP.Message-> m ()