-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library for writing irc bots -- -- A library for writing irc bots @package ircbot @version 0.3.2 module Network.IRC.Bot.ErrorCodes noNicknameGiven :: String erroneusNickname :: String nicknameInUse :: String nickCollision :: String module Network.IRC.Bot.Log data LogLevel Debug :: LogLevel Normal :: LogLevel Important :: LogLevel type Logger = LogLevel -> String -> IO () stdoutLogger :: LogLevel -> Logger nullLogger :: Logger instance Typeable LogLevel instance Eq LogLevel instance Ord LogLevel instance Read LogLevel instance Show LogLevel instance Data LogLevel module Network.IRC.Bot.BotMonad newtype BotPartT m a BotPartT :: ReaderT BotEnv m a -> BotPartT m a unBotPartT :: BotPartT m a -> ReaderT BotEnv m a class (Functor m, MonadPlus m, MonadIO m) => BotMonad m askBotEnv :: BotMonad m => m BotEnv askMessage :: BotMonad m => m Message askOutChan :: BotMonad m => m (Chan Message) localMessage :: BotMonad m => (Message -> Message) -> m a -> m a sendMessage :: BotMonad m => Message -> m () logM :: BotMonad m => LogLevel -> String -> m () whoami :: BotMonad m => m String data BotEnv BotEnv :: Message -> Chan Message -> Logger -> String -> String -> BotEnv message :: BotEnv -> Message outChan :: BotEnv -> Chan Message logFn :: BotEnv -> Logger botName :: BotEnv -> String cmdPrefix :: BotEnv -> String runBotPartT :: BotPartT m a -> BotEnv -> m a mapBotPartT :: (m a -> n b) -> BotPartT m a -> BotPartT n b maybeZero :: MonadPlus m => Maybe a -> m a instance Applicative m => Applicative (BotPartT m) instance Alternative m => Alternative (BotPartT m) instance Functor m => Functor (BotPartT m) instance Monad m => Monad (BotPartT m) instance MonadFix m => MonadFix (BotPartT m) instance MonadPlus m => MonadPlus (BotPartT m) instance MonadTrans BotPartT instance MonadIO m => MonadIO (BotPartT m) instance MonadWriter w m => MonadWriter w (BotPartT m) instance MonadState s m => MonadState s (BotPartT m) instance MonadError e m => MonadError e (BotPartT m) instance MonadCont m => MonadCont (BotPartT m) instance (Functor m, MonadIO m, MonadPlus m) => BotMonad (BotPartT m) instance MonadRWS r w s m => MonadRWS r w s (BotPartT m) instance MonadReader r m => MonadReader r (BotPartT m) module Network.IRC.Bot.Commands cmd :: (Functor m, MonadPlus m, BotMonad m) => Command -> m () data Ping Ping :: HostName -> Ping ping :: (Functor m, MonadPlus m, BotMonad m) => m Ping data PrivMsg PrivMsg :: (Maybe Prefix) -> [String] -> String -> PrivMsg prefix :: PrivMsg -> (Maybe Prefix) receivers :: PrivMsg -> [String] msg :: PrivMsg -> String privMsg :: (Functor m, MonadPlus m, BotMonad m) => m PrivMsg toPrivMsg :: Message -> Maybe PrivMsg class ToMessage a toMessage :: ToMessage a => a -> Message sendCommand :: (ToMessage c, BotMonad m, Functor m) => c -> m () data Pong Pong :: HostName -> Pong -- | get the nickname of the user who sent the message askSenderNickName :: BotMonad m => m (Maybe String) -- | figure out who to reply to for a given Message -- -- If message was sent to a #channel reply to the channel. Otherwise -- reply to the sender. replyTo :: BotMonad m => m (Maybe String) -- | returns the receiver of a message -- -- if multiple receivers, it returns only the first askReceiver :: (Alternative m, BotMonad m) => m (Maybe String) instance Typeable Ping instance Typeable Pong instance Eq Ping instance Ord Ping instance Read Ping instance Show Ping instance Data Ping instance Eq PrivMsg instance Read PrivMsg instance Show PrivMsg instance Eq Pong instance Ord Pong instance Read Pong instance Show Pong instance Data Pong instance ToMessage PrivMsg instance ToMessage Pong module Network.IRC.Bot.PosixLogger posixLogger :: Maybe FilePath -> String -> Chan Message -> IO () module Network.IRC.Bot.Parsec mapParsecT :: (Monad m, Monad n) => (m (Consumed (m (Reply s u a))) -> n (Consumed (n (Reply s u b)))) -> ParsecT s u m a -> ParsecT s u n b -- | parse a positive integer nat :: Monad m => ParsecT String () m Integer -- | parser that checks for the cmdPrefix (from the BotEnv) botPrefix :: BotMonad m => ParsecT String () m () -- | create a bot part by using Parsec to parse the command -- -- The argument to parsecPart is a parser function. -- -- The argument to that parsec function is the target that the -- response should be sent to. -- -- The parser will receive the msg from the PrivMsg. -- -- see dicePart for an example usage. parsecPart :: BotMonad m => (ParsecT String () m a) -> m a reportError :: BotMonad m => String -> ParseError -> m () showErrorMessages :: String -> String -> String -> String -> String -> [Message] -> [String] instance (BotMonad m, Monad m) => BotMonad (ParsecT s u m) module Network.IRC.Bot.Types data User User :: String -> HostName -> HostName -> String -> User -- | username on client system username :: User -> String -- | hostname of client system hostname :: User -> HostName -- | irc server client is connected to servername :: User -> HostName -- | client's real name realname :: User -> String nullUser :: User instance Typeable User instance Data User instance Eq User instance Ord User instance Read User instance Show User module Network.IRC.Bot.Part.NickUser nickUserPart :: BotMonad m => m () changeNickUser :: BotMonad m => String -> Maybe User -> m () module Network.IRC.Bot.Core -- | simpleBot connects to the server and handles messages using the -- supplied BotPartTs -- -- the 'Chan Message' for the optional logging function will include all -- received and sent messages. This means that the bots output will be -- included in the logs. simpleBot :: BotConf -> [BotPartT IO ()] -> IO [ThreadId] -- | simpleBot' connects to the server and handles messages using the -- supplied BotPartTs -- -- the 'Chan Message' for the optional logging function will include all -- received and sent messages. This means that the bots output will be -- included in the logs. simpleBot' :: (Maybe (Chan Message -> IO ())) -> Logger -> HostName -> PortID -> String -> String -> User -> [BotPartT IO ()] -> IO [ThreadId] -- | Bot configuration data BotConf BotConf :: (Maybe (Chan Message -> IO ())) -> Logger -> HostName -> PortID -> String -> String -> User -> Set String -> BotConf -- | optional channel logging function channelLogger :: BotConf -> (Maybe (Chan Message -> IO ())) -- | app logging logger :: BotConf -> Logger -- | irc server to connect host :: BotConf -> HostName -- | irc port to connect to (usually, 'PortNumber 6667') port :: BotConf -> PortID -- | irc nick nick :: BotConf -> String -- | command prefix commandPrefix :: BotConf -> String -- | irc user info user :: BotConf -> User -- | channel to join channels :: BotConf -> Set String nullBotConf :: BotConf data User User :: String -> HostName -> HostName -> String -> User -- | username on client system username :: User -> String -- | hostname of client system hostname :: User -> HostName -- | irc server client is connected to servername :: User -> HostName -- | client's real name realname :: User -> String nullUser :: User module Network.IRC.Bot.Part.Channels initChannelsPart :: BotMonad m => Set String -> IO (TVar (Set String), m ()) channelsPart :: BotMonad m => TVar (Set String) -> m () joinChannel :: BotMonad m => String -> TVar (Set String) -> m () module Network.IRC.Bot.Part.Dice dicePart :: BotMonad m => m () diceCommand :: BotMonad m => ParsecT String () m () module Network.IRC.Bot.Part.Hello helloPart :: BotMonad m => m () helloCommand :: BotMonad m => ParsecT String () m () module Network.IRC.Bot.Part.Ping pingPart :: BotMonad m => m () module Network.IRC.Bot