Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

The official Python wrapper of Divine Discord Bot List

Project description

ddblAPI.py

The official Python wrapper of Divine Discord Bot List

Requirements

Installation

Using pip:

sudo pip install pyddblapi

Example usage

import discord
from ddblapi import DivineAPI

owner_id = '' # Your account ID
bot_id = '' # Your Bot ID
bot_token = '' # Your Bot token
api_key = '' # Your bot divinediscordbots.com API_KEY

ddbl = DivineAPI(bot_id=bot_id, api_key=api_key)


class Bot(discord.Client):

    async def on_ready(self):
        # Post stats example
        server_count = len(self.guilds)
        post_stats = await ddbl.post_stats(server_count)
        
        if post_stats['error']:
            print('An error has occured:\n{}'.format(post_stats['response']))
        else:
            print('Successfully posted stats on Divine Discord Bot List !')
        
        # Get stats example
        get_stats = await ddbl.get_stats(self.user.id)
        
        if get_stats['error']:
            print('An error has occured:\n{}'.format(get_stats['response']))
        else:
            print(get_stats['response'])

        # Get hasvoted24 example
        has_voted = await ddbl.get_hasvoted24(owner_id)
        
        if has_voted['error']:
            print('An error has occured:\n{}'.format(has_voted['response']))
        else:
            print(has_voted['response'])
        
Bot().run(bot_token)

Project details


Download files

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

Files for pyddblapi, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pyddblapi-0.0.3.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page