Skip to main content

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)

Metadata

Release files for discordspy 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discordspy 0.1.2
File Size Uploaded Provenance Actions
discordspy-0.1.2.tar.gz 5.0 kB Without provenance Details for discordspy-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for discordspy 0.1.2
File Interpreter ABI Platform Actions
discordspy-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for discordspy-0.1.2-py2.py3-none-any.whl

Total release size: 10.6 kB

Release files / discordspy-0.1.2.tar.gz

Download URL discordspy-0.1.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e7aa74cf31d31ab6acbd082e96e2533ceb075ee8073b5d5474f26921ee0eb0ae
BLAKE2b-256 checksum
How to use checksums
73dc1b46497e1710fa2306e042237f601eb79c50dc849fdcf9f4ae268ff738f7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / discordspy-0.1.2-py2.py3-none-any.whl

Download URL discordspy-0.1.2-py2.py3-none-any.whl
Size 5.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
861b4bca54c9cb8b06e745c8c1d419bf825db557d5d89db93758eea43d44053f
BLAKE2b-256 checksum
How to use checksums
07f10f62c0648dd43800476d6cbe3a02598885ee4707010389ef1143bbc56c9b
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for discordspy 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page