Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides access functions for working with the state stored within a bot session.
- askConfig :: Session e s Config
- askConfigS :: (Config -> a) -> Session e s a
- askBehavior :: Session e s (Behavior e s)
- askBehaviorS :: (Behavior e s -> a) -> Session e s a
- askTimeGetter :: Session e s (IO (UTCTime, String))
- askEnv :: Session e s e
- askEnvS :: (e -> a) -> Session e s a
- getState :: Session e s s
- getStateS :: (s -> a) -> Session e s a
- putState :: s -> Session e s ()
- modifyState :: (s -> s) -> Session e s ()
- getChannelState :: Session e s (HashMap String (Bool, Bool))
- saveBotState :: Session e s ()
Documentation
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.
getStateS :: (s -> a) -> Session e s a Source
Get a specific component of the state, using a projection function supplied.
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.
saveBotState :: Session e s () Source