Skip to content

Latest commit

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Disputils

Disputils provides some neat features to make your life as a bot developer easier.

Install

Install latest release from PyPI via pip:

python3.6 -m pip install disputils

Or the freshest bleeding-edge code directly from GitHub using pip and git:

python3.6 -m pip install -U git+https://github.com/LiBa001/disputils

Note

A compatible version of discord.py will be installed automatically when downloading with pip. However, you should still require discord.py in your own setup.py or requirements.txt file.

Features

Quick overview of the available features.

For all features there are two ways to use them.

  • just discord.py and a basic discord.Client
  • discord.py commands extension (discord.ext.commands) and a Bot

In the following we're going to use the second way since it's a bit easier.

fromdisputilsimportBotEmbedPaginator, BotConfirmation, BotMultipleChoice

Pagination

Split your content into multiple pages and use reactions to paginate through.

@bot.command()asyncdefpaginate(ctx):
embeds= [
Embed(title="test page 1", description="This is just some test content!", color=0x115599),
Embed(title="test page 2", description="Nothing interesting here.", color=0x5599ff),
Embed(title="test page 3", description="Why are you still here?", color=0x191638)
]
paginator=BotEmbedPaginator(ctx, embeds)
awaitpaginator.run()

https://github.com/LiBa001/disputils/blob/master/docs/img/paginate.png

Multiple Choice

Let the user decide. Provide multiple choice!

@bot.command()asyncdefchoice(ctx):
multiple_choice=BotMultipleChoice(ctx, ['one', 'two', 'three', 'four', 'five', 'six'], "Testing stuff")
awaitmultiple_choice.run()
awaitmultiple_choice.quit(multiple_choice.choice)

https://github.com/LiBa001/disputils/blob/master/docs/img/choice.png

Confirmation

Is the user going to do something irreversible? Let him confirm first!

@bot.command()asyncdefconfirm(ctx):
confirmation=BotConfirmation(ctx, 0x012345)
awaitconfirmation.confirm("Are you sure?")
ifconfirmation.confirmed:
awaitconfirmation.update("Confirmed", color=0x55ff55)
else:
awaitconfirmation.update("Not confirmed", hide_author=True, color=0xff5555)

https://github.com/LiBa001/disputils/blob/master/docs/img/confirm.png

Requirements

About

Some neat utils for discord.py. Making your life as a Discord bot developer easier.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages