diff options
| author | 2020-05-31 09:44:34 +0300 | |
|---|---|---|
| committer | 2020-05-31 09:44:34 +0300 | |
| commit | bb6cc2193cad398d68db29d4f991fce94ae06549 (patch) | |
| tree | 745c76c2c38a22d8ca4b2419a937f89734281f32 | |
| parent | Source: Implement tags file showing to source command (diff) | |
Source: Migrate from os.path to Path
| -rw-r--r-- | bot/cogs/source.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bot/cogs/source.py b/bot/cogs/source.py index 1c702f81d..21f18f45f 100644 --- a/bot/cogs/source.py +++ b/bot/cogs/source.py @@ -1,5 +1,5 @@ import inspect -import os +from pathlib import Path from typing import Union from discord import Embed @@ -22,9 +22,9 @@ class SourceConverter(Converter): if argument.lower() in tags_cog._cache: tag = argument.lower() if tags_cog._cache[tag]["restricted_to"] != "developers": - return f"bot/resources/tags/{tags_cog._cache[tag]['restricted_to']}/{tag}.md" + return f"/bot/bot/resources/tags/{tags_cog._cache[tag]['restricted_to']}/{tag}.md" else: - return f"bot/resources/tags/{tag}.md" + return f"/bot/bot/resources/tags/{tag}.md" cmd = ctx.bot.get_command(argument) if cmd: @@ -74,6 +74,7 @@ class BotSource(Cog): else: src = type(source_item) filename = inspect.getsourcefile(src) + print(filename) if not isinstance(source_item, str): lines, first_line_no = inspect.getsourcelines(src) @@ -81,7 +82,8 @@ class BotSource(Cog): else: lines_extension = "" - file_location = os.path.relpath(filename) + file_location = Path(filename).relative_to("/bot/") + print(file_location) return f"{URLs.github_bot_repo}/blob/master/{file_location}{lines_extension}" |