Copyright | Alexander Krupenkin 2016 |
---|---|
License | BSD3 |
Maintainer | email@something.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- module Web.Telegram.API.Bot.Data
- class ToBotMessage a where
- data BotMessage
- class BotConfig a where
- class Answer a where
- newtype Token :: * = Token Text
- type StoryT = Pipe Message BotMessage
- type Story a = (User, Chat) -> StoryT (Bot a) BotMessage
- select :: (MonadIO m, Answer a) => Text -> [[Text]] -> StoryT m a
- replica :: (ToBotMessage a, MonadIO m, Answer b) => a -> StoryT m b
- question :: (MonadIO m, Answer a) => Text -> StoryT m a
- sendMessageBot :: BotConfig a => Chat -> BotMessage -> Bot a ()
- storyBot :: (BotConfig a, ToBotMessage help) => help -> Map Text (Story a) -> Bot a ()
- forkBot :: BotConfig a => Bot a () -> Bot a ThreadId
- runBot :: BotConfig a => a -> Bot a b -> IO b
- lift :: MonadTrans t => forall m a. Monad m => m a -> t m a
Exported types
API types
module Web.Telegram.API.Bot.Data
Story types
class ToBotMessage a where Source #
Bot message typeclass for conversion.
toMessage :: a -> BotMessage Source #
ToBotMessage Text Source # | Simple text question send text message from bot |
ToBotMessage BotMessage Source # | Idenity instance |
data BotMessage Source #
Bot message data.
Show BotMessage Source # | |
ToBotMessage BotMessage Source # | Idenity instance |
The value can be passed to story handler function.
Telegram Bot's Token
type Story a = (User, Chat) -> StoryT (Bot a) BotMessage Source #
Story is a pipe from user message to bot message and result is a final message bot.
Story makers
replica :: (ToBotMessage a, MonadIO m, Answer b) => a -> StoryT m b Source #
Generalized story maker. The replica send to user, when answer isn't parsed the error send to user and waiting for correct answer.
Bot runners
sendMessageBot :: BotConfig a => Chat -> BotMessage -> Bot a () Source #
storyBot :: (BotConfig a, ToBotMessage help) => help -> Map Text (Story a) -> Bot a () Source #
User story handler
Re-exports
lift :: MonadTrans t => forall m a. Monad m => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.