From 9d49fa0ae13900be5f14d237f92c43d11d85dfc9 Mon Sep 17 00:00:00 2001 From: Shakya Majumdar Date: Fri, 21 Jan 2022 20:21:33 +0530 Subject: [PATCH] rework directory structure --- .gitignore | 2 +- bot/exts/fun/{latex/_latex_cog.py => latex.py} | 9 +++++++-- bot/exts/fun/latex/__init__.py | 7 ------- .../template.txt => resources/fun/latex_template.txt} | 0 4 files changed, 8 insertions(+), 10 deletions(-) rename bot/exts/fun/{latex/_latex_cog.py => latex.py} (94%) delete mode 100644 bot/exts/fun/latex/__init__.py rename bot/{exts/fun/latex/template.txt => resources/fun/latex_template.txt} (100%) diff --git a/.gitignore b/.gitignore index 765f33c6de..665df8cca7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # bot (project-specific) log/* data/* -bot/exts/fun/latex/cache/* +bot/exts/fun/_latex_cache/* diff --git a/bot/exts/fun/latex/_latex_cog.py b/bot/exts/fun/latex.py similarity index 94% rename from bot/exts/fun/latex/_latex_cog.py rename to bot/exts/fun/latex.py index 72d48b2a00..ac43e95bb1 100644 --- a/bot/exts/fun/latex/_latex_cog.py +++ b/bot/exts/fun/latex.py @@ -23,9 +23,9 @@ PASTEBIN_URL = "https://paste.pythondiscord.com" THIS_DIR = Path(__file__).parent -CACHE_DIRECTORY = THIS_DIR / "cache" +CACHE_DIRECTORY = THIS_DIR / "_latex_cache" CACHE_DIRECTORY.mkdir(exist_ok=True) -TEMPLATE = string.Template((THIS_DIR / "template.txt").read_text()) +TEMPLATE = string.Template(Path("bot/resources/fun/latex_template.txt").read_text()) def _prepare_input(text: str) -> str: @@ -101,3 +101,8 @@ async def latex(self, ctx: commands.Context, *, query: str) -> None: image_path.unlink() return await ctx.send(file=discord.File(image_path, "latex.png")) + + +def setup(bot: Bot) -> None: + """Load the Latex Cog.""" + bot.add_cog(Latex(bot)) diff --git a/bot/exts/fun/latex/__init__.py b/bot/exts/fun/latex/__init__.py deleted file mode 100644 index e58e0447bd..0000000000 --- a/bot/exts/fun/latex/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from bot.bot import Bot -from bot.exts.fun.latex._latex_cog import Latex - - -def setup(bot: Bot) -> None: - """Load the Latex Cog.""" - bot.add_cog(Latex(bot)) diff --git a/bot/exts/fun/latex/template.txt b/bot/resources/fun/latex_template.txt similarity index 100% rename from bot/exts/fun/latex/template.txt rename to bot/resources/fun/latex_template.txt