Skip to main content

Discord bot list poster and stats retriever

Project description

dbots.py logo

A stats poster and API wrapper for all botlists.

PyPi version PyPi downloads Dependencies Documentation Status


Table of Contents

About

dbots helps Discord bot developers group all your statistic posting needs into one poster, complete with seperate posting, and a loop to post to all services every n seconds.

Installing

Python 3.6 or higher is required! You can install dbots by running this command:

# Linux/macOS
python3 -m pip install -U dbots

# Windows
py -3 -m pip install -U dbots

To install package from the master branch, do the following:

git clone https://github.com/dbots-pkg/dbots.py
cd dbots.py
python3 -m pip install -U

Examples

Example with client

Currently, only discord.py is supported as a usable client. (You can use any derivative of discord.py as long as it does not interfere with important properties used by dbots.)

import discord
import dbots

client = discord.Client()
poster = dbots.ClientPoster(client, 'discord.py', api_keys = {
    'top.gg': '…',
    'discord.bots.gg': '…'
})

@client.event
async def on_ready():
    print('Logged on as', client.user)
    await poster.post()
    # This posts to all lists every 30 minutes
    # You can stop the loop with `poster.kill_loop()`
    poster.start_loop()

@poster.event
async def on_auto_post(response):
    print('Auto-Post:', response)

"""
You can also define the event you want to get by adding an argument to the decorator.

@poster.event('post')
async def some_function(response):
    print(response)
"""

Example without client

import dbots

client_id = '1234567890'
def server_count():
  return 100
def user_count():
  return 100
def voice_connections():
  return 0

# `server_count`, `user_count`, and `voice_connections` can either be regular functions or coroutines
poster = dbots.Poster(client_id, server_count, user_count, voice_connections, api_keys = {
    'top.gg': '…',
    'discord.bots.gg': '…'
})

See more examples here.

Services

Supported Services

*These services (cloudlist & divinediscordbots) are shutting down. Any service objects and functions towards these services will be removed in the next major release.

Adding Custom Services

You can add custom services by extending from the base service class (dbots.Service) and overriding the _post and aliases method.
Make sure to add the custom service class to the service keymap. (dbots.Service.SERVICE_KEYMAP) An example of adding a custom service can be shown here.

Adding a custom post function

You can add a custom post event by defining on_custom_post in the initialization of a Poster.
This function can be used when executing poster.post('custom') and when all services are being posted to. An example of adding a custom post function can be shown here.

Contribution

Any contribution may be useful for the package! Make sure when making issues or PRs that the issue has not been addressed yet in a past issue/PR.

Other Links

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

dbots-1.2.2.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

dbots-1.2.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file dbots-1.2.2.tar.gz.

File metadata

  • Download URL: dbots-1.2.2.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for dbots-1.2.2.tar.gz
Algorithm Hash digest
SHA256 8b8d2c615fcae5d32e7edff47be3973d2763578c98c8c145c78eaf5ec4c080f3
MD5 9bf4bb518863dba6b240fe56270c61d0
BLAKE2b-256 04f3cce0e585ed1fcfafe272bc2c943f17f34adf25243a2c196fe064ede5d0c2

See more details on using hashes here.

File details

Details for the file dbots-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: dbots-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for dbots-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5126442593bee2165fd2af3c3e976be506a1054a831f03c2044560e103ccac79
MD5 cd343ee8f04f7f28c66a1cff2fc237da
BLAKE2b-256 b7b998a561df49dca5a37494aefcf7668335dd3132f41eaafd1125fa6135347f

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