A minimal framework to handle Discord interactions.
Project description
Discourtesy
Discourtesy is a minimal framework to handle Discord interactions.
Installation
Discourtesy requires Python 3.10 or higher.
The package is available on PyPi, so install it with pip
or another dependency manager.
pip install discourtesy
Introduction
A basic application with a simple beep boop command looks like this.
import discourtesy
application = discourtesy.Application(application_id=0, public_key="", token="")
@discourtesy.command("beep")
async def beep_command(application, interaction):
return "boop"
application.add_plugin(__name__)
First, the Discourtesy package is being imported and an application is being instantiated. Next, the application's public key is being set, which is being used to verify incoming requests.
Finally, the beep
command is being created. The callback provides the application instance and the interaction data, but neither is being used here. The file is being added as a plugin, which makes sure that the command is being registered properly.
To start the web server, use an ASGI server implementation like uvicorn
.
uvicorn filename:application
Contributing
Before contributing to Discourtesy, make sure to read through the contribution guidelines.
This project is licensed under the terms of the MIT license.
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
Built Distribution
Hashes for discourtesy-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba97b6189e533faad1cdf1492fcbb0030fa2c6b092dd861cc90c5f1824ef3a53 |
|
MD5 | 101cc2472cf0cd9e060fa7548a712926 |
|
BLAKE2b-256 | 548ded82dc30465803d1cea7eb1834e55ca8287fbff44056fa6d5b337603bed8 |