From aee564825f41f0d7e1484ae3f9c5f2647056d52e Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Tue, 15 Aug 2017 19:45:17 -0230 Subject: [PATCH] zulip_bots: Add function to get absolute path to the bots/ dir. 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 the calling code to get the absolute path to the bots/ directory. This will allow us to specify an arbitrary path (jinja2.env.loader.searchpath) to look for templates for bots' documentation. --- zulip_bots/zulip_bots/lib.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index b545a5c..493ab39 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -35,6 +35,11 @@ def get_bot_logo_path(name): return None +def get_bots_directory_path(): + # type: () -> str + current_dir = os.path.dirname(os.path.abspath(__file__)) + return os.path.join(current_dir, 'bots') + class RateLimit(object): def __init__(self, message_limit, interval_limit): # type: (int, int) -> None