| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Web.Slack
Description
This module exposes functionality to write bots which responds
to Events sent by the RTM API. By using the user state parameter s
complicated interactions can be established.
This basic example echos every message the bot recieves.
Other examples can be found in the
examples directory.
myConfig :: SlackConfig
myConfig = SlackConfig
{ _slackApiToken = "..." -- Specify your API token here
}
-- type SlackBot s = Event -> Slack s ()
echoBot :: SlackBot ()
echoBot (Message cid _ msg _ _ _) = sendMessage cid msg
echoBot _ = return ()
main :: IO ()
main = runBot myConfig echoBot ()- runBot :: forall s. SlackConfig -> SlackBot s -> s -> IO ()
- newtype Slack s a = Slack {
- runSlack :: StateT (SlackState s) IO a
- type SlackBot s = Event -> Slack s ()
- data SlackState s = SlackState {
- _meta :: Metainfo
- _session :: SlackSession
- _userState :: s
- _config :: SlackConfig
- userState :: forall s s. Lens (SlackState s) (SlackState s) s s
- session :: forall s. Lens' (SlackState s) SlackSession
- module Web.Slack.Types
- data SlackConfig = SlackConfig {}
Documentation
Constructors
| Slack | |
Fields
| |
data SlackState s Source #
Constructors
| SlackState | |
Fields
| |
Instances
| Show s => Show (SlackState s) Source # | |
| MonadState (SlackState s) (Slack s) Source # | |
userState :: forall s s. Lens (SlackState s) (SlackState s) s s Source #
session :: forall s. Lens' (SlackState s) SlackSession Source #
module Web.Slack.Types
data SlackConfig Source #
Configuration options needed to connect to the Slack API
Constructors
| SlackConfig | |
Fields
| |
Instances