habit-0.2.2.0: Haskell message bot framework

CopyrightAlexander Krupenkin 2017
LicenseBSD3
Maintainermail@akru.me
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Web.Bot.Platform

Description

Bot platform type class.

Synopsis

Documentation

data Bot a b Source #

Message bot monad

Instances

MonadBaseControl IO (Bot a) Source # 

Associated Types

type StM (Bot a :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (Bot a) IO -> IO a) -> Bot a a #

restoreM :: StM (Bot a) a -> Bot a a #

MonadBase IO (Bot a) Source # 

Methods

liftBase :: IO α -> Bot a α #

Monad (Bot a) Source # 

Methods

(>>=) :: Bot a a -> (a -> Bot a b) -> Bot a b #

(>>) :: Bot a a -> Bot a b -> Bot a b #

return :: a -> Bot a a #

fail :: String -> Bot a a #

Functor (Bot a) Source # 

Methods

fmap :: (a -> b) -> Bot a a -> Bot a b #

(<$) :: a -> Bot a b -> Bot a a #

Applicative (Bot a) Source # 

Methods

pure :: a -> Bot a a #

(<*>) :: Bot a (a -> b) -> Bot a a -> Bot a b #

(*>) :: Bot a a -> Bot a b -> Bot a b #

(<*) :: Bot a a -> Bot a b -> Bot a a #

MonadIO (Bot a) Source # 

Methods

liftIO :: IO a -> Bot a a #

MonadLogger (Bot a) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Bot a () #

type StM (Bot a) b Source # 
type StM (Bot a) b = b

class Platform a where Source #

Message bot platform. Different platforms provide message bot API, e.g. Telegram, Viber, Facebook Messenger etc. This is generalized interface to it.

Minimal complete definition

trySelf, sendMessage, messageHandler, platformName

Methods

trySelf :: APIToken a => Bot a () Source #

Try connection to platform API

sendMessage :: (ToMessage msg, APIToken a) => User -> msg -> Bot a () Source #

Send message to user by platform API

messageHandler :: APIToken a => (User -> Message -> Bot a b) -> Bot a c Source #

Get user updates by platform API

platformName :: a -> Text Source #

Short description of platform

class Platform a => APIToken a where Source #

Bot authentification in platform Instance of it should be writen by user

Minimal complete definition

apiToken

Methods

apiToken :: Bot a Text Source #

Platform API token

getManager :: Bot a Manager Source #

TCP-connection manager getter

forkFinallyBot :: APIToken a => Bot a b -> (Either SomeException b -> IO ()) -> Bot a ThreadId Source #

Fork bot thread with finalizer

forkBot :: APIToken a => Bot a () -> Bot a ThreadId Source #

Fork bot thread

runBot :: (APIToken a, MonadIO m) => Bot a b -> m b Source #

Run bot monad