Skip to main content

Very easy to use https://distop.xyz Stats updater

Project description

DisTop

The official Python Library for the distop.xyz website!

Installation

Install via pip (Recommended)

from DisTop import DisTop

Examples

Post stats

With Tasks (Must be using discord.py version 1.1.0+):

import discord, asyncio
from DisTop import DisTop
from discord.ext import tasks

class DisTop(commands.Cog):
    """Interacts with the DisTop API"""

    def __init__(self, bot):
        self.bot = bot
        self.update_stats.start()
        self.DisTop = DisTop(token=token)# Make sure you put your token from DisTop.xyz here!

    def cog_unload(self):
        self.update_stats.cancel()

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This automatically updates your server count to DisTop.xyz every 30 minutes."""
        try:
            await DisTop.post_stats(self.bot.user.id, len(self.bot.guilds))
        except Exception as e:
            print('Failed to post server count to DisTop.xyz\n' + type(e).__name__ + ':' + e')

def setup(bot):
    bot.add_cog(DisTop(bot))

Change Log

1.0.0 (13.122020)

  • Library

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

DisTop-1.0.2.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file DisTop-1.0.2.tar.gz.

File metadata

  • Download URL: DisTop-1.0.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.6

File hashes

Hashes for DisTop-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e0456a8d24934bf9516c060cce360d05b27f916fa2c55d002129035506f1ab1f
MD5 f4ae9cb1967663e77f30e39feb39c02c
BLAKE2b-256 6e14f05e0769f13b235746c4b3ad199d4baf619bcd73f8ad8808f3aa5c86931d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page