Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discordspy-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distributions

discordspy-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

discordspy-0.1.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file discordspy-0.1.1.tar.gz.

File metadata

  • Download URL: discordspy-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 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

Hashes for discordspy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 370871a64ea2648286d13a763b61801486ad6375c41ac526941b48e206be6a30
MD5 85846a5dc4cf603e70aa7625a3d92b6d
BLAKE2b-256 cba8a70079538b40ed69179f7e5be8ced4db13d8d2ba510dde5d5545cf7c3108

See more details on using hashes here.

File details

Details for the file discordspy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: discordspy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: 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

Hashes for discordspy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc90a6b6c78c017d421e2b4876602a5186c7bbb7cc7008bb5a908af491629e7
MD5 0142d3c5a77938d2cc191ff3aa5a8d09
BLAKE2b-256 a2387965607cd4848eaf30834f7f1a250bccd3d8bd99ddbc086fd5bdefbf69c9

See more details on using hashes here.

File details

Details for the file discordspy-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: discordspy-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 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

Hashes for discordspy-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c4974a63bfa96166b5a908979501f512238b75039af8c58ce85053a22a7acd13
MD5 7c4c627cc98a0fdfd5b4c373f7f3f4a1
BLAKE2b-256 e59a9f9d64cc45ece47fa93875249a2205a10adf42e981cb52d88121c40fd175

See more details on using hashes here.

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