Commit graph

126 commits

Author SHA1 Message Date
derAnfaenger 60d4c343d7 bots: Allow empty bot queries.
This commit allows bots to be adressed with empty queries,
that is, by just @-mentioning them. @-mentioning is now the
only way to adress a bot.
2017-05-22 19:13:42 -07:00
Elliott Jin 9b20750456 bots: Allow symlinks in bot paths provided to run.py.
run.py requires that the location of the provided bot matches the location
of run.py.  However, run.py previously failed in the case where the location
included a symlink.
2017-05-22 16:52:29 -07:00
Aditya Bansal 950101651d pep8: Add compliance with rule E261 to bots/define/define.py. 2017-05-07 23:21:50 -07:00
Yago González 1894a134f8 bots: Move Google search bot and fix bugs.
Now this bot follows our latest structure for contrib_bots.

Switched the dependencies instructions, to install "google" rather than
"google-api-python-client".

Added all the search terms to the query (not only the first one).
2017-03-17 13:03:06 -07:00
Tim Abbott 31b88c9225 lint: Fix PEP8 lint error in googlesearch.py. 2017-03-17 12:15:43 -07:00
royabouhamad 054db19ad9 interactive bots: create a google bot. 2017-03-17 11:54:21 -07:00
Abhijeet Kaur 1b31a16d13 contrib bots: Better error handling response in thesaurus. 2017-03-14 13:29:19 -07:00
Abhijeet Kaur 050162592a contrib bots: john bot can reply back in the same chat.
No need to create an extra "VirtualHelp" stream.
2017-03-14 13:29:19 -07:00
Abhijeet Kaur 92d2981726 contrib bots: Edit code for uniformity.
Add one function (get_bot_botname_response()) that generates response
from the given input and replies back to the handle_message with the final
content of response to be sent. Also add code to bots(except followup) to
reply to private messages along with stream messages.
2017-03-14 13:29:19 -07:00
Abhijeet Kaur d715787170 contrib bots: Rename bots to follow a consistent pattern.
Files renamed with few changes to accomodate the change in
path name of files. Fix few "at-mention bot" errors in docs.
2017-03-14 13:29:19 -07:00
Abhijeet Kaur 6dda0eb506 contrib bots: Rename bots to follow a consistent pattern.
Files renamed without any changes.
2017-03-14 13:29:19 -07:00
Umair Khan e749ff8c92 capitalization: Fix API Key in documentation. 2017-03-08 23:36:36 -08:00
Abhijeet Kaur 7c3a228450 doc updates: Remove triage_message function from contrib-bots. 2017-03-07 22:23:11 -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
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
sinwar 46e7e05516 bots: Use requests instead of unirest for Yoda bot.
Fixes #3500.
2017-02-06 22:07:38 -08:00
Yago González 3fcb4d33f1 contrib_bots: Fix typos and repetitions in the readme. 2017-01-27 16:39: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 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
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
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
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
Vamshi Balanaga 87aa2c5b3b docs: improve docs for contrib_bots. 2017-01-11 16:32:02 -08:00
Robert Hönig a93c0b8f15 Terminate run.py without throwing tracebacks.
Pressing control-c while run.py is being executed has terminated the
script, but threw an ugly traceback. To signal the user that his
method of exit was appropriate, we handle control-c calling exit(0).
2017-01-11 15:25:20 -08:00
Robert Hönig a62a89bca4 Rename the RestrictedClient class to BotHandlerApi
As a first step into restructuring the run.py layout to support a
worker and an API-wrapper class, we rename the RestrictedClient
class appropriately.
2017-01-11 15:25:20 -08:00
Robert Hönig b97411afe6 Hide 'client' and 'rate_limit' from 'contrib_bots' bots.
'contribot_bots' should only provide a restricted access to the
client API, yet 'client' and 'rate_limit were fully exposed. While
not fully restricting access to those objects, this commits hides
them with prepending underscores.
2017-01-11 15:25:20 -08:00
Tim Abbott a792ecd025 contrib_bots: Fix lint error in rate limiting code. 2017-01-10 15:10:17 -08:00
Robert Hönig 26fa2a5fc5 Add a rate limit for bots in contrib_bots
To prevent bots from accidently entering an infinite message loop,
where they send messages as a reacting to their own messages,
this commit adds the RateLimit class to run.py. It specifies how
many messages can be sent in a given time interval. If this rate
is exceeded, run.py exits with an error.
Fixes #3210.
2017-01-10 13:42:40 -08:00
Uma 775df0f30a Improved 'readme.md' file in contrib_bots/lib 2017-01-10 07:03:57 -08:00
Tim Abbott 58a5de0377 lint: Fix % comprehensions being used without a tuple. 2017-01-09 11:45:11 -08:00
Tommy Ip 3cea2b5f1c contrib_bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tim Abbott 35149e83de contrib_bots: Wrap CommuteBot docs. 2017-01-05 14:58:06 -08:00
andrewallen00 3574017297 interactive bots: Create yoda translator bot 2017-01-05 11:24:24 -08:00
Robert Hönig a86066c386 interactive bots: Create converter bot. 2016-12-29 19:28:35 +01:00
Yago González f563654377 interactive bots: Use dev API when in a dev setup.
Now the development API (which is inside the repo, api/) is used when the envionment is a development one.

