diff --git a/.gitignore b/.gitignore index 941ff36..e9d30ac 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,7 @@ venv.bak/ .mypy_cache/ /src/config/Config.json -/src/config/PrivateConfig.json \ No newline at end of file +/src/config/PrivateConfig.json + +# Ignore dockerfiles +docker-compose.yml \ No newline at end of file diff --git a/src/__main__.py b/src/__main__.py index 468225c..8b4ecd8 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -16,7 +16,7 @@ from discord.ext import commands from src.config.config import LoadConfig from src.shared_libs.loggable import Loggable -from src.shared_libs.ioutil import in_here +from src.shared_libs.ioutils import in_here # Init logging to output on INFO level to stderr. @@ -53,7 +53,7 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): for cog in cogs: # Could this just be replaced with `strip()`? cog = cog.replace('\n', '') - self.load_extension(f'{__name__}.cogs.{cog}') + self.load_extension(f'src.cogs.{cog}') self.logger.info(f'Loaded: {cog}') async def on_ready(self): @@ -93,11 +93,9 @@ class SebiMachine(commands.Bot, LoadConfig, Loggable): traceback.print_exc() -if __name__ == '__main__': - client = SebiMachine() - # Make sure the key stays private. - # I am 99% certain this is valid! - with open(f'{__name__}/config/PrivateConfig.json') as fp: - PrivateConfig = json.load(fp) - - client.run(PrivateConfig["bot-key"]) +client = SebiMachine() +# Make sure the key stays private. +# I am 99% certain this is valid! +with open(in_here('config', 'PrivateConfig.json')) as fp: + PrivateConfig = json.load(fp) +client.run(PrivateConfig["bot-key"]) diff --git a/src/shared_libs/ioutils.py b/src/shared_libs/ioutils.py index c0642fb..284f156 100644 --- a/src/shared_libs/ioutils.py +++ b/src/shared_libs/ioutils.py @@ -37,7 +37,7 @@ def in_here(first_path_bit: str, *path_bits: str, stack_depth: int=0) -> str: :returns: the absolute path to the given relative path provided. """ try: - frame = inspect.stack()[1 + nested_by] + frame = inspect.stack()[1 + stack_depth] except IndexError: raise RuntimeError('Could not find a stack record. Interpreter has ' 'been shot.')