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.
This commit is contained in:
parent
2282000d78
commit
0419848d3c
42 changed files with 79 additions and 45 deletions
|
@ -6,7 +6,7 @@ from os.path import expanduser
|
|||
from six.moves import configparser as cp
|
||||
|
||||
home = expanduser('~')
|
||||
CONFIG_PATH = home + '/google-commute.ini'
|
||||
CONFIG_PATH = home + '/commute_bot.config'
|
||||
|
||||
class CommuteHandler(object):
|
||||
'''
|
||||
|
@ -89,10 +89,10 @@ class CommuteHandler(object):
|
|||
|
||||
# adds API Authentication Key to url request
|
||||
def get_api_key(self):
|
||||
# google-commute.ini must have been moved from
|
||||
# ~/zulip/contrib_bots/bots/commute_bot/CommuteBot/google-commute.ini into
|
||||
# /google-commute.ini for program to work
|
||||
# see doc.md for more information
|
||||
# commute_bot.config must have been moved from
|
||||
# ~/zulip/contrib_bots/bots/commute_bot/commute_bot.config into
|
||||
# /commute_bot.config for program to work
|
||||
# see readme.md for more information
|
||||
with open(CONFIG_PATH) as settings:
|
||||
config = cp.ConfigParser()
|
||||
config.readfp(settings)
|
||||
|
|
|
@ -11,24 +11,24 @@ units and information in various languages.
|
|||
The bot will respond to the same stream input was in. And if called as
|
||||
private message, the bot will reply with a private message.
|
||||
|
||||
To setup the bot, you will first need to move google-commute.ini into
|
||||
To setup the bot, you will first need to move commute_bot.config into
|
||||
the user home directory and add an API key.
|
||||
|
||||
Move
|
||||
|
||||
```
|
||||
~/zulip/contrib_bots/bots/commute_bot/CommuteBot/google-commute.ini
|
||||
~/zulip/contrib_bots/bots/commute_bot/commute_bot.config
|
||||
```
|
||||
|
||||
into
|
||||
|
||||
```
|
||||
~/google-commute.ini
|
||||
~/commute_bot.config
|
||||
```
|
||||
|
||||
To add an API key, please visit:
|
||||
https://developers.google.com/maps/documentation/distance-matrix/start
|
||||
to retrieve a key and copy your api key into google-commute.ini
|
||||
to retrieve a key and copy your api key into commute_bot.config
|
||||
|
||||
Sample input and output:
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue