cogs/admin/poll.py
async def poll(self, ctx, *, question):
        """Interactively creates a poll with the following question.
        To vote, use reactions!
        """

        # a list of messages to delete when we're all done
        messages = [ctx.message]
        answers = []

        def check(m):
            return m.author == ctx.author and m.channel == ctx.channel and len(m.content) <= 100

        for i in range(20):
            messages.append(await ctx.send(f'Say poll option or `publishify` (`pbf`) to publish poll.'))

            try:
                entry = await self.bot.wait_for('message', check=check, timeout=60.0)
            except asyncio.TimeoutError:
                break

            messages.append(entry)

            if entry.clean_content.startswith(f'publishify') or entry.clean_content.startswith(f'pbf'):
                break

            answers.append((to_emoji(i), entry.clean_content))

        try:
            await ctx.channel.delete_messages(messages)
        except:
            print('Failed to delete messages')

        answer = '\n'.join(f'{keycap}: {content}' for keycap, content in answers)
        actual_poll = await ctx.send(embed=discord.Embed(title=f'"{question.title()}"',description=f'{answer}',colour=discord.Colour.random()).set_author(name=f"A poll by {ctx.author.name}",icon_url=ctx.author.avatar_url))
        await actual_poll.edit(embed=discord.Embed(title=f'"{question.title()}"',description=f'{answer}',colour=discord.Colour.random()).set_author(name=f"A poll by {ctx.author.name}",icon_url=ctx.author.avatar_url).set_footer(text=f"Poll ID: {actual_poll.id}"))
        for emoji, _ in answers:
            await actual_poll.add_reaction(emoji)
Interactively creates a poll with the following question.
        To vote, use reactions!
        
Interactively creates a poll with the following question.
To vote, use reactions!
Interactively creates a poll with the following question . To vote use reactions!
async def poll(self, ctx, *, question):
        messages = [ctx.message]
        answers = []
        def check(m):
            return m.author == ctx.author and m.channel == ctx.channel and len(m.content) <= 100
        for i in range(20):
            messages.append(await ctx.send(f'Say poll option or `publishify` (`pbf`) to publish poll.'))
            try:
                entry = await self.bot.wait_for('message', check=check, timeout=60.0)
            except asyncio.TimeoutError:
                break
            messages.append(entry)
            if entry.clean_content.startswith(f'publishify') or entry.clean_content.startswith(f'pbf'):
                break
            answers.append((to_emoji(i), entry.clean_content))
        try:
            await ctx.channel.delete_messages(messages)
        except:
            print('Failed to delete messages')
        answer = '\n'.join(f'{keycap}: {content}' for keycap, content in answers)
        actual_poll = await ctx.send(embed=discord.Embed(title=f'"{question.title()}"',description=f'{answer}',colour=discord.Colour.random()).set_author(name=f"A poll by {ctx.author.name}",icon_url=ctx.author.avatar_url))
        await actual_poll.edit(embed=discord.Embed(title=f'"{question.title()}"',description=f'{answer}',colour=discord.Colour.random()).set_author(name=f"A poll by {ctx.author.name}",icon_url=ctx.author.avatar_url).set_footer(text=f"Poll ID: {actual_poll.id}"))
        for emoji, _ in answers:
            await actual_poll.add_reaction(emoji)
async def poll ( self , ctx , * , question ) : messages = [ ctx . message ] answers = [ ] def check ( m ) : return m . author == ctx . author and m . channel == ctx . channel and len ( m . content ) <= 100 for i in range ( 20 ) : messages . append ( await ctx . send ( f'Say poll option or `publishify` (`pbf`) to publish poll.' ) ) try : entry = await self . bot . wait_for ( 'message' , check = check , timeout = 60.0 ) except asyncio . TimeoutError : break messages . append ( entry ) if entry . clean_content . startswith ( f'publishify' ) or entry . clean_content . startswith ( f'pbf' ) : break answers . append ( ( to_emoji ( i ) , entry . clean_content ) ) try : await ctx . channel . delete_messages ( messages ) except : print ( 'Failed to delete messages' ) answer = '\n' . join ( f'{keycap}: {content}' for keycap , content in answers ) actual_poll = await ctx . send ( embed = discord . Embed ( title = f'"{question.title()}"' , description = f'{answer}' , colour = discord . Colour . random ( ) ) . set_author ( name = f"A poll by {ctx.author.name}" , icon_url = ctx . author . avatar_url ) ) await actual_poll . edit ( embed = discord . Embed ( title = f'"{question.title()}"' , description = f'{answer}' , colour = discord . Colour . random ( ) ) . set_author ( name = f"A poll by {ctx.author.name}" , icon_url = ctx . author . avatar_url ) . set_footer ( text = f"Poll ID: {actual_poll.id}" ) ) for emoji , _ in answers : await actual_poll . add_reaction ( emoji )
Interactively creates a poll with the following question.
Interactively creates a poll with the following question .
"""Interactively creates a poll with the following question.
        To vote, use reactions!
        """ # a list of messages to delete when we're all done
self
ctx
question