33 lines
753 B
Python
33 lines
753 B
Python
import os
|
|
import discord
|
|
import logging
|
|
from discord.ext import commands
|
|
from Functionnalities import Audio_Player
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
intents = discord.Intents.default()
|
|
intents.message_content = True
|
|
|
|
bot = commands.Bot(command_prefix="!", intents=intents)
|
|
player = Audio_Player.Audio_Player()
|
|
|
|
@bot.command()
|
|
async def play(ctx, url: str):
|
|
try:
|
|
await player.play(ctx, url)
|
|
except Exception as e:
|
|
await ctx.send(f"An error occurred: {e}")
|
|
print(f"Error: {e}")
|
|
|
|
@bot.command()
|
|
async def stop(ctx):
|
|
try:
|
|
await player.stop(ctx)
|
|
except Exception as e:
|
|
await ctx.send(f"An error occurred: {e}")
|
|
print(f"Error: {e}")
|
|
|
|
token = os.getenv("DISCORD_TOKEN")
|
|
bot.run(token) |