impr: Add player repeat and shuffle, play artist and playlist. Code optimization.

This commit is contained in:
Lemon4ksan
2025-01-12 22:14:31 +03:00
parent a108799e63
commit b79e16fddf
9 changed files with 505 additions and 253 deletions

View File

@@ -1,8 +1,8 @@
import os
import logging
from dotenv import load_dotenv
import discord
from discord.errors import NotFound
from discord.ext.commands import Bot
try:
@@ -11,29 +11,33 @@ try:
except ImportError:
pass
intents = discord.Intents.all()
intents = discord.Intents.default()
intents.message_content = True
bot = Bot(intents=intents)
cogs_list = [
'general',
'voice'
]
for cog in cogs_list:
bot.load_extension(f'MusicBot.cogs.{cog}')
@bot.event
async def on_ready():
logging.info("Bot's ready!")
if __name__ == '__main__':
from dotenv import load_dotenv
load_dotenv()
if not os.path.exists('music'):
os.mkdir('music')
token = os.getenv('TOKEN')
if not token:
raise ValueError('You must specify the bot TOKEN in your enviroment')
for cog in cogs_list:
bot.load_extension(f'MusicBot.cogs.{cog}')
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s: %(message)s')
logging.getLogger('discord').setLevel(logging.INFO)
bot.run(token)