Improve module documentation
This commit is contained in:
parent
94df5fb8f2
commit
9adbc9e812
5 changed files with 38 additions and 4 deletions
|
|
@ -1,3 +1,24 @@
|
|||
-- | A bot library for <https://euphoria.io/ euphoria>.
|
||||
--
|
||||
-- If you're looking to write a bot, see the "EuphApi.Bot" module for more detail.
|
||||
-- There is also an
|
||||
-- <https://github.com/Garmelon/EuphApi/blob/master/test/bot_with_botrulez.hs example bot>
|
||||
-- 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"] <https://github.com/jedevc/botrulez 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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@
|
||||
--
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue