-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
ℹ️ good-first-issueinformation: good-first-issueinformation: good-first-issue
Description
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
Calling add_handler
multiple times maybe become tedious, so this proposes a new method to add multiple handlers at once.
Describe the solution you'd like
A new method Dispatcher.add_handlers
(trailing s
!) with the following syntax:
dispatcher.add_handlers(list/sequence_of_handlers, group)
should be a substitute for
for handler in list_of_handlers:
dispatcher.add_handler(handler, group=group)
and
dispatcher.add_handler({1: [list_1], 2: [list_2]})
should be a shortcut for
for group, handlers in my_dict.items():
for handler in handlers:
dispatcher.add_handler(handler, group=group)
Passing the group
argument in this case should throw a ValueError
Describe alternatives you've considered
Additional context
Proposed in #2813
If you are interested in PRing for this, please leave a comment here.
For the tests to add, you can get inspiration e.g. here.
Metadata
Metadata
Assignees
Labels
ℹ️ good-first-issueinformation: good-first-issueinformation: good-first-issue