packages feed

tellbot 0.4.0.4 → 0.5.1

raw patch · 3 files changed

+30/−13 lines, 3 filesdep +http-conduitdep +regex-posixdep ~base

Dependencies added: http-conduit, regex-posix

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -1,6 +1,10 @@ tellbot CHANGELOG ================= +### 0.5.1++- added an URL parser to detect what it contains+ ### 0.5  - dependencies updated.
src/Main.hs view
@@ -9,15 +9,18 @@ import Data.Char ( toLower ) import Data.List ( intersperse ) import Data.List.Split ( chunksOf, splitOn )+import Data.Foldable ( traverse_ ) import Data.Time.Clock ( getCurrentTime, utctDay ) import Data.Version import qualified Data.Map as M+import HTML import Network+import Text.Regex.Posix ( (=~) ) import System.Environment ( getArgs ) import System.IO  version :: Version-version = Version [0,4,0,4] ["Boorey"]+version = Version [0,5,1,0] ["Apfelschorle"]  type Failable   = EitherT String Identity type FailableIO = EitherT String IO@@ -182,13 +185,21 @@ treatMsg :: String -> Session () treatMsg msg = do     nick <- asks conNick+    chan <- asks conChan     liftIO . putStrLn $ "from: " ++ fromNick ++ ", to: " ++ to ++ ": " ++ content-    unless ( null content || Nick fromNick == Nick nick ) $ do+    unless (null content || Nick fromNick == Nick nick) $ do       tellStories fromNick-      when ( head content == '!') $ do+      let url = extractUrl content+      unless (null url) $ do+        title <- liftIO $ htmlTitle url+        traverse_ (\t -> msgIRC chan $ "« " ++ t ++ " »") title+      when (head content == '!') $ do         onCmd fromNick to (tail content)   where     (fromNick,to,content) = emitterRecipientContent msg++extractUrl :: String -> String+extractUrl = (=~ "https?://[^ ]+")  treatJoin :: String -> Session () treatJoin _ = do
tellbot.cabal view
@@ -1,5 +1,5 @@ name:                tellbot-version:             0.4.0.4+version:             0.5.1 synopsis:            IRC tellbot description:         An IRC bot that can be used to create queuing message.                      It also offers a simple administration IRC bot interface.@@ -22,15 +22,17 @@    default-extensions:  FlexibleInstances -  build-depends:       base         >= 4.5 && < 4.8-                     , network      >= 2.4 && < 2.7-                     , errors       >= 1.4 && < 1.5-                     , mtl          >= 2.1 && < 2.3-                     , transformers >= 0.3 && < 0.5-                     , split        >= 0.2 && < 0.3-                     , containers   >= 0.4 && < 0.6-                     , bifunctors   >= 4.1 && < 4.3-                     , time         >= 1.4 && < 1.6+  build-depends:       base         >= 4.5  && < 5+                     , network      >= 2.4  && < 2.7+                     , errors       >= 1.4  && < 1.5+                     , mtl          >= 2.1  && < 2.3+                     , transformers >= 0.3  && < 0.5+                     , split        >= 0.2  && < 0.3+                     , containers   >= 0.4  && < 0.6+                     , bifunctors   >= 4.1  && < 4.3+                     , time         >= 1.4  && < 1.6+                     , http-conduit >= 2.1  && < 2.2+                     , regex-posix  >= 0.95 && < 0.96    hs-source-dirs:      src