discordbotlist.py
Easy to use API wrapper for DiscordBotList in Python
Installation
[!WARNING] You need to install an optional package either discordbotlist-py[pycord] or discordbotlist-py[discord]
# For discord.py
pip install discordbotlist-py[discord]
# For py-cord
pip install discordbotlist-py[pycord]
Usage
discord.py usage
import discord
from discordbotlist import DblClient
from discord import Intents, Client
from discord import app_commands
class MyClient(Client):
def __init__(self, *, intents: Intents):
super().__init__(intents=intents)
self.tree = app_commands.CommandTree(self)
async def setup_hook(self):
await self.tree.sync()
bot = MyClient(intents=Intents.all())
# Initialize the DBL client with your API token
dbl = DblClient("your_dbl_token_here", bot)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
# Start auto-posting stats every hour (3600 seconds)
dbl.start_posting(interval=3600)
# Post commands to DiscordBotList
commands = await bot.tree.fetch_commands()
command_list = [
{
"name": cmd.name,
"description": cmd.description,
"type": cmd.type.value
}
for cmd in commands
]
await dbl.post_command(command_list)
print(f"Posted {len(command_list)} commands to DiscordBotList.")
# Listen for DBL stats updates
@dbl.event
async def on_dbl_updated(payload):
print(f"DiscordBotList stats updated: {payload}")
# Listen for DBL commands updates
@dbl.event
async def on_dbl_commands_updated(commands):
print(f"DiscordBotList commands updated: {commands}")
bot.run("your_bot_token_here")
py-cord usage
discord.py usage
import discord
from discordbotlist import DblClient, AppCommandPayload
from discord import Intents, Bot
bot = Bot(intents=Intents.all())
# Initialize the DBL client with your API token
dbl = DblClient("your_dbl_token_here", bot)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
# Start auto-posting stats every hour (3600 seconds)
dbl.start_posting(interval=3600)
# Post commands to DiscordBotList
commands = bot.application_commands
command_list = [
AppCommandPayload(
name=cmd.name, description=cmd.description, type=1
)
for cmd in commands
]
await dbl.post_command(command_list)
print(f"Posted {len(command_list)} commands to DiscordBotList.")
# Listen for DBL stats updates
@dbl.event
async def on_dbl_updated(payload):
print(f"DiscordBotList stats updated: {payload}")
# Listen for DBL commands updates
@dbl.event
async def on_dbl_commands_updated(commands):
print(f"DiscordBotList commands updated: {commands}")
bot.run("your_bot_token_here")
Manual Stats Posting
# Manually post stats
await dbl.post_status()
Stop Auto-posting
# Stop the auto-posting loop
await dbl.stop_posting()
Metadata
Release files for discordbotlist-py 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discordbotlist_py-1.0.1.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discordbotlist_py-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / discordbotlist_py-1.0.1.tar.gz
| Download URL | discordbotlist_py-1.0.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc8244d00de4f8ebfb7813daee85346fb56f946df96de1051bad1322a447e9ea
|
|
BLAKE2b-256 checksum How to use checksums |
2160e852b59c0dc037c28fa9ca9369d44a8874888f18c6748e79070da450876b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / discordbotlist_py-1.0.1-py3-none-any.whl
| Download URL | discordbotlist_py-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a1139f679609d81d77ef7a02d658b2fbc76c1dd9109aac79cf68e73b988bc87
|
|
BLAKE2b-256 checksum How to use checksums |
a48f2843504d2dee49e434dd07b3dc131978e9b077490604b4bd03c5f8b9dcd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|