python-zulip-api
python-zulip-api copied to clipboard
Bots: Add default (and other) command dispatch
This is an alternative implementation of #66 based on discussion in #integrations regarding perceived issues (@showell, @timabbott)
I avoided amending existing bots and instead added a demonstration as a 'helloworld_defaults' bot, which demonstrates the increasing features in subsequent commits:
- empty ("") and "about" command responses
- "commands" (uses default commands and those passed in)
- "help" (default commands, and those passed in with help text)
- allowing dispatch of all commands through the system
- a decorator which can be applied to functions, to indicate the command name and help text, and which causes the function to be dispatched if the command matches.
I attempted to develop things in tandem in the test system, but am not fully satisfied with the current system (as per the comments in test_helloworld_defaults).
There is no doc.md file as yet for the new bot, though I can add this easily.
I'm completely open to renaming aspects of the system, but functionally it appears to work fine in tests and with zulip_bot_output.py (or did until I rebased, and now have some kind of storage error? @roberthoenig?)
Heads up @neiljp, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master
branch and resolve your pull request's merge conflicts accordingly.
Heads up @neiljp, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master
branch and resolve your pull request's merge conflicts accordingly.