bots: Move contrib_bots to api/bots*.

This will make it convenient to include these bots in Zulip API
releases on pypi.

Fix #5009.
This commit is contained in:
Rohitt Vashishtha 2017-05-30 11:40:19 +05:30 committed by Tim Abbott
parent 7531c4fb26
commit 894adb1e43
110 changed files with 36 additions and 27 deletions

View file

@ -80,7 +80,7 @@ class CommuteHandler(object):
# adds API Authentication Key to url request
def get_api_key(self):
# commute.config must be moved from
# ~/zulip/contrib_bots/bots/commute/commute.config into
# ~/zulip/api/bots/commute/commute.config into
# ~/commute.config for program to work
# see readme.md for more information
with open(CONFIG_PATH) as settings:

View file

@ -17,7 +17,7 @@ the user home directory and add an API key.
Move
```
~/zulip/contrib_bots/bots/commute/commute.config
~/zulip/api/bots/commute/commute.config
```
into

View file

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View file

@ -7,6 +7,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -7,6 +7,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 287 KiB

View file

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View file

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

View file

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

View file

@ -7,6 +7,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

@ -9,11 +9,11 @@ from six.moves import configparser as cp
from six.moves import range
home = expanduser('~')
CONFIG_PATH = home + '/zulip/contrib_bots/bots/foursquare/foursquare.config'
CONFIG_PATH = home + '/zulip/api/bots/foursquare/foursquare.config'
def get_api_key():
# foursquare.config must have been moved from
# ~/zulip/contrib_bots/bots/foursquare/foursquare.config into
# ~/zulip/api/bots/foursquare/foursquare.config into
# ~/foursquare.config for program to work
# see readme.md for more information
with open(CONFIG_PATH) as settings:

View file

@ -26,8 +26,8 @@ github_token = <oauth_token> (The personal access token for the GitHub bot)
Here is an example of running the `git_hub_comment` bot from
inside a Zulip repo:
`cd ~/zulip/contrib_bots`
`./run.py bots/git_hub_comment/git_hub_comment.py --config-file ~/.zuliprc-prod`
`cd ~/zulip/api`
`bots_api/run.py bots/git_hub_comment/git_hub_comment.py --config-file ~/.zuliprc-prod`
Once the bot code starts running, you will see a
message explaining how to use the bot, as well as

View file

@ -8,6 +8,7 @@ import sys
from six.moves import zip
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

@ -8,6 +8,7 @@ import sys
from six.moves import zip
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View file

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View file

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View file

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View file

@ -11,14 +11,14 @@ except ImportError:
raise ImportError("""It looks like you are missing chatterbot.
Please: pip install chatterbot""")
CONTRIB_BOTS_DIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.dirname(CONTRIB_BOTS_DIR))
sys.path.insert(0, os.path.dirname(CONTRIB_BOTS_DIR))
BOTS_DIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.dirname(BOTS_DIR))
sys.path.insert(0, os.path.dirname(BOTS_DIR))
JOKES_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var/jokes.json')
DATABASE_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var/database.db')
DIRECTORY_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets')
VAR_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var')
JOKES_PATH = os.path.join(BOTS_DIR, 'assets/var/jokes.json')
DATABASE_PATH = os.path.join(BOTS_DIR, 'assets/var/database.db')
DIRECTORY_PATH = os.path.join(BOTS_DIR, 'assets')
VAR_PATH = os.path.join(BOTS_DIR, 'assets/var')
if not os.path.exists(DIRECTORY_PATH):
os.makedirs(DIRECTORY_PATH)

View file

@ -29,8 +29,8 @@ to messages in any of the following settings:
Here is an example of running the "follow-up" bot from
inside a Zulip repo (and in your remote instance):
cd ~/zulip/contrib_bots
./run.py bots/followup/followup.py --config-file ~/.zuliprc-prod
cd ~/zulip/api
bots_api/run.py bots/followup/followup.py --config-file ~/.zuliprc-prod
Once the bot code starts running, you will see a
message explaining how to use the bot, as well as

View file

@ -7,6 +7,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

@ -1,4 +1,4 @@
# See zulip/contrib_bots/bots/readme.md for instructions on running this code.
# See zulip/api/bots/readme.md for instructions on running this code.
from __future__ import print_function
import sys
import logging

View file

@ -7,6 +7,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -7,6 +7,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View file

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -8,6 +8,7 @@ import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')

View file

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 229 KiB

View file

@ -44,8 +44,8 @@ If you need help while the bot is running just input `@mention-bot help`.
Here is an example of running the "yoda" bot from
inside a Zulip repo:
cd ~/zulip/contrib_bots
./run.py bots/yoda/yoda.py --config-file ~/.zuliprc-prod
cd ~/zulip/api
bots_api/run.py bots/yoda/yoda.py --config-file ~/.zuliprc-prod
Once the bot code starts running, you will see a
message explaining how to use the bot, as well as

Some files were not shown because too many files have changed in this diff Show more