2024-06-24 20:42:30 -04:00
|
|
|
import discord
|
|
|
|
from config import config
|
2024-06-25 12:55:25 -04:00
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
2024-06-24 20:42:30 -04:00
|
|
|
|
|
|
|
TOKEN = config['DISCORD_TOKEN']
|
|
|
|
GUILD_ID = config['GUILD_ID']
|
|
|
|
|
|
|
|
intents = discord.Intents.default()
|
2024-07-01 22:30:34 -04:00
|
|
|
intents.message_content = True
|
2024-06-24 20:42:30 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Selena(discord.Client):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(intents=intents)
|
|
|
|
self.tree = discord.app_commands.CommandTree(self)
|
2024-07-01 22:30:34 -04:00
|
|
|
self.xp_module = None # Initialize as None
|
2024-06-24 20:42:30 -04:00
|
|
|
self.load_modules()
|
|
|
|
|
2024-06-25 12:55:25 -04:00
|
|
|
async def setup_hook(self):
|
|
|
|
logging.info("Setting up modules...")
|
|
|
|
self.tree.copy_global_to(guild=discord.Object(id=GUILD_ID))
|
|
|
|
await self.tree.sync(guild=discord.Object(id=GUILD_ID))
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Modules setup and commands synchronized")
|
|
|
|
# Call setup_hook for xp_module here
|
|
|
|
if self.xp_module:
|
|
|
|
await self.xp_module.setup_hook()
|
2024-06-25 12:55:25 -04:00
|
|
|
|
2024-06-24 20:42:30 -04:00
|
|
|
def load_modules(self):
|
|
|
|
if config['modules']['currency']['enabled']:
|
|
|
|
from modules.user.currency import Currency
|
|
|
|
currency = Currency(self)
|
|
|
|
currency.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Currency module loaded")
|
2024-06-24 20:42:30 -04:00
|
|
|
|
2024-06-24 23:20:03 -04:00
|
|
|
if config['modules']['xp']['enabled']:
|
|
|
|
from modules.user.xp import XP
|
|
|
|
xp = XP(self)
|
|
|
|
xp.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
self.xp_module = xp # Set the xp_module attribute
|
|
|
|
logging.info("XP module loaded")
|
2024-06-24 23:20:03 -04:00
|
|
|
|
2024-06-25 15:35:40 -04:00
|
|
|
if config['modules']['birthday']['enabled']:
|
|
|
|
from modules.user.birthday import Birthday
|
|
|
|
birthday = Birthday(self)
|
|
|
|
birthday.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Birthday module loaded")
|
2024-06-25 15:35:40 -04:00
|
|
|
|
2024-06-25 20:06:10 -04:00
|
|
|
if config['modules']['destiny2']['enabled']:
|
2024-07-03 22:37:05 -04:00
|
|
|
from modules.social.destiny2 import Destiny2
|
2024-06-25 20:06:10 -04:00
|
|
|
destiny2 = Destiny2(self)
|
|
|
|
destiny2.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Destiny 2 module loaded")
|
2024-06-25 20:06:10 -04:00
|
|
|
|
2024-06-25 22:23:15 -04:00
|
|
|
if config['modules']['music']['enabled']:
|
|
|
|
from modules.music.music import Music
|
|
|
|
music = Music(self)
|
|
|
|
music.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Music module loaded")
|
2024-06-25 22:23:15 -04:00
|
|
|
|
2024-06-26 16:00:43 -04:00
|
|
|
if config['modules']['youtube']['enabled']:
|
|
|
|
from modules.social.youtube import YouTube
|
|
|
|
youtube = YouTube(self)
|
|
|
|
youtube.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("YouTube module loaded")
|
2024-06-26 16:00:43 -04:00
|
|
|
|
2024-06-26 22:00:44 -04:00
|
|
|
if config['modules']['twitch']['enabled']:
|
|
|
|
from modules.social.twitch import Twitch
|
|
|
|
twitch = Twitch(self)
|
|
|
|
twitch.setup(self.tree)
|
2024-07-03 11:43:28 -04:00
|
|
|
self.twitch_module = twitch
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Twitch module loaded")
|
2024-06-26 22:00:44 -04:00
|
|
|
|
2024-06-27 11:35:22 -04:00
|
|
|
if config['modules']['update']['enabled']:
|
2024-06-30 17:55:41 -04:00
|
|
|
from modules.admin.update import Update
|
|
|
|
update = Update(self)
|
|
|
|
update.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Update module loaded")
|
2024-06-27 11:35:22 -04:00
|
|
|
|
2024-06-30 17:35:51 -04:00
|
|
|
if config['modules']['data_privacy']['enabled']:
|
2024-06-30 17:55:41 -04:00
|
|
|
from modules.admin.data_privacy import DataPrivacy
|
|
|
|
data_privacy = DataPrivacy(self)
|
|
|
|
data_privacy.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Data Privacy module loaded")
|
2024-06-30 17:55:41 -04:00
|
|
|
|
|
|
|
if config['modules']['terms_privacy']['enabled']:
|
|
|
|
from modules.admin.terms_privacy import TermsPrivacy
|
|
|
|
terms_privacy = TermsPrivacy(self)
|
|
|
|
terms_privacy.setup(self.tree)
|
2024-07-01 22:30:34 -04:00
|
|
|
logging.info("Terms and Privacy module loaded")
|
2024-06-30 17:35:51 -04:00
|
|
|
|
2024-07-03 22:37:05 -04:00
|
|
|
if config['modules']['knucklebones']['enabled']:
|
2024-07-03 23:15:22 -04:00
|
|
|
from modules.games.knucklebones import setup as knucklebones_setup
|
|
|
|
knucklebones_setup(self)
|
2024-07-03 22:37:05 -04:00
|
|
|
logging.info("Knucklebones module loaded")
|
|
|
|
|
2024-07-05 17:19:28 -04:00
|
|
|
if config['modules']['wordle']['enabled']:
|
|
|
|
from modules.games.wordle import setup as wordle_setup
|
|
|
|
wordle_setup(self)
|
|
|
|
logging.info("Wordle module loaded")
|
|
|
|
|
2024-07-04 13:55:30 -04:00
|
|
|
if config['modules']['profiles']['enabled']:
|
|
|
|
from modules.user.profiles import Profiles
|
|
|
|
profiles = Profiles(self)
|
|
|
|
profiles.setup(self.tree)
|
2024-07-04 17:16:27 -04:00
|
|
|
self.profiles = profiles # Properly set the profiles attribute
|
2024-07-04 13:55:30 -04:00
|
|
|
logging.info("Profiles module loaded")
|
|
|
|
|
2024-07-10 12:10:30 -04:00
|
|
|
if config['modules']['tiktok']['enabled']:
|
|
|
|
from modules.social.tiktok import TikTok
|
|
|
|
tiktok = TikTok(self)
|
|
|
|
tiktok.setup(self.tree)
|
|
|
|
logging.info("TikTok module loaded")
|
|
|
|
|
2024-06-24 20:42:30 -04:00
|
|
|
|
|
|
|
bot = Selena()
|
|
|
|
|
|
|
|
|
|
|
|
@bot.event
|
|
|
|
async def on_ready():
|
2024-06-25 15:35:40 -04:00
|
|
|
logging.info(f'{bot.user.name} has connected to Discord!')
|
2024-06-24 20:42:30 -04:00
|
|
|
|
2024-07-01 22:30:34 -04:00
|
|
|
|
|
|
|
@bot.event
|
|
|
|
async def on_message(message):
|
|
|
|
logging.debug(f"Message from {message.author}: {message.content}")
|
|
|
|
if message.author == bot.user:
|
|
|
|
return
|
|
|
|
if bot.xp_module:
|
|
|
|
await bot.xp_module.handle_message(message)
|
|
|
|
|
2024-06-24 20:42:30 -04:00
|
|
|
bot.run(TOKEN)
|