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.
Previously, remove_subscriptions called the
PATCH /api/v1/users/me/subscriptions endpoint, which is more like
an ad-hoc endpoint for bulk adding/removing subscriptions for the
user that makes the request. However, making a DELETE request
allows an admin to pass in the `principals` argument to unsubscribe
other users from streams as well, which is more consistent with how
add_subscriptions works.
The zulip and zulip_botserver packages specify mock as a runtime
dependency, which is only needed for testing during development.
So, it made more sense to move it to requirements.txt so that
it can be installed by ./tools/provision during development.
In python3, if you removed a directory that files within it,
you would get an error saying "dictionary changed size
during iteration."
The fix is to list-ify the keys before iterating over them (and
popping keys from the dictionary).