diff --git a/cogs/admin.py b/cogs/admin.py index dceaf0c..3ced113 100644 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -1221,44 +1221,6 @@ class Administration: except IndexError: await ctx.send("That is not a valid rule number, try running the command again.") - @commands.command() - @commands.guild_only() - @utils.custom_perms(manage_guild=True) - @utils.check_restricted() - async def queuetype(self, ctx, new_type=None): - """Switches the song queue type for music - Choices are `user` or `song` queue - The `user` queue rotates off of a wait list, where people join the waitlist and the next song in their - playlist is the one that is played. - - The `song` queue rotates based on songs themselves, where people add a song to the server's playlist, - and these are rotated through. - - EXAMPLE: !queuetype user - RESULT: !queuetype """ - key = str(ctx.message.guild.id) - - if new_type is None: - cur_type = self.bot.db.load('server_settings', key=key, pluck='queue_type') or 'song' - await ctx.send("Current queue type is {}".format(cur_type)) - return - - new_type = new_type.lower().strip() - if new_type not in ['user', 'song']: - await ctx.send("Queue choices are either `user` or `song`. " - "Run `{}help queuetype` if you need more information".format(ctx.prefix)) - else: - entry = { - 'server_id': key, - 'queue_type': new_type - } - self.bot.db.save('server_settings', entry) - state = self.bot.get_cog('Music').voice_states.get(ctx.message.guild.id) - if state: - if new_type == "user" and not state.user_queue or new_type == "song" and state.user_queue: - state.switch_queue_type() - await ctx.send("Current queue type is now `{}`".format(new_type)) - def setup(bot): bot.add_cog(Administration(bot)) diff --git a/cogs/disabled_playlist.py b/cogs/disabled_playlist.py deleted file mode 100644 index 87aaf00..0000000 --- a/cogs/disabled_playlist.py +++ /dev/null @@ -1,179 +0,0 @@ -from .utils import checks - -import discord -from discord.ext import commands - - -class Music: - """ - This cog is simply created in order to add all commands in the playlist cog - in case 'this' instance of the bot has not loaded the playlist cog. - This is useful to have the possiblity to split the music and text commands, - And still use commands that require another command to be passed - from the instance that hasn't loaded the playlist cog - """ - - def __init__(self, bot): - self.bot = bot - - async def on_voice_state_update(self, member, before, after): - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def progress(self, ctx): - """Provides the progress of the current song - - EXAMPLE: !progress - RESULT: 532 minutes! (Hopefully not)""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def join(self, ctx, *, channel: discord.TextChannel): - """Joins a voice channel. - - EXAMPLE: !join Music - RESULT: I'm in the Music voice channel!""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def summon(self, ctx): - """Summons the bot to join your voice channel. - - EXAMPLE: !summon - RESULT: I'm in your voice channel!""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def play(self, ctx, *, song: str): - """Plays a song. - If there is a song currently in the queue, then it is - queued until the next song is done playing. - This command automatically searches as well from YouTube. - The list of supported sites can be found here: - https://rg3.github.io/youtube-dl/supportedsites.html - - EXAMPLE: !play Song by Band - RESULT: Song by Band will be queued to play! - """ - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(kick_members=True) - async def volume(self, ctx, value: int = None): - """Sets the volume of the currently playing song. - - EXAMPLE: !volume 50 - RESULT: My volume is now set to 50""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(kick_members=True) - async def pause(self, ctx): - """Pauses the currently played song. - - EXAMPLE: !pause - RESULT: I'm paused!""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(kick_members=True) - async def resume(self, ctx): - """Resumes the currently played song. - - EXAMPLE: !resume - RESULT: Ain't paused no more!""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(kick_members=True) - async def stop(self, ctx): - """Stops playing audio and leaves the voice channel. - This also clears the queue. - - EXAMPLE: !stop - RESULT: No more music""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def eta(self, ctx): - """Provides an ETA on when your next song will play - - EXAMPLE: !eta - RESULT: 5,000 days! Lol have fun""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def queue(self, ctx): - """Provides a printout of the songs that are in the queue. - \N{LEFTWARDS BLACK ARROW}: Goes to the previous page - \N{BLACK RIGHTWARDS ARROW}: Goes to the next page - \N{DOWNWARDS BLACK ARROW}: Moves the current song showing back in the queue - \N{UPWARDS BLACK ARROW}: Moves the current song showing up in the queue - \N{CROSS MARK}: Removes the current song showing from the queue - - EXAMPLE: !queue - RESULT: A list of shitty songs you probably don't wanna listen to""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def queuelength(self, ctx): - """Prints the length of the queue - - EXAMPLE: !queuelength - RESULT: Probably 10 songs""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def skip(self, ctx): - """Vote to skip a song. The song requester can automatically skip. - approximately 1/3 of the members in the voice channel - are required to vote to skip for the song to be skipped. - - EXAMPLE: !skip - RESULT: You probably still have to wait for others to skip...have fun listening still - """ - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(kick_members=True) - async def modskip(self, ctx): - """Forces a song skip, can only be used by a moderator - - EXAMPLE: !modskip - RESULT: No more terrible song :D""" - pass - - @commands.command(enabled=False) - @commands.guild_only() - @checks.custom_perms(send_messages=True) - async def playing(self, ctx): - """Shows info about the currently played song. - - EXAMPLE: !playing - RESULT: Information about the song that's currently playing!""" - pass - - -def setup(bot): - bot.add_cog(Music(bot)) diff --git a/cogs/dj.py b/cogs/dj.py deleted file mode 100644 index f422dbf..0000000 --- a/cogs/dj.py +++ /dev/null @@ -1,74 +0,0 @@ -from .voice_utilities import * -import discord - - -class DJEvents: - """A simple class to save our DJ objects, once someone is detected to have joined a channel, - their DJ information will automatically update""" - - def __init__(self, bot): - self.bot = bot - self.djs = {} - - async def on_ready(self): - for channel in [c for c in self.bot.get_all_channels() if isinstance(c, discord.VoiceChannel)]: - for member in [m for m in channel.members if not m.bot]: - if member.id not in self.djs: - dj = DJ(member, self.bot) - self.bot.loop.create_task(dj.resolve_playlist()) - self.djs[member.id] = dj - - async def on_voice_state_update(self, member, _, after): - if member and not member.bot and member.id not in self.djs: - dj = DJ(member, self.bot) - self.bot.loop.create_task(dj.resolve_playlist()) - self.djs[member.id] = dj - # Alternatively, if the bot has joined the channel and we never detected the members that are in the channel - # This most likely means the bot has just started up, lets get these user's ready too - if member and member.id == member.guild.me.id and after and after.channel: - for m in after.channel.members: - if not m.bot and m.id not in self.djs: - dj = DJ(m, self.bot) - self.bot.loop.create_task(dj.resolve_playlist()) - self.djs[m.id] = dj - - -class DJ(Playlist): - def __init__(self, member, bot): - super().__init__(bot) - self.member = member - self.playlists = [] - - async def next_entry(self): - """Get the next song in the playlist; this class will wait until the next song is ready""" - entry = self.peek() - - # While we have an entry available - while entry: - # Check if we are ready or if we've errored, either way we'll pop it from the deque - if entry.ready or entry.error: - self.entries.rotate(-1) - return entry - # Otherwise, wait a second and check again - else: - await asyncio.sleep(1) - - # If we've reached here, we have no entries - return None - - async def resolve_playlist(self): - self.playlists = self.bot.db.load('user_playlists', key=self.member.id, pluck='playlists') or [] - self.clear() - - for pl in self.playlists: - if pl['active']: - for song in pl['songs']: - try: - await self.add_entry(song['url']) - except ExtractionError: - # For now, just silently ignore this - pass - - -def setup(bot): - bot.add_cog(DJEvents(bot))