Introduction
Cordia is the official analytics SDK for Discord bots. It gives you full visibility into how your bot is being used â from command tracking to uptime monitoring â available for both JavaScript/TypeScript and Python.
âšī¸What is Cordia?
Cordia is a platform for Discord bot developers. The SDK is available as an npm package (for JS/TS bots) and a pip package (for Python bots) to send analytics data to the Cordia dashboard.
Why Cordia?
Building a Discord bot is fun, but understanding how it's used can be challenging. Cordia solves this by providing:
- đ Command Analyticsâ Know which commands are most popular and how they're used across guilds
- đĨ User Tracking â Understand how many users interact with your bot daily
- đ° Guild Monitoring â Track your server count growth over time
- đ Uptime Monitoring â Automatic heartbeat pings every 30 seconds to calculate uptime percentage
Key Features
| Feature | Description |
|---|---|
| đˇ TypeScript First | Full type definitions (JS SDK), type hints (Python SDK) |
| đĻ Minimal Dependencies | JS: native fetch â no bloat. Python: only aiohttp |
| ⥠Event Batching | Events are queued and sent in batches |
| đ Auto Retry | Automatic retries on failures |
| đĄī¸ Graceful Errors | Never crashes your bot, even if the API is down |
| đĄ Auto Heartbeat | Starts monitoring uptime automatically |
| đ Multi-Language | Supports both discord.js and discord.py bots |
Quick Preview
Here's how simple it is to get started:
JavaScript / TypeScript
index.ts
typescript
import { CordiaClient } from 'cordia';
const cordia = new CordiaClient({
apiKey: process.env.CORDIA_API_KEY,
botId: process.env.CORDIA_BOT_ID,
});
// Track a command
cordia.trackCommand({
command: 'play',
userId: '123456789',
});
// Report guild count
await cordia.postGuildCount(150);
// Heartbeat is already running! â¤ī¸Python
bot.py
python
import cordia
cordia_client = cordia.CordiaClient(
api_key="your-api-key",
bot_id="your-bot-id",
)
# Track a command
await cordia_client.track_command(
command="play",
user_id="123456789",
)
# Report guild count
await cordia_client.post_guild_count(150)
# Start background heartbeat
cordia_client.start(bot.loop) # â¤ī¸đĄReady to start?
Head over to the Installation page to set up the SDK in your bot.