irc-fun-bot-0.2.0.0: Library for writing fun IRC bots.

Safe HaskellNone
LanguageHaskell2010

Network.IRC.Fun.Bot.State

Description

This module provides access functions for working with the state stored within a bot session.

Synopsis

Documentation

askConfig :: Session e s Config Source

Fetch the bot configuration.

askConfigS :: (Config -> a) -> Session e s a Source

Retrieve a function of the bot configuration.

askBehavior :: Session e s (Behavior e s) Source

Fetch the bot behavior definition.

askBehaviorS :: (Behavior e s -> a) -> Session e s a Source

Retrieve a function of the bot behavior definition.

askTimeGetter :: Session e s (IO (UTCTime, String)) Source

Fetch the time getter. The actual time data is cached and updated at most once per second depending on need. You can safely use it at any frequency withou overloading IO and time formatting.

The second item is a formatted time string in the form 2015-09-01 18:10:00, and is always expressed in UTC.

askEnv :: Session e s e Source

Fetch the bot environment, i.e. read-only state.

askEnvS :: (e -> a) -> Session e s a Source

Retrieve a function of the bot environment.

getState :: Session e s s Source

Fetch the current value of the state within the session.

getStateS :: (s -> a) -> Session e s a Source

Get a specific component of the state, using a projection function supplied.

putState :: s -> Session e s () Source

Set the state within the session.

modifyState :: (s -> s) -> Session e s () Source

Update the state to the result of applying a function to the current state.

getChannelState :: Session e s (HashMap String (Bool, Bool)) Source

Get channel state information, in the form of a mapping from channel names to their data.

Channel data is a pair of two booleans. The first says whether channel tracking is enabled. The second says whether channel logging info a file is enabled.