| Copyright | (c) Justus Adam 2016 |
|---|---|
| License | BSD3 |
| Maintainer | dev@justus.science |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Marvin.Adapter
Description
- data Event
- type RunWithAdapter a = Config -> InitEventHandler a -> RunnerM ()
- type EventHandler a = Event -> IO ()
- type InitEventHandler a = a -> IO (EventHandler a)
- type RunnerM = LoggingT IO
- class IsAdapter a where
- liftAdapterAction :: MonadIO m => RunnerM a -> m a
Documentation
Representation for the types of events which can occur
type RunWithAdapter a = Config -> InitEventHandler a -> RunnerM () Source #
type EventHandler a = Event -> IO () Source #
type InitEventHandler a = a -> IO (EventHandler a) Source #
class IsAdapter a where Source #
Basic functionality required of any adapter
Minimal complete definition
adapterId, messageChannel, runWithAdapter, getUsername, getChannelName, resolveChannel
Methods
adapterId :: AdapterId a Source #
Used for scoping config and logging
messageChannel :: a -> Channel -> Text -> RunnerM () Source #
Post a message to a channel given the internal channel identifier
runWithAdapter :: RunWithAdapter a Source #
Initialize and run the bot
getUsername :: a -> User -> RunnerM Text Source #
Resolve a username given the internal user identifier
getChannelName :: a -> Channel -> RunnerM Text Source #
Resolve the human readable name for a channel given the internal channel identifier
resolveChannel :: a -> Text -> RunnerM (Maybe Channel) Source #
Resolve to the internal channel identifier given a human readable name
Instances
liftAdapterAction :: MonadIO m => RunnerM a -> m a Source #