- # toSend = case cmd of
- ["stop":_] = Nothing
- ["ping":_] = Just [msg "pong"]
- ["help":_] = Just [msg "not implemented yet"]
- [c:_] = Just [msg $ join " " ["unknown command: " , c, ", type !help to get help"]]
+ # (w, toSend) = case cmd of
+ ["stop":_] = (w, Nothing)
+ ["ping":xs] = (w, Just [msg $ "pong " +++ join " " xs])
+ ["short"] = (w, Just [msg $ "short requires an url argument"])
+ ["short":xs]
+ # (s, w) = shorten (join " " xs) w
+ = (w, Just [msg s])
+ ["help"] = (w, Just
+ [msg "type !help cmd for command specific help"
+ ,msg "available commands: help, short, ping"])
+ ["help":c:_] = (w, case c of
+ "help" = Just [msg "help [CMD] - I will print general help or the help of CMD"]
+ "short" = Just [msg "short URL - I will give the url to https://cloo.gl shortening service and post back the result"]
+ "ping" = Just [msg "ping [TXT] - I will reply with pong and the optionar TXT"]
+ _ = Just [msg "Unknown command"])
+ [c:_] = (w, Just [msg $ join " " ["unknown command: " , c, ", type !help to get help"]])