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.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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

Hashes for discordspy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e7aa74cf31d31ab6acbd082e96e2533ceb075ee8073b5d5474f26921ee0eb0ae
MD5 70d8845f3e8a46cd5d7faaeeaf5d253b
BLAKE2b-256 73dc1b46497e1710fa2306e042237f601eb79c50dc849fdcf9f4ae268ff738f7

See more details on using hashes here.

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

Hashes for discordspy-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 861b4bca54c9cb8b06e745c8c1d419bf825db557d5d89db93758eea43d44053f
MD5 45b5bba7788d298c43e7917e1d024c3a
BLAKE2b-256 07f10f62c0648dd43800476d6cbe3a02598885ee4707010389ef1143bbc56c9b

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