discord-app-0.0.1a1
توضیحات
Discord Interaction Application framework for Python
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | discord-app-0.0.1a1 |
| نام | discord-app |
| نسخه کتابخانه | 0.0.1a1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | JackyCCC |
| ایمیل نویسنده | jacky9813@hotmail.com |
| آدرس صفحه اصلی | https://github.com/jacky9813/discord_app |
| آدرس اینترنتی | https://pypi.org/project/discord-app/ |
| مجوز | MIT |
# Discord Interaction Application framework for Python
 [](https://pypi.org/project/discord-app/)
> In early development.
>
> The specification and documentation may change without notification.
>
> Any new ideas are welcomed.
A [Flask](https://flask.palletsprojects.com/) based Discord Application framework.
## System Requirements
* Python 3.9+
* (Recommended) [virtualenv](https://virtualenv.pypa.io/en/latest/)
## Install from PyPI
Install and update using [pip](https://pip.pypa.io/en/stable/getting-started/):
```bash
$ pip install discord-app
```
## Known Limitation
* After command specification updated (including new command), Discord clients may require up to an hour to update its command list.
## Sample Server Application
```python
#!/usr/bin/env python3
# app.py
import discord_app
from . import app_config
PORT = "8080"
app = discord_app.Application.from_basic_data(
id=app_config.APPLICATION_ID,
public_key=app_config.PUBLIC_KEY,
bot_token=app_config.BOT_TOKEN,
# Set Discord interaction endpoint URL to http(s)://<YOUR-ADDRESS>:<PORT>/<ENDPOINT>
endpoint="/api/discord/command"
)
app._flask.testing = True
app._logger.setLevel(logging.DEBUG)
@app.application_command(
options=discord_app.ApplicationCommand(
name="version",
name_localizations={
"zh-TW": "顯示程式版本"
},
type=discord_app.ApplicationCommandType.CHAT_INPUT,
description="Show application version",
description_localizations={
"zh-TW": "顯示程式版本"
}
),
register_on_change=True # Register command on specification change or is new command.
)
def show_version(_: discord_app.InteractionRequest) -> discord_app.InteractionResponse:
return discord_app.InteractionResponse(
type=discord_app.InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
data=discord_app.InteractionResponseMessage(
content="test application/0.0.1"
)
)
app.run(
host="0.0.0.0",
port=PORT
)
```
```bash
$ python3 app.py
```
## Links
* [Official API Documentation](https://discord.com/developers/docs/)
نیازمندی
| مقدار | نام |
|---|---|
| >=2.27.1,<3.0.0 | requests |
| >=2.1.1,<3.0.0 | Flask |
| >=1.4.0,<2.0.0 | PyNaCl |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9,<4 | Python |
نحوه نصب
نصب پکیج whl discord-app-0.0.1a1:
pip install discord-app-0.0.1a1.whl
نصب پکیج tar.gz discord-app-0.0.1a1:
pip install discord-app-0.0.1a1.tar.gz