Alpha. The API is complete and everything is implemented, but little testing has been done (I've tested the API against my own local IRC server, but nothing robust enough to call this production ready). Any bugs you find, please report them in the issue tracker and I'll address them as soon as possible. If you have any questions, or if the documentation seems incomplete, let me know and I'll fill it in.
## Getting Started
Add ExIrc as a dependency to your project in mix.exs, and add it as an application:
```elixir
defp deps do
- [{:exirc, "~> 0.7.0"}]
+ [{:exirc, "~> 0.7.2"}]
end
defp application do
[applications: [:exirc],
...]
end
```
Then fetch it using `mix deps.get`.
To use ExIrc, you need to start a new client process, and add event handlers. An example event handler module
is located in `lib/exirc/example_handler.ex`. **The example handler is kept up to date with all events you can
expect to receive from the client**. A simple module is defined below as an example of how you might
use ExIrc in practice. ExampleHandler here is the one that comes bundled with ExIrc.
```elixir
defmodule ExampleSupervisor do
defmodule State do
defstruct host: "chat.freenode.net",
port: 6667,
pass: "",
nick: "bitwalker",
user: "bitwalker",
name: "Paul Schoenfelder",
client: nil,
handlers: []
end
def start_link(_) do
:gen_server.start_link(__MODULE__, [%State{}])
end
def init(state) do
# Start the client and handler processes, the ExIrc supervisor is automatically started when your app runs
{:ok, client} = ExIrc.start_client!()
{:ok, handler} = ExampleHandler.start_link(nil)
# Register the event handler with ExIrc
ExIrc.Client.add_handler client, handler
# Connect and logon to a server, join a channel and send a simple message