zulip_bots: Add function to get path to a bot's doc.md file.

This is part of our efforts to have the documentation for a
particular bot live in this repo but still be able to render it
in the main repo (in a way similar to how we render the webhooks
docs).

This function allows us to specify the path to a bot's doc.md file
in zerver.lib.integrations.BotIntegration.
This commit is contained in:
Eeshan Garg 2017-08-15 20:51:41 -02:30 committed by Tim Abbott
parent 5bb1cbf8d0
commit e0cafd1fdb

View file

@ -40,6 +40,10 @@ def get_bots_directory_path():
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.join(current_dir, 'bots') return os.path.join(current_dir, 'bots')
def get_bot_doc_path(name):
# type: (str) -> str
return os.path.join(get_bots_directory_path(), '{}/doc.md'.format(name))
class RateLimit(object): class RateLimit(object):
def __init__(self, message_limit, interval_limit): def __init__(self, message_limit, interval_limit):
# type: (int, int) -> None # type: (int, int) -> None