-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Added prefix argument to CommandHandler #1021
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
Conversation
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.
See comments on code.
# it as an empty string prefix. | ||
self.prefix = '' | ||
else: | ||
self.prefix = prefix |
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 don't think prefix should be limited to a single char. Same as you accept an empty string you can accept any string longer than 1 char.
-
Instead of calculating (over and over) the
empty_leader
duringcheck_update
, you can calculateself.leader_len
here (at the c'tor) and simplify everything else later on. -
Calling
len(prefix)
here will also make the check forNone
redundant. It will be the one to raiseTypeError
if necessary.
The idea behind this PR is interesting. Since there is two months with no activity, I suppose it's abandoned, so can I assume the work? |
@wagnerluis1982 Hi,
If you want to contribute to the project, feel free to contact me and we can discuss the details. http://t.me/tsnoam |
@wagnerluis1982 see issue #1026 about the redesign of handlers. |
@tsnoam thanks for the feedback, I understood the point. |
Once again thanks for getting us started on this idea. |
This will be useful for making CommandHandlers that do not adhere to the
/
-prefix convention.Hashtag commands or ones without any prefix at all become possible through this PR.