diff --git a/main.py b/main.py index e7e3d16..14db5b7 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,7 @@ import random import discord from discord.ext import commands from discord.utils import get +import youtube_dl from dotenv import load_dotenv load_dotenv() @@ -48,8 +49,10 @@ def restart_bot(): @bot.command(aliases=['reboot']) async def restart(ctx): """Reboot bot""" + bot.current_ctx = ctx print("Rebooting...") - embedDeco=discord.Embed(title="~~⚗️ ModBot~~ PolaroBot Statut.. 🛠️ ", description="""~~Modbot~~ PolaroBot Redémarre : Patientez quelques secondes.. """, color=0xF1D50E) + embedDeco=discord.Embed(title="🤖PolaroBot Statut", + description="PolaroBot Redémarre : Patientez quelques secondes.. ",color=0xF1D50E) await ctx.send(embed=embedDeco) restart_bot() @@ -57,19 +60,24 @@ async def restart(ctx): async def play(ctx, url: str): """Playing a song""" if is_a_youtube_url(url): - embedPlaying=discord.Embed(title="P0l4r0B0T is playing", description=f"Je sais pas encore jouer de musique mais tkt frère, vla ton URL mon reuf : {url}") + embedPlaying=discord.Embed(title="🤖PolaroBot is playing", description=f"Je sais pas encore jouer de musique mais tkt frère, vla ton URL mon reuf : {url}") embedPlaying.set_image(url=random_playing_gif()) + else: - embedPlaying=discord.Embed(title="PolaroBot veut casser ta gueule", description=f"FREROT ?! C'EST QUOI {url} ? C'EST DE LA MERDE ! !") + embedPlaying=discord.Embed(title="🤖PolaroBot veut casser ta gueule", description=f"FREROT ?! C'EST QUOI {url} ? C'EST DE LA MERDE 💩💩💩 ! ") embedPlaying.set_image(url="https://media.tenor.com/wQH1Lm24wLwAAAAM/de-la-merde-jean.gif") await ctx.send(embed=embedPlaying) @bot.command() async def join(ctx): channel = ctx.author.voice.channel - print(f"Voice : connecting to {channel.id}") - bot.voice_channel = await channel.connect() - + if channel: + print(f"Voice : connecting to {channel.id}") + bot.voice_channel = await channel.connect() + embedMessage=discord.Embed(title="PolaroBot connected", description=f"PolaroBot has connected to {ctx.author}'s channel") + else: + embedMessage=discord.Embed(title="PolaroBot can't connect", description=f"Are you connected to a voice channel ?") + await ctx.send(embed=embedMessage) @bot.command() async def leave(ctx): print(f"Voice : leaving {bot.voice_channel.id}") @@ -82,4 +90,5 @@ async def on_command_error(ctx, error): await ctx.send("Missing required argument: {}".format(error.param)) elif isinstance(error, commands.BadArgument): ctx.send(channel, "Could not parse commands argument.") + bot.run(TOKEN)