Commit graph

2241 commits

Author SHA1 Message Date
derAnfaenger 87d641d6c2 Replace native datetimes in the Codebase integration.
Update all utcnow() and now() calls, as well as other native dates to
specify the UTC timezone.
Fixes #3809.
2017-03-08 15:32:06 -08:00
Abhijeet Kaur 7c3a228450 doc updates: Remove triage_message function from contrib-bots. 2017-03-07 22:23:11 -08:00
sinwar 04580dbb97 python: Fix remaining bare excepts in codebase.
Fixes #2862.
2017-03-05 16:17:04 -08:00
Raghav Jajodia 58f5e729b6 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Rishi Gupta 94871fea76 Fix several new errors caught by mypy 0.501.
Clear out a bunch of easy to review errors, so we can focus on the more
complicated ones.
2017-03-03 14:12:52 -08:00
Rishi Gupta 6c47fa77b6 Use time.time() instead of datetime.now() to measure elapsed time.
Both because it is more idiomatic and because we will soon start enforcing
that all datetimes in Zulip are timezone aware.
2017-03-01 22:54:28 -08:00
Elliott Jin b2ac1bca29 Clean up timestamp formatting in Google Calendar bot. 2017-02-28 09:29:07 -08:00
Elliott Jin a74490bf1c Google Calendar bot: Populate events array directly. 2017-02-26 18:05:46 -08:00
Elliott Jin 478785b415 Google Calendar bot: Include time zone offsets in timestamps.
Fixes: #3769
2017-02-26 18:05:46 -08:00
Tim Abbott 060b680674 mypy: Fix inconsistencies in use of *args/**kwargs. 2017-02-18 18:39:44 -08:00
Tim Abbott ca5fa6c9de mypy: Remove now-unused type: ignores. 2017-02-18 17:01:01 -08:00
Abhijeet Kaur 9a8dc7c622 Remove triage_message() function from all the contrib-bots.
To make all bots consistent add shared function in bot_lib.py
to check if this bot is called. All bots respond to at-mention of
the bot instead of their specific names.
2017-02-17 06:51:48 -08:00
Tim Abbott a87ae4b1c4 api: Add bindings for new get_presence endpoint. 2017-02-10 23:52:56 -08:00
Abhijeet Kaur 9a8dc2661a bug fix: Fix errors in "john" bot in contrib_bots.
Fix outdated code in "john.py" to use "OutputAdapter" module
in Chatterbot. Typecast Chatterbot response to string.
2017-02-10 06:44:03 -08:00
Abhijeet Kaur 0419848d3c contrib_bots: Restructure bots to follow a consistent structure.
Now all the bots that are stored in contrib_bots are in the
same file/directory format.
The format is specified here #3427. Add tests.py file for encrypt_bot as well.
Fixes #3427.
2017-02-10 06:44:03 -08:00
Abhijeet Kaur 2282000d78 bug fix: Fix wikipedia bot in case no results are found.
Incorrect Index access in wikipedia.py resulted in IndexError and
wikipedia bot to crash for few queries. This causes the bug to be fixed.
Replaced url to avoid 2 redirects and enhance performance.
Fixes: #3508.
2017-02-09 12:20:51 -08:00
Eklavya Sharma 1ee3e476f3 Change True to 'True' in requests.get params.
According to stubs from mypy 0.4.7 onwards, `requests.get` takes
a parameter `params` of type `Dict[AnyStr, AnyStr]` where `AnyStr`
can be either bytes or text.  Actually, requests can accept values
of other types in dicts too but it casts them to a string type.

So to avoid type checking error messages, change `True` to `'True'`.
2017-02-07 12:55:25 -08:00
Rohitt Vashishtha 863df67150 api: Add support for Environment Variables.
This adds support for controlling the basic configuration (user, API
key, etc.) of the Zulip API bindings via environment variables.

Fixes #3364.

Tweaked by tabbott to update variable names and document in README.md.
2017-02-06 22:56:59 -08:00
sinwar 46e7e05516 bots: Use requests instead of unirest for Yoda bot.
Fixes #3500.
2017-02-06 22:07:38 -08:00
Tim Abbott 4c482bfb66 Replace references to zulip.com/dist with zulip.org/dist.
Now that zulip.org has all the files to distribute, there's no reason
to still point to the soon-to-be-decommissioned zulip.com/dist.
2017-01-28 17:56:25 -08:00
Yago González 3fcb4d33f1 contrib_bots: Fix typos and repetitions in the readme. 2017-01-27 16:39:19 -08:00
Steve Howell 39becef8c0 Fix update_message() in our API.
This was regressed in b3df1ddeb1bbf67695a673278ae3c4a3e7c9ae99.
2017-01-25 16:33:19 -08:00
Tim Abbott 722fc56534 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott 31efc903bd lint: Clean up E401 PEP-8 rule. 2017-01-23 21:36:39 -08:00
Tim Abbott 55e8d5f58d lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott 5b3d2c9100 lint: Clean up E241 PEP-8 rule. 2017-01-23 21:21:14 -08:00
Tim Abbott f0f18c8f1b lint: Clean up E712 PEP-8 rule. 2017-01-23 21:11:18 -08:00
Tim Abbott 2f0bc3dc69 lint: Clean up E306 PEP-8 rule. 2017-01-23 21:05:08 -08:00
Tim Abbott 4d81b91185 lint: Clean up E121 PEP-8 rule. 2017-01-23 21:02:39 -08:00
Tim Abbott 07cdd69e42 lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
Tim Abbott 4b015ecdff lint: clean up PEP-8 W391 rule. 2017-01-23 20:39:02 -08:00
Steve Howell 42fdead31f Fix lint error w/ClientDummy. 2017-01-22 05:51:33 -08:00
Robert Hönig 0af3069839 Restructure converter bot.
Apply the new layout for 'contrib_bots' bots to the converter bot
to make it an exemplary model for new bots.
2017-01-22 05:42:46 -08:00
Robert Hönig fefe869748 Restructure contrib_bots bots to new layout.
In order to make the layout of all bots consistent, this commit
moves each bot into a folder with its name and modifies 'run.py'
so that only bots with such a structure can be executed. 'lib'
gets renamed to 'bots'.
2017-01-22 05:42:46 -08:00
ParthMahawar 51b88e3d8c interactive bots: create EncryptBot bot 2017-01-17 09:13:33 -08:00
Robert Hönig 366d57c291 Improve virtual_fs.py bot.
This commit fixes a bug with deleting directories,
prettifies the program's path output, and adds the
commands 'cd' (without 'cd ..') , 'rmdir' and 'pwd'.
2017-01-17 08:00:56 -08:00
Steve Howell 8295d6775d Extract contrib_bots/bot_lib.py from run.py.
Splitting out some of the bot functions into a library
will make it easier for heavily customized bots to have
their own version of run.py, instead of the shared one
that we use for everyone now.  If they use bot_lib.py
directly, they will still most likely conform to
the "Handler" interface as long as they call
run_message_handler_for_bot.

Most bots should continue to use contrib_bots/run.py
for now.
2017-01-14 12:44:50 -08:00
Sampriti Panda 16b1be15c0 urls: Move /messages/render to POST endpoint 2017-01-13 16:11:51 -08:00
Robert Hönig a7f3b4d1d1 Remove superfluous comment in triage_message(). (#3291) 2017-01-13 10:21:45 -08:00
Juan Verhook e104225a2c interactive bots: Create your own virtual assistant 2017-01-13 07:22:04 -08:00
Rafid Aslam 229471c70f Change error handling in get_subscribers() in Zulip API client.
Fixes #3281.
2017-01-13 07:14:50 -08:00
Maydha K 105b0ab0dc interactive bots: Create tic-tac-toe bot. 2017-01-12 17:26:19 -08:00
Jackson 75a9101f30 interactive bots: Add FourSquare bot and documentation. 2017-01-12 16:51:13 -08:00
Rafid Aslam 6972ce61c8 Move endpoints to use stream_id instead of stream_name in their URLs
- Change `stream_name` into `stream_id` on some API endpoints that use
`stream_name` in their URLs to prevent confusion of `views` selection.

For example:
If the stream name is "foo/members", the URL would be trigger
"^streams/(?P<stream_name>.*)/members$" and it would be confusing because
we intend to use the endpoint with "^streams/(?P<stream_name>.*)$" regex.

All stream-related endpoints now use stream id instead of stream name,
except for a single endpoint that lets you convert stream names to stream ids.

See https://github.com/zulip/zulip/issues/2930#issuecomment-269576231

- Add `get_stream_id()` method to Zulip API client, and change
`get_subscribers()` method to comply with the new stream API
(replace `stream_name` with `stream_id`).

Fixes #2930.
2017-01-12 15:23:31 -08:00
royabouhamad 0e26a0bb3b Interactive bots: Create a thesaurus bot. 2017-01-12 13:07:12 -08:00
Robert Hönig 72486f6371 Fix virtual_fs bot trying to read a directory
This commit prevents the bot from crashing when a command
like 'fs read /home' is entered. Instead, an error is
displayed.
2017-01-12 09:16:17 -08:00
JefftheBest1 7bfaeec54c Fixed typos with receive 2017-01-12 04:52:44 -08:00
JefftheBest1 5e95dc3bdc Fixed typos with threshold. 2017-01-12 04:50:20 -08:00
JefftheBest1 c7a0b9e575 Fixed a typo in zulip_change_commit.py 2017-01-12 04:49:47 -08:00
Vamshi Balanaga 87aa2c5b3b docs: improve docs for contrib_bots. 2017-01-11 16:32:02 -08:00