selena/main.py
Dan 39603b1e06 REF: Made sure everything conforms to Flake8's standards
FIX: Fixed the Permission issues with logger
FEAT: Changed how the XP system works. Now does a scaling curve with xp being 1-5
2024-06-22 08:55:26 -04:00

53 lines
1.4 KiB
Python

import logging
import discord
import config
# Set up logging
logging.basicConfig(level=logging.DEBUG)
class Selena(discord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.tree = discord.app_commands.CommandTree(self)
async def setup_hook(self):
guild = discord.Object(id=config.DISCORD_GUILD_ID)
await self.load_extensions()
self.tree.copy_global_to(guild=guild)
await self.tree.sync(guild=guild)
async def load_extension(self, name):
module = __import__(name, fromlist=["setup"])
await module.setup(self)
async def load_extensions(self):
# Mandatory modules that cannot be disabled
mandatory_modules = [
"modules.admin.logger_module",
"modules.admin.policy_module",
]
# Load mandatory modules
for extension in mandatory_modules:
await self.load_extension(extension)
# Load enabled modules from configuration
for extension in config.ENABLED_MODULES:
await self.load_extension(extension)
async def on_ready(self):
print(f"Logged in as {self.user} (ID: {self.user.id})")
print("------")
if __name__ == "__main__":
# Enable message content intent
intents = discord.Intents.default()
intents.message_content = True
client = Selena(intents=intents)
client.run(config.DISCORD_TOKEN)