linklater-1.0.0.3: Write bots for your Slack account, and then go to sleep (because it's so easy and late at night)

Safe HaskellNone

Network.Linklater

Synopsis

Documentation

say :: Message -> Config -> IO (Response ByteString)Source

The say function posts a Message, with a capital M, to Slack. It'll, ahem, need your token first though.

slash :: (Maybe Command -> Application) -> ApplicationSource

A bot server! As if by magic. This acts like a WAI middleware in that you let us wrap around your application.

data Channel Source

Where slash commands can come from, and where messages can go.

Constructors

GroupChannel Text

A public or private group.

IMChannel Text

A private conversation with your best friend (or lover?).

newtype User Source

A username: no at-signs, just text!

Constructors

User Text 

Instances

data Message Source

Here's how you talk.

Constructors

Message 

Fields

_messageChannel :: Channel

You need a channel. It can be a group channel or a private IM. Alert: if it's a private IM, it'll look like it came from slackbot (as of writing).

_messageText :: Text

What you want to say. This will be parsed in full (parse=full). In the future I'll support other forms of parsing, hopefully. Poke me with a pull request if I forget.

_messageIcon :: Icon

The icon you want your message to appear as.

data Config Source

Like a curiosity about the world, you'll need one of these to say something.

Constructors

Config 

Fields

_configIncomingHookToken :: Text

This is the incoming web hook token that Slack gave you. It's usually a long alphanumberic string of garbage.

_configHostname :: Text

This is where your Slack account is hosted. For example, 'trello.slack.com'.

data Command Source

Incoming HTTP requests to the slash function get parsed into one of these babies.

Constructors

Command 

Fields

_commandUser :: User

Who ran your slash command.

_commandChannel :: Channel

Where the person ran your slash command.

_commandText :: Maybe Text

Text for the slash command, if any.

newtype Icon Source

For example, :stars2:. Future versions should support actual images, I GUESS.

Constructors

EmojiIcon Text 

Instances