diff options
| author | 2020-06-18 08:58:18 +0300 | |
|---|---|---|
| committer | 2020-06-18 08:58:18 +0300 | |
| commit | 31f53259fd73503399b904e5a7075ceeded4c742 (patch) | |
| tree | 422386fb4e8611325002eadada2b89782933bc3f | |
| parent | Source: Simplify missing tag cog handling (diff) | |
Source: Split handling tag and other source items file location
| -rw-r--r-- | bot/cogs/source.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/cogs/source.py b/bot/cogs/source.py index d59371c6e..2ca852af3 100644 --- a/bot/cogs/source.py +++ b/bot/cogs/source.py @@ -82,7 +82,12 @@ class BotSource(commands.Cog): first_line_no = None lines_extension = "" - file_location = Path(filename).relative_to("/bot/") + # Handle tag file location differently than others to avoid errors in some cases + if not first_line_no: + file_location = Path(filename).relative_to("/bot/") + else: + file_location = Path(filename).relative_to(Path.cwd()).as_posix() + url = f"{URLs.github_bot_repo}/blob/master/{file_location}{lines_extension}" return url, file_location, first_line_no or None |