Improve module documentation
This commit is contained in:
parent
94df5fb8f2
commit
9adbc9e812
5 changed files with 38 additions and 4 deletions
|
|
@ -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