hedwig-im / hedwig

An Adapter-based Bot Framework for Elixir Applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enter responder macro

ryanwinchester opened this issue · comments

hubot has enter and leave methods that can be very helpful.

well, at least the enter one is.

any plans on adding enter responder macro?

I've thought about these, but I've never really had a practical use-case for them. If you could outline what you'd expect from such macros and how they would be used, I could see if I can work that into the plans for 2.0.

one example would be, when someone enters, the bot could greet them. there are some use-cases where we'd want to greet and give some instruction, or rules, or links to resources, etc

@ryanwinchester is this usually a one-off action? Would you actually want to define more than one of these type of responders?

I'm curious if this would make more sense for a callback in the robot module instead?

def handle_join(%Hedwig.Join{room: room, user: user}, state) do
  # ...
end

def handle_leave(%Hedwig.Leave{room: room, user: user}, state) do
  # ...
end

And what about catchAll listener in Hubot?

module.exports = (robot) ->
   robot.catchAll (msg) ->
   msg.send "I don't know how to react to: #{msg.message.text}."