2024-07-20 18:45:02 -04:00
|
|
|
import discord
|
2024-09-17 10:22:43 -04:00
|
|
|
from discord.ext import commands
|
|
|
|
import asyncio
|
|
|
|
import os
|
|
|
|
from dotenv import load_dotenv
|
2024-07-20 18:45:02 -04:00
|
|
|
|
2024-09-17 10:22:43 -04:00
|
|
|
# Load environment variables
|
|
|
|
load_dotenv()
|
|
|
|
TOKEN = os.getenv('DISCORD_TOKEN')
|
2024-07-20 18:45:02 -04:00
|
|
|
|
2024-09-17 10:22:43 -04:00
|
|
|
# Import the Music module
|
|
|
|
from modules.music import Music
|
2024-07-20 18:45:02 -04:00
|
|
|
|
|
|
|
intents = discord.Intents.default()
|
2024-09-17 10:22:43 -04:00
|
|
|
intents.message_content = True # Required for accessing message content
|
2024-07-20 18:45:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Selena(discord.Client):
|
2024-09-17 10:22:43 -04:00
|
|
|
def __init__(self, *, intents):
|
2024-07-20 18:45:02 -04:00
|
|
|
super().__init__(intents=intents)
|
|
|
|
self.tree = discord.app_commands.CommandTree(self)
|
2024-09-17 10:22:43 -04:00
|
|
|
|
|
|
|
# Initialize modules
|
|
|
|
self.music = Music(self)
|
2024-07-20 18:45:02 -04:00
|
|
|
|
|
|
|
async def setup_hook(self):
|
2024-09-17 10:22:43 -04:00
|
|
|
# Sync the app commands with Discord
|
2024-09-17 11:48:01 -04:00
|
|
|
self.loop.create_task(self.music.auto_resume_playback())
|
2024-09-17 10:22:43 -04:00
|
|
|
await self.tree.sync()
|
|
|
|
|
|
|
|
|
|
|
|
client = Selena(intents=intents)
|
|
|
|
|
|
|
|
# Run the bot
|
|
|
|
client.run(TOKEN)
|