Commit Graph

120 Commits

Author SHA1 Message Date
Abhijeet Kaur c921736db2 contrib bots: Better error handling response in thesaurus. 2017-03-14 13:29:19 -07:00
Abhijeet Kaur 36bbad3c14 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 d90906c521 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 57d026f4c9 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 6e28bc20c6 contrib bots: Rename bots to follow a consistent pattern.
Files renamed without any changes.
2017-03-14 13:29:19 -07:00
Umair Khan 3b05937e86 capitalization: Fix API Key in documentation. 2017-03-08 23:36:36 -08:00
Abhijeet Kaur b8341280e8 doc updates: Remove triage_message function from contrib-bots. 2017-03-07 22:23:11 -08:00
Abhijeet Kaur d2929b04ca 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 b22e9a0dbf 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 87e8d9036f 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 ef72cf5c7c 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 71247048b4 bots: Use requests instead of unirest for Yoda bot.
Fixes #3500.
2017-02-06 22:07:38 -08:00
Yago González 1535739222 contrib_bots: Fix typos and repetitions in the readme. 2017-01-27 16:39:19 -08:00
Tim Abbott 4e171ce787 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott de99f48ce7 lint: Clean up E401 PEP-8 rule. 2017-01-23 21:36:39 -08:00
Tim Abbott d6e38e2a5c lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott 9640a9e864 lint: Clean up E712 PEP-8 rule. 2017-01-23 21:11:18 -08:00
Tim Abbott e5daec46ec lint: Clean up E306 PEP-8 rule. 2017-01-23 21:05:08 -08:00
Tim Abbott e9158dd520 lint: Clean up E121 PEP-8 rule. 2017-01-23 21:02:39 -08:00
Tim Abbott 22d1aa396b lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
Tim Abbott bde2da7dfd lint: clean up PEP-8 W391 rule. 2017-01-23 20:39:02 -08:00
Steve Howell b37203cc83 Fix lint error w/ClientDummy. 2017-01-22 05:51:33 -08:00
Robert Hönig bef93959d3 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 4415d6085f 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 c0fdc451a0 interactive bots: create EncryptBot bot 2017-01-17 09:13:33 -08:00
Robert Hönig effaa75625 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 44233cef4b 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 b8fbfe305f Remove superfluous comment in triage_message(). (#3291) 2017-01-13 10:21:45 -08:00
Juan Verhook 4d500e626e interactive bots: Create your own virtual assistant 2017-01-13 07:22:04 -08:00
Maydha K dd23e09592 interactive bots: Create tic-tac-toe bot. 2017-01-12 17:26:19 -08:00
Jackson 591efe2d64 interactive bots: Add FourSquare bot and documentation. 2017-01-12 16:51:13 -08:00
royabouhamad aa14627b07 Interactive bots: Create a thesaurus bot. 2017-01-12 13:07:12 -08:00
Robert Hönig 8b6a28dfa6 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 a232060e18 docs: improve docs for contrib_bots. 2017-01-11 16:32:02 -08:00
Robert Hönig 639c4023bc 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 f9730e774a 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 02bfb46398 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 6d3ea3f663 contrib_bots: Fix lint error in rate limiting code. 2017-01-10 15:10:17 -08:00
Robert Hönig 3efbadc37b 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 dd8291bb50 Improved 'readme.md' file in contrib_bots/lib 2017-01-10 07:03:57 -08:00
Tim Abbott 3f8d4193da lint: Fix % comprehensions being used without a tuple. 2017-01-09 11:45:11 -08:00
Tommy Ip 7738edb62f contrib_bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tim Abbott 9289c75f54 contrib_bots: Wrap CommuteBot docs. 2017-01-05 14:58:06 -08:00
andrewallen00 b376875541 interactive bots: Create yoda translator bot 2017-01-05 11:24:24 -08:00
Robert Hönig f7c29f1b7f interactive bots: Create converter bot. 2016-12-29 19:28:35 +01:00
Yago González 497dc4756e 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 778e509464 interactive bots: Create xkcd bot. 2016-12-27 22:52:51 +01:00
Vamshi Balanaga 561562da3d Modify GitHub Issue bot to use new authentication module. 2016-12-27 11:58:36 -08:00
Vamshi Balanaga 9701d5e555 Modify GitHub comment bot to use new authentication module, and edit documentation accordingly. 2016-12-27 11:58:36 -08:00
Vamshi Balanaga 89d1f96db9 Create GitHub authentication module. 2016-12-27 11:58:36 -08:00
Rafid Aslam fd5c43341d interactive bots: Create Giphy bot 2016-12-26 09:38:50 -08:00
Rafid Aslam 947fdf0b37 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 13a1425bb7 Created DefineBot and document and added them 2016-12-26 09:07:10 -08:00
Tommy Ip 654d9590ef 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 62f88aa776 interactive bots: Create CommuteBot. 2016-12-21 18:46:59 -08:00
= f83139e28c Interactive bots: Create Github Issues bot. 2016-12-19 21:57:21 -08:00
andrewallen00 cdef7ede83 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 2dffe5c95a 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 af857d883b contrib_bots: Add "Python dependencies" to docs. 2016-12-14 15:03:51 -08:00
Steve Howell 45e4edf105 contrib_bots: Add "Third Party Configuration" to docs. 2016-12-14 15:03:51 -08:00
lonerz 8f97a811c4 interactive bots: Create Wikipedia bot. 2016-12-13 13:46:11 -08:00
reallyly 94b28e0afb pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
2016-12-13 10:50:14 -08:00
Anders Kaseorg 207cf6302b 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 f0b8f741b9 contrib_bots: Simulate a file system with a bot. 2016-10-16 14:41:24 -07:00
Steve Howell ff5a2b21d0 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 058587da77 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 6af0bdfe6e bots: Add --config-file to contrib_bots/run.py. 2016-08-24 12:09:11 -07:00
Steve Howell acb3c6b75a bots: Fix typo in contrib_bots/lib/readme.md. 2016-08-24 12:08:39 -07:00
Tim Abbott 3d83f25b15 contrib_bots: Expand documentation. 2016-08-22 19:53:16 -07:00
Steve Howell 8d0c68ac39 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