hedwig-im / hedwig

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

Process registration: `handle_connect` not being called? #59

Closed stevegrossi closed 7 years ago

stevegrossi commented 7 years ago

I've been following the README down through the Registering your robot process section in order to register a robot's process by name, but handle_connect doesn't appear to be called and the registration never happens.

This is with the latest master, on Elixir 1.3.4 and Erlang 19. A demo repo is here: https://github.com/stevegrossi/alfred. There's nothing special: to reproduce the issue I hewed as close to the README as possible, using mix hedwig.gen.robot with the name "alfred" and the Console adapter.

For simplicity, I'm attempting to start the robot manually, rather than through a supervision tree. Again, copy-and-pasting from the README's Finding Your Robot section:

screen shot 2016-11-17 at 5 46 53 am

The generated process registration via :global in handle_connect does not appear to take place. And indeed, if I replace the auto-generated handle_connect with something that should obviously fail:

defmodule Alfred.Robot do
  use Hedwig.Robot, otp_app: :alfred

  def handle_connect(state) do
    raise "handle_connect called"
  end

The robot starts just fine, which leads me to believe handle_connect isn't being called at all. Is there possibly an issue here?

scrogson commented 7 years ago

@stevegrossi, yes, you are right. Looks like I failed to update the Console adapter. Sorry about that.

I'll get a fix pushed shortly. Thank you for the report!

scrogson commented 7 years ago

@stevegrossi, thanks so much for the report. I really appreciate that. I've pushed up a fix in 112614f.

stevegrossi commented 7 years ago

Confirmed working! Thanks for addressing this so quickly.