Ejemplo n.º 1
0
 async def shuffle(self, ctx, amount: int = None):
     state = TempState(ctx.author.guild)
     """Shuffle the current queue"""
     
     state.queue = [x for x in state.queue if type(x) != str]
     state.queue_ct = state.queue[:]
     next_queue = state.queue[1:]
     random.shuffle(next_queue)
     state.queue = [state.queue[0]] + next_queue
     if amount and amount > 0:
         state.shuffle_lim = amount
Ejemplo n.º 2
0
    async def stop(self, ctx):
        '''Stops the current music AND clears the current queue.'''
        state = TempState(ctx.author.guild)
        voice = get(self.client.voice_clients, guild=ctx.guild)
        state.queue = []
        state.queue_ct = []

        if voice and voice.is_playing:
            self.log("Player stopped")
            voice.stop()
            if ctx.author.guild in gen.time_l:
                gen.time_l.remove(ctx.author.guild)
            state.time = 0
            state.shuffle_lim = None
            await ctx.send(">>> Music stopped")

        else:
            self.log("Stop failed")
            await ctx.send(">>> Ya know to stop stuff, stuff also needs to be playing first.")
Ejemplo n.º 3
0
    async def leave(self, ctx):
        '''Leaves the voice channel.'''
        state = TempState(ctx.author.guild)
        voice = get(self.client.voice_clients, guild=ctx.guild)

        if voice and voice.is_connected():
            state.queue = []
            state.full_queue = []
            state.queue_ct = []
            state.full_queue_ct = []
            if voice.is_playing():
                voice.stop()
            await voice.disconnect()
            if ctx.author.guild in gen.time_l:
                gen.time_l.remove(ctx.author.guild)
            state.time = 0
            state.shuffle_lim = None
            await ctx.send(f">>> Left ```{voice.channel.name}```")
            
        else:
            await ctx.send(">>> I cannot leave a voice channel I have not joined, thought wouldn't need to explain basic shit like this.")