Current section
Files
Jump to
Current section
Files
lib/butler.ex
defmodule Butler do
@moduledoc ~S"""
Butler is a life betterment robot.
He is split into two main groups:
* `Butler.Adapter` - adapters allow butler to communicate with other
protocols and communications platforms.
* `Butler.Plugin` - plugins are what empower butler. They provide an api
to respond to specific commands and perform actions and replies.
## Adapters
`Butler.Adapter` is a generic behaviour that allows Butler to support
multiple chat platforms. There are two officialy supported adapters:
* `Butler.Adapters.Console` - used for local development.
* `Butler.Adapters.Slack` - for the slack chat platform.
You can read more about developing adapters in `Butler.Adapter`.
## Plugins
`Butler.Plugin` provides an api for developers to add functionality to
Butler. Plugins listen to events emitted by Butler and can choose to respond
or not. Here is an example plugin:
defmodule Butler.Plugins.TestCount do
use Butler.Plugin
respond ~r/test count/, conn do
count = Butler.Bot.get(:test_count)
reply conn, "The count is #{count}"
end
hear ~r/test/, conn do
say conn, "I heard some tests"
end
end
If you want to read more about creating your own plugins in `Butler.Plugin`.
"""
use Application
@doc """
Starts Butler.
"""
def start(_type, _opts \\ []) do
Butler.Supervisor.start_link()
end
@doc """
Stops Butler.
"""
def stop(_) do
IO.puts "Cheerio"
end
end