add dev/prod mode specification

This commit is contained in:
LBlend committed 2022-11-17 05:24:13 +01:00
1 parent 2c94de4c93
commit a987ff6d3f
2 files changed
+8 -2

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
config_mode: dev
# Bot settings
bot:
token:
+6 -2
View File
@@ -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