Skip to main content

Reaction-based user interfaces for discord.py bots

Project description

discord-eprompt

PyPI version Documentation Status

Reaction-based user input prompts for Discord bots

Usage

A reaction prompt is simply a message with a set of predefined reactions and a target user. The bot reacts to the message with its set of reactions, leaving what are basically buttons which can be clicked by users. Normally, clicking on a reaction would just increase the count of that reaction on the message. With reaction prompts, however, a callback with the choice is fired as soon as the target user clicks on one, allowing bots to actively respond to the user's button selection.

The library maintains a number of constraints on the message before the target user makes a decision. Reactions by those other than the target user are removed immediately, as are reactions by the target user that aren't apart of the predefined list of choices.

This package provides one method, react_prompt_response which takes a Discord message and turns it into a reaction prompt. See its own documentation for usage details.

Testing

Due to the difficulty of unit-testing this stuff there is currently no automated testing suite. However, there is the example.py script which will demonstrate the bot's funcitonality. You will need your own bot and your own server to use this; see the Discord dev portal for more information.

To use it, copy the example.json.template file to example.json. Then, edit the new file and replace the value for token with your bot's token, and guild with the ID of the guild to which the tester should send messages. The bot will use the first available text channel to send its messages.

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

discord-eprompt-0.3.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

discord_eprompt-0.3.0-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

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