alice v0.2.1 Alice.Conn

Alice.Conn defines a struct that is used throughout alice to hold state during the lifetime of a message handling.

An Alice.Conn struct contains 3 things: message, the incoming message that is currently being handled; slack, a data structure from the Slack library that holds all the information about the Slack instance; and state, which is the state of the bot that is persisted between messages. State defaults to an in-memory Map, but may be configured to be backed by Redis.

The Alice.Conn module also contains several helper functions that operate on Conn structs.

Summary

Functions

Used internally to add the regex captures to the message

Builds a string to use as an @reply back to the user who sent the message

Returns a boolean depending on whether or not the incoming message is a command

Used internally to delete namespaced state

Used internally to get namespaced state

Convenience function to make a new Alice.Conn struct

Used internally to put namespaced state

Returns the name of the user for the incoming message

Functions

add_captures(conn, pattern)

Used internally to add the regex captures to the message

at_reply_user(conn)

Builds a string to use as an @reply back to the user who sent the message

command?(conn)

Returns a boolean depending on whether or not the incoming message is a command

delete_state_for(conn, namespace)

Used internally to delete namespaced state

get_state_for(conn, namespace, default \\ nil)

Used internally to get namespaced state

make(arg)

Convenience function to make a new Alice.Conn struct

make(message, slack, state \\ %{})
put_state_for(conn, namespace, value)

Used internally to put namespaced state

user(conn)

Returns the name of the user for the incoming message