hedwig-im / hedwig

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

enter responder macro #69

Open ryanwinchester opened 7 years ago

ryanwinchester commented 7 years ago

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?

scrogson commented 6 years ago

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.

ryanwinchester commented 6 years ago

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

scrogson commented 6 years ago

@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
bossyang commented 6 years ago

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}."