Instead of discovering unit tests using loader.discover() by passing
it a set of starting and top level directories, we now discover
unit tests by loading them from specific test module objects. This
makes it easier to include and exclude specific bots from testing.
The zulip-run-bot script now supports passing in a --path-to-bot
option. This allows users to specify the path to the source file
for their own custom bots, the first step towards being able to
support out-of-tree bots.
To run an existing bot in the zulip_bots package, just passing in
the name of the bot should suffice.
There is no library as 'http.bot_handler'.
'http.client' is what the author of this bots initially wrote.
Searching through the git history shows that someone mistakenly
replaced 'client' with 'bot_handler' here.
get_config_info function in 'ExternalBotHandler' class was
using 2 undefined variables, which wasn't allowing bots to
access information from config file.
Fixed it, bots with api key working now.
Previously, the annotation for the (now removed)send-reply
function was also wrong, as "send-message" function of
EmbeddedBotHandler class does not return any value, contrary
to "Dict[str, Any]" as specified by the funtion.
This is done as a follow up for zulip/zulip#5842.
In order to keep all three packages (zulip, zulip_bots,
zulip_botserver) in the same repo, all package files must now
be nested one level deeper.
For instance, python-zulip-api/zulip_bots/zulip_bots/bots/, instead
of python-zulip-api/zulip_bots/bots/.
tools/server_lib contains files copied as-is, or with minor
modifications, from the zulip/zulip repository when the api
code was split into this separate repository.
Adds the file api/bots_api/provision.py that installs dependencies
for bots using pip. This file is also used by run.py when running
a bot. However, for testing, you need to separately provision the bots.
For a large perforce server with many users, this allows projects
to opt-in to zulip notifications by creating the stream for the
branch to be monitored.
Commits to paths for which a stream mapping yields a result,
but no stream exists in Zulip, are simply dropped silently.
This behaviour is opt-in, by setting the configuration key
ZULIP_IGNORE_MISSING_STREAM = True
in the zulip_perforce_config.py file.
The general regex-based linkify in zulip does not allow '@' as the
prefix. In any case we know here that it is definitely a changelist
number, which is better.
Adding P4_WEB="https://p4web.example.com" to the config will enable
this behaviour. If P4_WEB is absent from the config, or has the
value None, no link is inserted.
This fixes multiple paragraphs in a commit message escaping
from the block quote by using triple-backquote quoting instead
of '>' which only applies to one paragraph.
Add another class for bot type as embedded bot, for bots that run directly
on Zulip server. This class uses internal 'internal_send_messages' from
actions.py instead of using the 'send_message' function from Zulip Client
class.
We haven't gone ahead with creating an abstract superclass right away.
We just have two versions for now, it would be easier to iterate a little
more on the interfaces, and then only add the superclass when we're ready
to lock down the interface.