exirc v2.0.0 ExampleHandler
This is an example event handler that you can attach to the client using
add_handler
or add_handler_async
. To remove, call remove_handler
or
remove_handler_async
with the pid of the handler process.
Link to this section Summary
Link to this section Functions
Link to this function
handle_info(msg, state)
Handle messages from the client
Examples:
def handle_info({:connected, server, port}, _state) do
IO.puts "Connected to #{server}:#{port}"
end def handle_info(:logged_in, _state) do
IO.puts "Logged in!"
end def handle_info(%ExIRC.Message{nick: from, cmd: "PRIVMSG", args: ["mynick", msg]}, _state) do
IO.puts "Received a private message from #{from}: #{msg}"
end def handle_info(%ExIRC.Message{nick: from, cmd: "PRIVMSG", args: [to, msg]}, _state) do
IO.puts "Received a message in #{to} from #{from}: #{msg}"
end
Link to this function
init(_)
Link to this function
start!()
Link to this function