This commit makes a bunch of improvements:
1. Use format() for string formatting instead of the old style.
2. Stop returning stuff where we don't have to.
3. URL generation should not be done by the script, especially
since our eventual goal is for the Zulip server to automatically
generate a webhook URL. So the user should be able to supply
the URL in the config file. Plus, this makes it easier to test
the script with non-Zulip URLs (such as RequestBin).
4. Removed unnecessary arguments.
Having a default parameter as '[]' may not be an issue with the current
implementation, but general practice is to default to None and assign
a default list subsequently.
This assumes that files passed in force_include without any extension are meant
to be run with mypy, and thus assumed to be python scripts.
Also, we ignore the most of the tools dir, except for the tools/deploy script
for which #349 adds type annotations.
Currently, if a user does 'move 0', he moves to column 6(last column)
in connect_four which is unwanted behaviour and happening due to
list getting accessed through negative index (-1).
Added a check for that in controller.py file.
Fixes#343
This script interfaces with a Zulip Botfarm - a flask server that wraps
docker and runs Zulip bots using the docker engine. This allows for
remotely hosting bots for better uptime, and reduces the configuration
steps needed for safely hosting a bot online.
This commit tests that we throw a BadMoveException if you
try to move into a "full" column in connect four. This gets
the controller up to 100% coverage.
Allow a game to start even if `max_players` is not reached.
Adding a new command `play game` to start a game if the
number of players is between max and min no. of players.
Make tests pass with the new change.
This removes the use of RuntimeError, and replaces it with a custom
error class called ZulipError. In a few places, we use a subclass to
make it easier for code to interact with the error type.
This method allows bots to validate their config info
in a standardized way. Adding the method to a bot is
optional, but recommended for bots with config options
that can be invalid, like api keys. The giphy bot serves
as an example.
The primary reason behind this is to allow the zulip
backend to validate config data for embedded bots. The
backend does not have a permanent bot class instance, so
validate_config() must be a static method.