Skip to main content

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.

This package is available on PyPI, so use pip or another dependency manager to install it.

pip install discourtesy

Introduction

A basic application with a simple beep boop command looks like this.

import discourtesy

app = discourtesy.Application(application_id=0, public_key="", token="")


@discourtesy.command("beep")
async def beep_command(application, interaction):
    return "boop"


app.add_plugin(__name__)

First, the Discourtesy package is being imported and an application is being instantiated. Here, the application's ID, public key and token are set. This information can be found in Discord's developer portal.

Finally, the beep command is 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. By default, uvicorn is included as a dependency in this package.

uvicorn filename:app

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

discourtesy-0.3.0.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

discourtesy-0.3.0-py3-none-any.whl (8.8 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