示例#1
0
    async def poll(self, ctx):
        first = Page(title='Sun vs Moon Poll',
                     description='Do you prefer the sun or the moon?')
        first.set_footer(
            text="Only vote once! Your vote won't count if you cheat!")
        first.buttons(['\U00002600', '\U0001F315'])
        first.on_next(self.finish)

        second = Page(title='Sun vs Moon Poll', description=f'Results are in!')

        menu = Poll(ctx).set_timeout(10).add_pages([first, second])
        await menu.open()
示例#2
0
    async def buttons(self, ctx):
        page1 = Page(title='Button Menu', description='Follow the arrows!')
        page1.add_field(name='Example A', value='Example B')
        page1.buttons([forward, stop]).on_next(self.first)

        page2 = Page(title='Button Menu',
                     description='So many buttons! What do they do?')
        page2.add_field(name='Example C', value='Example D')
        page2.buttons([reverse, stop, forward]).on_next(self.second)

        page3 = Embed(title='Button Menu', description='We reached the end!')
        page3.add_field(name='Example E', value='Example F')

        menu = ButtonMenu(ctx).add_pages([page1, page2, page3])
        await menu.open()