Skip to content

Hedwig 2.0 - Robot Behaviour#70

Open
scrogson wants to merge 6 commits into
masterfrom
robot_behaviour
Open

Hedwig 2.0 - Robot Behaviour#70
scrogson wants to merge 6 commits into
masterfrom
robot_behaviour

Conversation

@scrogson

@scrogson scrogson commented Aug 18, 2017

Copy link
Copy Markdown
Member

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

coveralls commented Aug 19, 2017

Copy link
Copy Markdown

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

keathley commented Jan 8, 2018

Copy link
Copy Markdown
Member

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

scrogson commented Jan 8, 2018

Copy link
Copy Markdown
Member Author

@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

keathley commented Jan 8, 2018

Copy link
Copy Markdown
Member

Exactly

@michalmuskala

Copy link
Copy Markdown

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

johanb commented Apr 26, 2019

Copy link
Copy Markdown

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
Copy Markdown
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

fire commented Aug 15, 2019

Copy link
Copy Markdown

This still seems useful to be worked on.

@mhsdef

mhsdef commented Jan 30, 2023

Copy link
Copy Markdown

@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
Copy Markdown
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