diff --git a/main.py b/main.py index 4010eb0..59b4814 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,6 @@ from discord.ext import commands # Suppress noise about console usage from errors youtube_dl.utils.bug_reports_message = lambda: '' - ytdl_format_options = { 'format': 'bestaudio/best', 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s', @@ -18,7 +17,7 @@ ytdl_format_options = { 'quiet': True, 'no_warnings': True, 'default_search': 'auto', - 'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes + 'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes } ffmpeg_options = { @@ -56,36 +55,12 @@ class Music(commands.Cog): @commands.command() async def join(self, ctx, *, channel: discord.VoiceChannel): - """Joins a voice channel""" - if ctx.voice_client is not None: return await ctx.voice_client.move_to(channel) - await channel.connect() @commands.command() - async def play(self, ctx, *, query): - """Plays a file from the local filesystem""" - - source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query)) - ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None) - - await ctx.send('Now playing: {}'.format(query)) - - @commands.command() - async def yt(self, ctx, *, url): - """Plays from a url (almost anything youtube_dl supports)""" - - async with ctx.typing(): - player = await YTDLSource.from_url(url, loop=self.bot.loop) - ctx.voice_client.play("ffmpeg.exe", after=lambda e: print('Player error: %s' % e) if e else None) - - await ctx.send('Now playing: {}'.format(player.title)) - - @commands.command() - async def stream(self, ctx, *, url): - """Streams from a url (same as yt, but doesn't predownload)""" - + async def play(self, ctx, *, url): async with ctx.typing(): player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True) ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None) @@ -109,8 +84,6 @@ class Music(commands.Cog): await ctx.voice_client.disconnect() @play.before_invoke - @yt.before_invoke - @stream.before_invoke async def ensure_voice(self, ctx): if ctx.voice_client is None: if ctx.author.voice: