Skip to main content

DiscordPlace Sync — Python SDK

SDK Python officiel pour synchroniser automatiquement les statistiques de votre bot Discord avec discordplace.com.

Port Python du package npm discordplace-sync. Compatible avec discord.py, disnake, py-cord et nextcord.

Installation

pip install discordplace-sync

Python ≥ 3.8 requis.

Quickstart (discord.py)

import discord
from discord.ext import commands
from discordplace_sync import DiscordPlaceSDK

intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)

sdk = DiscordPlaceSDK(
    api_key="dpsk_xxxxx",          # disponible dans le dashboard de votre bot
    bot_id="123456789012345678",
    auto_sync=True,                # ré-envoie les stats toutes les 5 min
    sync_interval=300,             # secondes
    debug=False,
)

@bot.event
async def on_ready():
    await sdk.start()
    await sdk.auto_collect_stats(bot)   # collecte guildCount/userCount/latency/uptime
    await sdk.sync_bot_info(bot)        # envoie aussi les commandes slash + prefix

bot.run("BOT_TOKEN")

Quickstart (disnake / nextcord / py-cord)

import disnake
from disnake.ext import commands
from discordplace_sync import DiscordPlaceSDK

bot = commands.Bot(command_prefix="!", intents=disnake.Intents.default())
sdk = DiscordPlaceSDK(api_key="dpsk_xxxxx", bot_id="123456789012345678")

@bot.event
async def on_ready():
    await sdk.start()
    await sdk.auto_collect_stats(bot)
    await sdk.sync_bot_info(bot, treat_all_as_hybrid=True)

bot.run("BOT_TOKEN")

API

DiscordPlaceSDK(api_key, bot_id, **options)

Option Type Default Description
api_key str required Clé API du bot
bot_id str required ID Discord du bot
endpoint str https://discordplace.com/api Base URL de l'API
auto_sync bool False Active la boucle automatique
sync_interval float 300 Secondes entre chaque sync auto
timeout float 10 Timeout HTTP
retries int 3 Tentatives sur erreur retryable
debug bool False Active les logs DEBUG

Méthodes async

  • await sdk.start() — démarre le SDK (et la boucle auto si activée).
  • await sdk.stop() — arrête le SDK et ferme la session HTTP.
  • await sdk.update_stats({"guildCount": 42, ...}) — envoie un payload de stats.
  • await sdk.post_stats(...) — alias rétro-compatible.
  • await sdk.get_stats(period="24h") — récupère l'historique.
  • await sdk.get_api_key_info() — infos sur la clé API.
  • await sdk.check_sync_status() — état de synchronisation.
  • await sdk.auto_collect_stats(client) — collecte auto + envoi.
  • await sdk.sync_bot_info(client, treat_all_as_hybrid=False, prefix_only_commands=[], slash_only_commands=[]) — synchronise infos + commandes.

Événements

sdk.on("success", lambda payload: print("✅ Stats envoyées:", payload))
sdk.on("error", lambda err: print("❌ Erreur:", err))
sdk.on("sync_success", lambda r: print("🔄 Sync info:", r))

Évènements disponibles : start, stop, success, error, sync_success, force_sync_detected, force_sync_completed. Les callbacks peuvent être sync ou async.

Context manager

async with DiscordPlaceSDK(api_key="...", bot_id="...") as sdk:
    await sdk.update_stats({"guildCount": 10})

Champs de stats acceptés

guildCount (requis), userCount, channelCount, commandsUsed, uptime (ms), memoryUsage (MB), latency (ms), version, isOnline. Les noms snake_case sont aussi acceptés (guild_count, user_count, …).

Licence

MIT © DiscordPlace Team

Metadata

Release files for discordplace-sync 1.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 discordplace-sync 1.0.0
File Size Uploaded
discordplace_sync-1.0.0.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for discordplace-sync 1.0.0
File Interpreter ABI Platform
discordplace_sync-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / discordplace_sync-1.0.0.tar.gz

Download URL discordplace_sync-1.0.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a4b80b377b9a896cb6fb480df81b7e2b04a9c9b60479ccc67516c42dc8c85764
BLAKE2b-256 checksum
How to use checksums
f7bfed0d923b830f515cf95aac568cc2bafabb1ce5a8d34b65560b021ca71c80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / discordplace_sync-1.0.0-py3-none-any.whl

Download URL discordplace_sync-1.0.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27480f55a69ade5f819b63e5d3105848a24be09292d804182df8b9aa6e3f30e5
BLAKE2b-256 checksum
How to use checksums
26929117c6f9a980601ec56d20baf474acf58a7027855f5dd7fc380b2c368254
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

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