예제 #1
0
    def embed(self):
        embed = discord.Embed()
        embed.title = f'Enqueued {self.entry.title}'
        embed.url = self.entry.url
        embed.add_field(name='Duration', value=time.human_time(self.entry.duration))
        if self.progress:
            embed.title = f'Currently playing {self.entry.title}'
            embed.add_field(name='Progress', value=time.human_time(self.progress))
            embed.add_field(name='Requester', value=self.requester, inline=False)

        return embed
예제 #2
0
파일: Music.py 프로젝트: 512732/512732
    async def play(self, ctx, *, query: 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
        """
        if ctx.author.voice is None:
            return await ctx.send('You need to be in a voice channel.')
        vc = ctx.guild.voice_client
        if vc is None:
            vc = await ctx.invoke(self.summon)
            if vc is None:
                return

        source = YoutubeSource(ctx.message, query)
        embed = source.embed()
        queue = self.get_queue(ctx.guild)
        if not vc.is_playing() and not vc.is_paused():
            time_until = 'Up next!'
        else:
            songs = queue.songs._queue
            length = sum(song.length for song in songs) + vc.source.remaining
            time_until = time.human_time(length)
        embed.add_field(name='Time until playing', value=time_until)
        message = await ctx.send(embed=embed)
        await queue.songs.put(source)
        await asyncio.sleep(15)
        await message.delete()
예제 #3
0
파일: Music.py 프로젝트: 512732/512732
    def embed(self):
        embed = discord.Embed(color=0xffffff)
        embed.title = 'Enqueued {}'.format(self.entry.title)
        embed.url = self.entry.url
        embed.add_field(name='Duration',
                        value=time.human_time(self.entry.duration))
        if self.progress:
            embed.title = 'Currently playing {}'.format(self.entry.title)
            embed.add_field(name='Progress',
                            value=time.human_time(self.progress))
            embed.add_field(name='Requester',
                            value=self.requester,
                            inline=False)
            embed.add_field(name='Skips',
                            value='{}/{}'.format(len(self.skip_votes),
                                                 self.required_skips))

        return embed
예제 #4
0
    async def play(self, ctx, *, query: str):
        if ctx.author.voice is None:
            embed = discord.Embed(description = f"**{ctx.author.name}**, you need to be in a voice channel.", color = embed_color_attention)
            return await ctx.send(embed = embed, delete_after = 15)
        vc = ctx.guild.voice_client
        if vc is None:
            vc = await ctx.invoke(self.summon)
            if vc is None:
                return

        source = YoutubeSource(ctx.message, query)
        embed = source.embed()
        queue = self.get_queue(ctx.guild)
        if not vc.is_playing() and not vc.is_paused():
            time_until = ' Up next!'
        else:
            songs = queue.songs._queue
            length = sum(song.length for song in songs) + vc.source.remaining
            time_until = time.human_time(length)
        embed.add_field(name='Time until playing ', value=time_until)
        await ctx.send(embed=embed, delete_after = 15)
        await queue.songs.put(source)
예제 #5
0
파일: Music.py 프로젝트: 512732/512732
    async def wheresmysong(self, ctx):
        """Shows how long until your next song will play."""
        vc = ctx.voice_client
        if vc is None:
            return await ctx.send('Not in a voice channel.')

        if not vc.is_playing() and not vc.is_paused():
            return await ctx.send('Not playing any music right now...')
        songs = self.get_queue(ctx.guild).songs._queue
        if not songs:
            return await ctx.send('Nothing currently in the queue.')
        requesters = set(song.requester for song in songs)
        if ctx.author not in requesters:
            return await ctx.send('You are not in the queue!')
        remaining = vc.source.remaining
        for song in songs:
            if song.requester == ctx.author:
                break
            remaining += song.length

        message = await ctx.send('{} until your next song!'.format(
            time.human_time(remaining)))
        await asyncio.sleep(15)
        await message.delete()