-
Notifications
You must be signed in to change notification settings - Fork 52
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
Simplify handlers (internal only) #162
Conversation
df5eb88
to
ecf2364
Compare
docs/handlers.rst
Outdated
@@ -19,22 +19,23 @@ If the bot receives a message that is exactly equal to `ping` the response will | |||
|
|||
Bottery has the following handlers available: | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why two lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two lines between sections. I changed it a bit, is it better?
docs/handlers.rst
Outdated
Create a new handler | ||
-------------------- | ||
|
||
The interface of a handler is quite simple. To create a new one, everything needed is a class with a method called ``match`` and an attribute called ``view``. The method ``match`` define if that handler should be used or not to respond to the new message. It must receive a ``Message`` as a parameter and return a boolean. The attribute ``view`` will be used if the ``match`` returns ``True``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to use "the handler's structure" instead of interface
docs/handlers.rst
Outdated
|
||
.. code-block:: python | ||
|
||
class LongTextHandler: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i would be clearer if the example had a pattern to compare, like StartsWithHandler
or something similar. I got confused if this did the same thing.
This pull request make easier to create or extend handlers. Now Bottery choose the view to respond a new message according to a list of handler instances.
Closes: #161