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

FeatureDescription
🔷 TypeScript FirstFull type definitions (JS SDK), type hints (Python SDK)
đŸ“Ļ Minimal DependenciesJS: native fetch — no bloat. Python: only aiohttp
⚡ Event BatchingEvents are queued and sent in batches
🔄 Auto RetryAutomatic retries on failures
đŸ›Ąī¸ Graceful ErrorsNever crashes your bot, even if the API is down
📡 Auto HeartbeatStarts monitoring uptime automatically
🐍 Multi-LanguageSupports 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.