Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data BotApp model action = BotApp {
- botInitialModel :: model
- botAction :: Update -> model -> Maybe action
- botHandler :: action -> model -> Eff action model
- botJobs :: [BotJob model action]
- data BotJob model action = BotJob {
- botJobSchedule :: Text
- botJobTask :: model -> Eff action model
- data BotEnv model action = BotEnv {
- botModelVar :: TVar model
- botActionsQueue :: TQueue (Maybe Update, action)
- botClientEnv :: ClientEnv
- botUser :: User
- runJobTask :: BotEnv model action -> (model -> Eff action model) -> IO ()
- scheduleBotJob :: BotEnv model action -> BotJob model action -> IO [ThreadId]
- scheduleBotJobs :: BotEnv model action -> [BotJob model action] -> IO [ThreadId]
- defaultBotEnv :: BotApp model action -> ClientEnv -> IO (BotEnv model action)
- issueAction :: BotEnv model action -> Maybe Update -> Maybe action -> IO ()
- processAction :: BotApp model action -> BotEnv model action -> Maybe Update -> action -> ClientM ()
- processActionJob :: BotApp model action -> BotEnv model action -> ClientM ()
- processActionsIndefinitely :: BotApp model action -> BotEnv model action -> IO ThreadId
- startBotPolling :: BotApp model action -> BotEnv model action -> ClientM ()
- startPolling :: (Update -> ClientM a) -> ClientM a
Documentation
data BotApp model action Source #
A bot application.
BotApp | |
|
data BotJob model action Source #
A background bot job.
BotJob | |
|
data BotEnv model action Source #
An environment actual bot runs in.
BotEnv | |
|
runJobTask :: BotEnv model action -> (model -> Eff action model) -> IO () Source #
Run bot job task once.
scheduleBotJob :: BotEnv model action -> BotJob model action -> IO [ThreadId] Source #
Schedule a cron-like bot job.
scheduleBotJobs :: BotEnv model action -> [BotJob model action] -> IO [ThreadId] Source #
Schedule all bot jobs.
defaultBotEnv :: BotApp model action -> ClientEnv -> IO (BotEnv model action) Source #
Construct a default
for a bot.BotEnv
model action
issueAction :: BotEnv model action -> Maybe Update -> Maybe action -> IO () Source #
Issue a new action for the bot to process.
processAction :: BotApp model action -> BotEnv model action -> Maybe Update -> action -> ClientM () Source #
Process one action.
processActionJob :: BotApp model action -> BotEnv model action -> ClientM () Source #
A job to wait for the next action and process it.
processActionsIndefinitely :: BotApp model action -> BotEnv model action -> IO ThreadId Source #
Process incoming actions indefinitely.
startBotPolling :: BotApp model action -> BotEnv model action -> ClientM () Source #
Start Update
polling for a bot.
startPolling :: (Update -> ClientM a) -> ClientM a Source #
Start Update
polling with a given update handler.