Skip to main content

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

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

Metadata

Release files for dbots 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbots 4.0.0
File Size Uploaded
dbots-4.0.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbots 4.0.0
File Interpreter ABI Platform
dbots-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / dbots-4.0.0.tar.gz

Download URL dbots-4.0.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c980a2468d290dbbe86dbb3e00df04adf335673c93450cd26fda68f9ca800507
BLAKE2b-256 checksum
How to use checksums
142bc7c74f0a49ab76c7fa305e73ca07b978003881360baba819964eede49429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release files / dbots-4.0.0-py3-none-any.whl

Download URL dbots-4.0.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7767a9a3bf686fe4cf16a571868cba4186e424d170c1fd5ef9489c513881bc56
BLAKE2b-256 checksum
How to use checksums
0fb82737d80646265599c02dc753638e7c1440a7a98d427aa75a91244bef7fd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page