A basic API wrapper for Discords.com
Project description
discords.py
The offical Python API wrapper for Discords.com
Notices
This is the first version with limited coverage of API endpoints, more features, functionality and documentation will be added in the future.
Installation:
pip install discords.py
Features
- Server count posting
- Built-in automatic & interval server count posting
- Built-in voting webhook handler
- Voting & server posting events
Examples
Automatic server count posting with event
Autoposting posts the servercount whenever a server is joined/removed while abiding with ratelimits
from discord.ext import commands
import discordspy
bot = commands.Bot("!")
discords = discordspy.Client(bot, DISCORDS_TOKEN, post=discordspy.Post.auto())
@bot.event
async def on_discords_server_post(status):
if status == 200:
print("Posted the server count:", discords.servers())
bot.run(TOKEN)
Interval server count posting every hour and a half
from discord.ext import commands
import discordspy
bot = commands.Bot("!")
post = discordspy.Post.interval(minutes=30, hours=1)
discords = discordspy.Client(bot, DISCORDS_TOKEN, post=post)
@bot.event
async def on_discords_server_post(status):
if status == 200:
print("Posted the server count:", discords.servers())
bot.run(TOKEN)
Webhook voting event
IMPORTANT: Your webhook url must end with /discordswebhook if you wish to use a different path, please specify it using the path argument inside the webhook method path="/customwebhook", by default the port is 8080
from discord.ext import commands
import discordspy
bot = commands.Bot("!")
discords = discordspy.Client(bot, DISCORDS_TOKEN)
discords.webhook(port=2296, auth="password")
@bot.event
async def on_discords_server_post(status):
if status == 200:
print("Posted the server count:", discords.servers())
bot.run(TOKEN)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discordspy-0.1.2.tar.gz.
File metadata
- Download URL: discordspy-0.1.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7aa74cf31d31ab6acbd082e96e2533ceb075ee8073b5d5474f26921ee0eb0ae
|
|
| MD5 |
70d8845f3e8a46cd5d7faaeeaf5d253b
|
|
| BLAKE2b-256 |
73dc1b46497e1710fa2306e042237f601eb79c50dc849fdcf9f4ae268ff738f7
|
File details
Details for the file discordspy-0.1.2-py2.py3-none-any.whl.
File metadata
- Download URL: discordspy-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
861b4bca54c9cb8b06e745c8c1d419bf825db557d5d89db93758eea43d44053f
|
|
| MD5 |
45b5bba7788d298c43e7917e1d024c3a
|
|
| BLAKE2b-256 |
07f10f62c0648dd43800476d6cbe3a02598885ee4707010389ef1143bbc56c9b
|