From d88ab63c2bc4755a9ce137d9d8ab6dda5f876e4a Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 24 Sep 2021 22:15:45 +0200 Subject: [PATCH] Remove unnecessary code --- src/bot.py | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/bot.py b/src/bot.py index d1b16d0..826ab6b 100644 --- a/src/bot.py +++ b/src/bot.py @@ -1,7 +1,6 @@ import os import sys -import discord from discord.ext import commands from dotenv import load_dotenv @@ -14,37 +13,9 @@ class Music(commands.Cog): def __init__(self, bot): self.bot = bot - @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(f"Player error: {e}") if e else None) - - await ctx.send(f"Now playing: {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(player, after=lambda e: print(f"Player error: {e}") if e else None) - - await ctx.send(f"Now playing: {player.title}") - @commands.command() async def stream(self, ctx, *, url): - """Streams from a url (same as yt, but doesn't predownload)""" + """Streams from a url""" async with ctx.typing(): player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True) @@ -52,24 +23,11 @@ class Music(commands.Cog): await ctx.send(f"Now playing: {player.title}") - @commands.command() - async def volume(self, ctx, volume: int): - """Changes the player's volume""" - - if ctx.voice_client is None: - return await ctx.send("Not connected to a voice channel.") - - ctx.voice_client.source.volume = volume / 100 - await ctx.send(f"Changed volume to {volume}%") - @commands.command() async def stop(self, ctx): """Stops and disconnects the bot from voice""" - 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: