juni-b-queer / bsky-event-handlers

Typescript based framework for building Bluesky bots. Designed to be easily extendable, this bot framework can be used to make almost any bot you could want.
20 stars 0 forks source link

Update order of parameters in `handle` function #52

Open juni-b-queer opened 4 months ago

juni-b-queer commented 4 months ago

In AbstractMessageAction, the handle function accepts two parameters: message, and handlerAgent.

I want to switch the order to have handlerAgent first. This way I can make an AbstractAction that can accept only the handlerAgent, and does not rely on messages. This can be used for #47 to make functions for other handler types.

The same thing needs to be done with AbstractValidator. The handle and shouldTrigger functions have message as the first parameter, and handlerAgent as the second. For validators, I want to make a new AbstractMessageValidator that is almost identical to the existing AbstractValidator but the order of the handle and shouldTrigger parameters are switched. Then in AbstractValidator, handle and shouldTrigger should only accept a handlerAgent, so it can be used for Handlers other than the jetstream message handler

The same also goes for AbstractMessageHandler and other Handlers. There should be a new AbstractHandler that only accepts the lowest level abstract classes, validators are AbstractValidator and actions are AbstractAction. For the handle function, it should accept a handlerAgent, then any additional args AbstractMessageHandler will extend that handler

juni-b-queer commented 4 months ago

:tada: This issue has been resolved in version 2.0.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: