| 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 a
- = MessageEvent (Message a)
- | ChannelJoinEvent (User a) (Channel a)
- | ChannelLeaveEvent (User a) (Channel a)
- | TopicChangeEvent Text (Channel a)
- type RunWithAdapter a = Config -> InitEventHandler a -> RunnerM ()
- type EventHandler a = Event a -> IO ()
- type InitEventHandler a = a -> IO (EventHandler a)
- type RunnerM = LoggingT IO
- class IsAdapter a where
- data AdapterId a
- liftAdapterAction :: MonadIO m => RunnerM a -> m a
Documentation
Representation for the types of events which can occur
Constructors
| MessageEvent (Message a) | |
| ChannelJoinEvent (User a) (Channel a) | |
| ChannelLeaveEvent (User a) (Channel a) | |
| TopicChangeEvent Text (Channel a) |
type RunWithAdapter a = Config -> InitEventHandler a -> RunnerM () Source #
type EventHandler a = Event a -> 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 a -> 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 a -> RunnerM Text Source #
Resolve a username given the internal user identifier
getChannelName :: a -> Channel a -> RunnerM Text Source #
Resolve the human readable name for a channel given the internal channel identifier
resolveChannel :: a -> Text -> RunnerM (Maybe (Channel a)) Source #
Resolve to the internal channel identifier given a human readable name
Instances
| MkSlack a => IsAdapter (SlackAdapter a) Source # | |
| MkTelegram a => IsAdapter (TelegramAdapter a) Source # | |
A type, basically a String, which identifies an adapter to the config and the logging facilities.
liftAdapterAction :: MonadIO m => RunnerM a -> m a Source #