CactusDev / CactusBot

An open source, community-written service-agnostic chat bot
MIT License
30 stars 5 forks source link

Move Beam connection to external package #88

Closed 2Cubed closed 6 years ago

2Cubed commented 7 years ago

Should we move the Beam connection (BeamAPI, BeamChat, BeamConstellation) to an external package?

pylang commented 7 years ago

Aren't these a "service", or has that design changed?

2Cubed commented 7 years ago

@pylang We're still going to be using our current service model. However, we could definitely move the code that handles the actual Beam connection out of the bot and into a separate Beam client package, and then just use that in CactusBot.

An example of this exact concept can be seen in our discord service. We're using the discord.py package to handle all connection details, which is extremely convenient and much cleaner, IMHO.

pylang commented 7 years ago

So with this idea, would some services have external packages and others wouldn't? Example, would twitch need a package?

2Cubed commented 7 years ago

@pylang I'm thinking that we should keep all client packages out of the bot itself. In addition to the fact that it's much cleaner implementation-wise, this would allow others to use our code to create their own custom bots andclients.

pylang commented 7 years ago

Makes a ton of sense to me. How implement it uniformly i'm not clear on. So if joe made a hitbox implementation, he would do a pull request for his package and hitbox.py file that goes into CB services? Is that the idea?

2Cubed commented 7 years ago

@pylang Hmm... hadn't thought of that. I think the best course of action for adding Hitbox would be for us to create a generalized client package, CactusDev/hitbox.py, and then using that to add the service.

pylang commented 7 years ago

That's a idea. So hitbox.py would be a different project in the GitHub organization. Jupyter has this kind of setup for their extensions. Something to think about:

2Cubed commented 7 years ago

@pylang Each service would still need a Handler (BeamHandler, DiscordHandler, etc.), which are (currently) provided in config.py.

SERVICE = BeamHandler(CHANNEL, handlers)

I believe pip has a way of installing different "parts" of the project:

pip install cactusbot
pip install cactusbot[service:beam]

We could use this to our advantage, along with some command-line arguments, to make the installation process really clean.