From a987ff6d3f12421c1f547264b0dc5e57d2cfef09 Mon Sep 17 00:00:00 2001 From: LBlend Date: Thu, 17 Nov 2022 05:24:13 +0100 Subject: [PATCH] add dev/prod mode specification --- src/config/config.yaml.example | 2 ++ src/run.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config/config.yaml.example b/src/config/config.yaml.example index 3c6870f..d2343c9 100644 --- a/src/config/config.yaml.example +++ b/src/config/config.yaml.example @@ -1,3 +1,5 @@ +config_mode: dev + # Bot settings bot: token: diff --git a/src/run.py b/src/run.py index 5fbb194..25f3bf9 100644 --- a/src/run.py +++ b/src/run.py @@ -40,6 +40,7 @@ class Bot(commands.Bot): self.api_keys = config.get("api", {}) self.emoji = config.get("emoji", {}) self.misc = config.get("misc", {}) + self.config_mode = config.get("mode") async def setup_hook(self) -> None: # Load cogs @@ -49,8 +50,11 @@ class Bot(commands.Bot): await bot.load_extension(f"cogs.{name}") # Sync slash commands to Discord - self.tree.copy_global_to(guild=discord.Object(id=412646636771344395)) # Temporary. Development purposes only. - await self.tree.sync(guild=discord.Object(id=412646636771344395)) # Temporary. Development purposes only. + if self.config_mode == 'prod': + await self.tree.sync() + else: + self.tree.copy_global_to(guild=discord.Object(id=412646636771344395)) + await self.tree.sync(guild=discord.Object(id=412646636771344395)) # Create bot instance