lambdabot-reference-plugins 5.1 → 5.1.0.1
raw patch · 4 files changed
+21/−5 lines, 4 files
Files
- lambdabot-reference-plugins.cabal +2/−2
- src/Lambdabot/Plugin/Reference/OEIS.hs +17/−1
- src/Lambdabot/Plugin/Reference/Search.hs +1/−1
- src/Lambdabot/Util/Browser.hs +1/−1
lambdabot-reference-plugins.cabal view
@@ -1,5 +1,5 @@ name: lambdabot-reference-plugins-version: 5.1+version: 5.1.0.1 license: GPL license-file: LICENSE@@ -30,7 +30,7 @@ . [where] Manage and query a key-URL list. -homepage: http://haskell.org/haskellwiki/Lambdabot+homepage: https://wiki.haskell.org/Lambdabot build-type: Simple cabal-version: >= 1.8
src/Lambdabot/Plugin/Reference/OEIS.hs view
@@ -5,6 +5,7 @@ import Lambdabot.Plugin import Math.OEIS+import Data.Char oeisPlugin :: Module () oeisPlugin = newModule@@ -12,7 +13,22 @@ [ (command "oeis") { aliases = ["sequence"] , help = say "oeis <sequence>. Look up a sequence in the Online Encyclopedia of Integer Sequences"- , process = ios80 . fmap concat . lookupOEIS+ , process = ios80 . lookupOEIS' } ] }++lookupOEIS' :: String -> IO String+lookupOEIS' a = do+ let a' = commas . reverse . dropWhile isSpace . reverse . dropWhile isSpace $ a+ x <- searchSequence_IO a'+ case x of+ Nothing -> return "Sequence not found."+ Just s -> return $ unlines [+ concat ("https://oeis.org/" : take 1 (catalogNums s)) +++ ' ' : description s,+ show $ sequenceData s]+ where+ commas [] = []+ commas (x:' ':xs) | isDigit x = x : ',' : commas xs+ commas (x:xs) = x : commas xs
src/Lambdabot/Plugin/Reference/Search.hs view
@@ -26,7 +26,7 @@ [("google", (googleUri, (\s -> "?hl=en&q="++s++"&btnI=I'm+Feeling+Lucky"), googleHeaders)), -- ("wikipedia", (wikipediaUri, ("?search="++), [])), -- this has changed and Wikipedia requires a User-Agent string ("gsite", (googleUri, (\s -> "?hl=en&q=site%3A"++s++"&btnI=I'm+Feeling+Lucky"), googleHeaders)),- ("gwiki", (googleUri, (\s -> "?hl=en&q=site%3Ahaskell.org/haskellwiki+" ++s++"&btnI=I'm+Feeling+Lucky"), googleHeaders))+ ("gwiki", (googleUri, (\s -> "?hl=en&q=site%3Awiki.haskell.org+" ++s++"&btnI=I'm+Feeling+Lucky"), googleHeaders)) ] googleHeaders :: [Header]
src/Lambdabot/Util/Browser.hs view
@@ -29,7 +29,7 @@ liftIO . browse $ do setOutHandler (const (return ())) setErrHandler (const (return ()))- + setAllowRedirects True setMaxRedirects (Just 5) setProxy proxy'