Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hedwig 2.0 - Robot Behaviour #70

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Hedwig 2.0 - Robot Behaviour #70

wants to merge 6 commits into from

Conversation

scrogson
Copy link
Member

@scrogson scrogson commented Aug 18, 2017

This PR starts the process to move away from issues brought up in #60 and #61.

Hedwig 2.0 will aim to provide a very ergonomic API for folks who just need a basic bot:

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

As well as more advanced OTP use-cases:

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

  def start_link(opts \\ []) do
    Hedwig.Robot.start_link(__MODULE__, nil, name: {:global, "my_app_robot"})
  end

  # ...
end

The API is still a work in progress...

TBD

  • Should :otp_app and/or :adapter options be required at compile-time?

TODO

  • Get test coverage to > 95%
  • Documentation

@hedwig-im hedwig-im deleted a comment from coveralls Aug 18, 2017
@hedwig-im hedwig-im deleted a comment from coveralls Aug 18, 2017
@hedwig-im hedwig-im deleted a comment from coveralls Aug 18, 2017
@hedwig-im hedwig-im deleted a comment from coveralls Aug 19, 2017
@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage decreased (-17.7%) to 74.453% when pulling 6b3ae95 on robot_behaviour into 3817edb on master.

@hedwig-im hedwig-im deleted a comment from coveralls Sep 19, 2017
@keathley
Copy link
Member

keathley commented Jan 8, 2018

This is looking good to me. Just glancing over it I don't think we allow uses to overwrite init/1 in Robot. Thats something we should probably look at so its easier to configure everything at runtime.

@scrogson
Copy link
Member Author

scrogson commented Jan 8, 2018

@keathley are you thinking more in the realm of an init/2 callback for runtime configuration like Ecto.Repo and Phoenix.Endpoint?

If so, that's definitely something I've thought about and I think it's probably a good idea. The init/1 callback can stay private for the behaviour to take care of.

@keathley
Copy link
Member

keathley commented Jan 8, 2018

Exactly

@michalmuskala
Copy link

I just got around to see this PR. I'd like to ask you to consider a slightly different approach to injecting default callback implementations in __using__. In particular it is to use optional callbacks and handle defaults appropriately in the behaviour module when the callback is not defined. This also probably means injecting almost no code in use besides the @behaviour declaration and the child_spec function. This is most probably how GenServer will work in Elixir 1.8 and how GenStage works already - it might be a good reference on how to go about doing this.

@johanb
Copy link

johanb commented Apr 26, 2019

Is this something that's still being worked on ? If so wouldn't mind to lend a hand, just not sure how to get started.

@scrogson
Copy link
Member Author

@johanb thanks for your interest in helping!

I do intend to finish this PR someday soon 😄

I'll probably pick this back up next month.

@fire
Copy link

fire commented Aug 15, 2019

This still seems useful to be worked on.

@mhsdef
Copy link

mhsdef commented Jan 30, 2023

@scrogson what are you thinking on this PR and about Hedwig, generally, these days?

I'm considering putting in some grunt work in your lil' ecosystem (eg, wip, and potentially toss some PRs your way here in this repo); I don't want to be spinning wheels though if Hedwig itself is on its way to mothballed.

@scrogson
Copy link
Member Author

@defmhs hey there 👋

Unfortunately, my work in the last 5+ years has lead me away from working on chat related things, so I haven't had time/energy to maintain this project.

That said, if you're interested in helping push this project forward, feel free to send some PRs, I'll try my best to respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants