ExBot v0.1.1 ExBot.Bot behaviour

This module can be use-d into a module in order to define a Slack bot. It also includes functions for sending messages and events from a bot to a slack channel.

Link to this section Summary

Functions

Sends an arbitrary JSON payload to Slack from a bot

Sends a message from a bot to a channel, identified by id

Sends a message from a bot to a channel, identified by name

Link to this section Types

Link to this type state()
state() :: %{optional(atom()) => any()}
Link to this type t()
t() :: module()

Link to this section Functions

Link to this function send_event(bot, event)
send_event(t(), %{optional(atom()) => any()}) :: any()

Sends an arbitrary JSON payload to Slack from a bot.

Example

ExBot.Bot.send_event(MyBot, %{type: "message", channel: "C0G9QF9GW", text: "Hello world"})
Link to this function send_text(bot, channel_id, text)
send_text(t(), String.t(), String.t()) :: any()

Sends a message from a bot to a channel, identified by id.

Example

ExBot.Bot.send_text(MyBot, "C0G9QF9GW", "Hello world")
Link to this function send_to_channel(bot, channel_name, msg)
send_to_channel(t(), String.t(), String.t()) :: any()

Sends a message from a bot to a channel, identified by name.

Example

ExBot.Bot.send_to_channel(MyBot, "general", "Hello world")

Link to this section Callbacks

Link to this callback on_connect(state) (optional)
on_connect(state :: state()) :: {atom(), state()}