Skip to main content

User interaction utilities for

Project description UI

An extension package for anything relating to user input and interactions.

Ever wanted to make a prompt for your users? Maybe a cool paginator? dpy-ui will make it all happen in simple, easy to remember functions and classes.


Requires Python 3.6+

pip install -U dpy-ui

Development version

pip install -U git+


git clone git+
pip install -U .[voice]

Then once it's installed, you can import it via

from discord.ext import ui

Quick Examples

Prompt the user for some input

name = await ui.prompt(ctx, 'What is your name?')
await ctx.send(f'Ok, your name is {name}')

Choose between a list of choices

choices = ['red', 'blue', 'green', 'yellow']
colour = await, 'What is your favo(u)rite colo(u)r?', choices)

# Want buttons instead of text? No problem.

choices = [
    ui.Choice('Very Happy', button='😄'),
    ui.Choice('Happy', button='🙂'),
    ui.Choice('Neutral', button='😐'),
    ui.Choice('Sad', button='😦'),
    ui.Choice('Very Sad', button='😢'),
feeling = await, 'How are you feeling today?', choices)

Make a simple paginator

def some_statements():
    for i in range(20):
        yield f'This is sentence {i}'

def format_page(page):
    return f'This is a page\n{page}'

paginator = ui.Paginator(some_statements(), page_formatter=format_page)
await paginator.start(ctx)

# And to chunk it:

def format_chunk(chunk):
    # Formatters can return embeds too
    return discord.Embed(description='\n'.join(chunk))

paginator = ui.Paginator.chunked(some_statements(), 10, page_formatter=format_chunk)
await paginator.start(ctx)

Make a custom session

class MySession(ui.Session):
    async def send_initial_message(self):
        return await self.context.send('Say hi or click the thinking face.')

    async def think(self, payload):
        await self.context.send('Thinking a lot...')

    async def quit(self, payload):
        await self.stop()

    async def say_hello(self, message):
        await self.context.send(f'Hello, {}!')

session = MySession(timeout=120)
await session.start(ctx)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dpy-ui-0.2.1.tar.gz (10.8 kB view hashes)

Uploaded source

Built Distribution

dpy_ui-0.2.1-py3-none-any.whl (12.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page