A Python wrapper for the Discord API
Project description
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.
Key Features
Modern Pythonic API using async and await.
Proper rate limit handling.
Optimised in both speed and memory.
Installing
Python 3.8 or higher is required
To install the library without full voice support, you can just run the following command:
# Linux/macOS
python3 -m pip install -U discord-py-api
# Windows
py -3 -m pip install -U discord-py-api
Otherwise to get voice support you should run the following command:
# Linux/macOS
python3 -m pip install -U "discord-py-api[voice]"
# Windows
py -3 -m pip install -U discord-py-api[voice]
Optional Packages
PyNaCl (for voice support)
Please note that when installing voice support on Linux, you must install the following packages via your favourite package manager (e.g. apt, dnf, etc) before running the above commands:
libffi-dev (or libffi-devel on some systems)
python-dev (e.g. python3.6-dev for Python 3.6)
Quick Example
import discord
from botway import GetToken
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content == 'ping':
await message.channel.send('pong')
intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
client.run(GetToken())
Bot Example
import discord
from discord.ext import commands
from botway import GetToken
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='>', intents=intents)
@bot.command()
async def ping(ctx):
await ctx.send('pong')
bot.run(GetToken())
You can find more examples in the examples directory.
Links
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file discord-py-api-1.7.851.tar.gz
.
File metadata
- Download URL: discord-py-api-1.7.851.tar.gz
- Upload date:
- Size: 951.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f21de787cc5e625c9c42764b84e6753f83256cc34845e28fef5dbefc6be2abb |
|
MD5 | 579a9e4d18babf1be188c29a020603f6 |
|
BLAKE2b-256 | 8f6e4838bd4e704a9b5625b3ee0cc9a8235b0841127dc88efd06dadc5e68d7db |
File details
Details for the file discord_py_api-1.7.851-py3-none-any.whl
.
File metadata
- Download URL: discord_py_api-1.7.851-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edc819c00235903dacdc40a8e26dbe5bcf8caf61022aa1ca43c578c93ea6b293 |
|
MD5 | e53b8a8b3bbab770ee5bc4818222a1d0 |
|
BLAKE2b-256 | 0c73451389c5e21c4eb60ca7affba2508d8d8a6b48ce241fc2af107d5ce69dc0 |