hedwig-im / hedwig

An Adapter-based Bot Framework for Elixir Applications
MIT License
656 stars 73 forks source link

Allow adapters to pass messages to the robot module #41

Closed scrogson closed 8 years ago

scrogson commented 8 years ago

This allows users to define handle_in/2 in their robot module in order to handle any message no handled by the adapter.

Example:

defmodule MyApp.Robot do
  use Hedwig.Robot, otp_app: :my_app

  def handle_in({:some_message, msg}, robot) do
    # do something with the message ...
    # must return `{:ok, robot}`.
    # `robot` here is the state of the Robot.
    {:ok, robot}
  end
end
coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.4%) to 87.006% when pulling 0af5af60ec236b58205cc8b4d4f6b42c9e57be67 on scrogson:handle_in into 2645dedc4a133d56bb417227302ea1337b3f2b0e on hedwig-im:master.