diff --git a/src/EuphApi.hs b/src/EuphApi.hs index 8f4b603..1b40506 100644 --- a/src/EuphApi.hs +++ b/src/EuphApi.hs @@ -1,3 +1,24 @@ +-- | A bot library for . +-- +-- If you're looking to write a bot, see the "EuphApi.Bot" module for more detail. +-- There is also an +-- +-- in the /test/ directory. +-- +-- If you want api bindings for euphoria without any of the bot stuff, see the +-- "Euphoria.Connection" module. +-- +-- = Overview of the modules +-- +-- ["EuphApi"] Reexports a few modules useful for creating bots. +-- ["EuphApi.Bot"] Bot structure and info on how to create bots. +-- ["EuphApi.Connection"] \"Raw\" API bindings. +-- ["EuphApi.Types"] Some common types for the API. +-- ["EuphApi.Utils"] Reexports a few util modules useful for creating bots. +-- ["EuphApi.Utils.Botrulez"] commands. +-- ["EuphApi.Utils.Commands"] General and specific bot commands. +-- ["EuphApi.Utils.Misc"] Functions for dealing with nicks and time formats. + module EuphApi ( module EuphApi.Bot , module EuphApi.Types diff --git a/src/EuphApi/Utils.hs b/src/EuphApi/Utils.hs index 930ce56..6840b53 100644 --- a/src/EuphApi/Utils.hs +++ b/src/EuphApi/Utils.hs @@ -1,7 +1,12 @@ +-- | This module re-exports the most useful functions for creating bots. +-- For a more detailed overview of the modules, see "EuphApi". + module EuphApi.Utils - ( module EuphApi.Utils.Misc + ( module EuphApi.Utils.Botrulez , module EuphApi.Utils.Commands + , module EuphApi.Utils.Misc ) where +import EuphApi.Utils.Botrulez import EuphApi.Utils.Commands import EuphApi.Utils.Misc diff --git a/src/EuphApi/Utils/Botrulez.hs b/src/EuphApi/Utils/Botrulez.hs index a9c9336..519c238 100644 --- a/src/EuphApi/Utils/Botrulez.hs +++ b/src/EuphApi/Utils/Botrulez.hs @@ -24,7 +24,8 @@ import Data.Time import qualified EuphApi.Bot as E import qualified EuphApi.Types as E -import qualified EuphApi.Utils as E +import qualified EuphApi.Utils.Commands as E +import qualified EuphApi.Utils.Misc as E -- | Specific ping command: @!ping \@botname@ -- diff --git a/src/EuphApi/Utils/Commands.hs b/src/EuphApi/Utils/Commands.hs index e2c25bb..6cb5f89 100644 --- a/src/EuphApi/Utils/Commands.hs +++ b/src/EuphApi/Utils/Commands.hs @@ -1,5 +1,12 @@ {-# LANGUAGE OverloadedStrings #-} +-- | This module helps with letting bots respond to commands. +-- It supports general and specific commands. +-- +-- If you want your bot to react to things other than commands like @!command@, +-- have a look at the 'commandFromParser' function and the parsers below. +-- It may often be easier to write a simple parser than to use regular expressions. + module EuphApi.Utils.Commands ( Command , CommandName diff --git a/src/EuphApi/Utils/Misc.hs b/src/EuphApi/Utils/Misc.hs index 41c3e0c..c79bfcb 100644 --- a/src/EuphApi/Utils/Misc.hs +++ b/src/EuphApi/Utils/Misc.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE OverloadedStrings #-} +-- | Miscellaneous utility functions for bots. module EuphApi.Utils.Misc ( -- * Nick manipulation @@ -28,7 +28,7 @@ import Data.Time -- This removes spaces and some extra characters, while trying to stay close to -- the original nick. mention :: T.Text -> T.Text -mention = T.filter (\c -> not (isSpace c) && notElem c (".!?;&<'\"" :: String)) +mention = T.filter (\c -> not (isSpace c) && notElem c ".!?;&<'\"") -- | Same as 'atMention', but prepends an `@` character. atMention :: T.Text -> T.Text