예제 #1
0
    async def hard_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.full_queue = [] 
        state.queue_ct = [] 
        state.full_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.")
예제 #2
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.")
예제 #3
0
 async def auto_voice_handler(self):
     for guild in self.client.guilds:
         state = TempState(guild)
         voice = get(self.client.voice_clients, guild=guild)
         if voice:
             if self.disconnect_check(voice):
                 awoo_channel = GuildState(guild).voice_text_channel
                 if voice.is_playing():
                     state.voice_handler_time += 1
                     if state.voice_handler_time == int(GuildState(guild).auto_pause_time):
                         voice.pause()
                         if guild in gen.time_l:
                             gen.time_l.remove(guild)
                         self.log("Player AUTO paused")
                         state.paused_by_handler = True
                         if awoo_channel:
                             await awoo_channel.send(f"Everyone left `{voice.channel.name}`, player paused.")
                 elif voice.is_paused():
                     state.voice_handler_time += 1
                     if state.voice_handler_time == int(GuildState(guild).auto_disconnect_time):
                         state.queue = []
                         state.full_queue = []
                         state.queue_ct = []
                         state.full_queue_ct = []
                         await voice.disconnect()
                         self.log("Player AUTO Disconnected")
                         if awoo_channel:
                             await awoo_channel.send(f"player disconnected.")
             else:
                 if state.voice_handler_time > 0:
                     state.voice_handler_time = 0
                 if state.paused_by_handler:
                     state.voice_handler_time = 0
                     voice.resume()
                     if guild not in gen.time_l:
                         gen.time_l.append(guild)
                     state.paused_by_handler = False