FEAT: Added a Logger

REF: Changed Spotify Module to use the logger now
This commit is contained in:
Dan
2024-06-21 13:08:45 -04:00
parent ecea3b93e0
commit 15ed750f8b
4 changed files with 104 additions and 6 deletions

17
main.py
View File

@ -8,17 +8,22 @@ class Selena(discord.Client):
self.tree = discord.app_commands.CommandTree(self)
async def setup_hook(self):
guild = discord.Object(id=config.DISCORD_GUILD_ID)
modules = ["modules.media.spotify_module"]
for module in modules:
await self.load_extension(module)
self.tree.copy_global_to(guild=guild)
await self.tree.sync(guild=guild)
await self.load_extensions()
await self.tree.sync()
async def load_extension(self, name):
module = __import__(name, fromlist=["setup"])
await module.setup(self)
async def load_extensions(self):
extensions = [
"modules.admin.logger_module",
"modules.media.spotify_module",
# Add other modules here
]
for extension in extensions:
await self.load_extension(extension)
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')