Credits to Steve Howell (@showell) for the instructions on how to fix this.
2016-12-28 19:25:56 -08:00
Rafid Aslam db39b52d3f interactive bots: Create xkcd bot. 2016-12-27 22:52:51 +01:00
Vamshi Balanaga 2a8c57d77a Modify GitHub Issue bot to use new authentication module. 2016-12-27 11:58:36 -08:00
Vamshi Balanaga da256ef854 Modify GitHub comment bot to use new authentication module, and edit documentation accordingly. 2016-12-27 11:58:36 -08:00
Vamshi Balanaga 69b324229c Create GitHub authentication module. 2016-12-27 11:58:36 -08:00
Rafid Aslam 5d05703482 interactive bots: Create Giphy bot 2016-12-26 09:38:50 -08:00
Rafid Aslam 8d35f25fd6 contrib_bots: Expose some information about user profile
- Expose some information about user profile in `RestrictedClient`
class, like `full_name` and `email` of the user.

- Add `client` argument to `triage_message()`, now it's possible to
call bot with another method instead of calling the specified
keyword.
2016-12-26 09:38:50 -08:00
Abhay Kashyap 6df2450b60 Created DefineBot and document and added them 2016-12-26 09:07:10 -08:00
Tommy Ip 5ef742638e interactive bots: Create Howdoi bot.
This bot allows users to search technical questions from Stack
Overflow.
2016-12-24 08:22:44 -08:00
Jackson a654ba51e1 interactive bots: Create CommuteBot. 2016-12-21 18:46:59 -08:00
= 1b58c13d91 Interactive bots: Create Github Issues bot. 2016-12-19 21:57:21 -08:00
andrewallen00 e2ed990746 interactive bots: Create comment on issue GitHub bot.
interactive bots: Create comment on issue GitHub bot.

interactive bots: Create comment on issue GitHub bot.

interactive bots: Create comment on issue GitHub bot.

interactive bots: Create comment on issue GitHub bot.
2016-12-17 16:33:08 -08:00
Rafid Aslam 746d9d2b6b contrib_bots: Allow to import code from subdirectory of lib
Allow to import code from subdirectory of `contrib_bots/lib`.
Because sometimes bot requires grouping in their directory,
especially for the bot that has configuartion file and documentation.
2016-12-14 16:35:49 -08:00
Steve Howell c96681eef5 contrib_bots: Add "Python dependencies" to docs. 2016-12-14 15:03:51 -08:00
Steve Howell f479a1ef37 contrib_bots: Add "Third Party Configuration" to docs. 2016-12-14 15:03:51 -08:00
lonerz a2aa1a117c interactive bots: Create Wikipedia bot. 2016-12-13 13:46:11 -08:00
reallyly 9d6e7cfea5 pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
2016-12-13 10:50:14 -08:00
Anders Kaseorg fe99695210 Always start python via shebang lines.
This is preparation for supporting using Python 3 in production.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 14:46:37 -08:00
Steve Howell 3758d76123 contrib_bots: Simulate a file system with a bot. 2016-10-16 14:41:24 -07:00
Steve Howell 0dab69b76f Add StateHandler to contrib_bots/run.py.
This allows bots to be stateful.  It doesn't handle persistence
after the bot shuts down, but it does store state between
invocations of handle_message.
2016-10-16 14:41:24 -07:00
Sahil Dua 6900cd2e9a Remove extra new lines at the ends of Zulip authoried files.
Fixes #1627.

[tweaked by tabbott to avoid patching third-party modules, for now]
2016-09-26 21:05:24 -07:00
Steve Howell 05191181d9 bots: Add --config-file to contrib_bots/run.py. 2016-08-24 12:09:11 -07:00
Steve Howell e08323c143 bots: Fix typo in contrib_bots/lib/readme.md. 2016-08-24 12:08:39 -07:00
Tim Abbott d081703af8 contrib_bots: Expand documentation. 2016-08-22 19:53:16 -07:00
Steve Howell 38c7b611b6 bots: Add example bots for "followup" and "help".
This commit also starts to build out the infrastructure for
helping Zulip contributors to more easily author bots in
a way that sets up for running some bots on the server itself.
2016-08-22 19:43:12 -07:00