Official analytics SDK for Discord bots using Cordia
Project description
Cordia Python SDK
Official analytics SDK for Discord bots using Cordia.
Installation
pip install cordia
Basic Usage
import discord
from discord.ext import commands
import cordia
import os
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
# Initialize cordia client
cordia_client = cordia.CordiaClient(
api_key=os.getenv("CORDIA_API_KEY"),
bot_id=os.getenv("CORDIA_BOT_ID")
)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
# Report guild count asynchronously
await cordia_client.post_guild_count(len(bot.guilds))
# Start the async background heartbeat and queue processor
cordia_client.start(bot.loop)
@bot.command()
async def ping(ctx):
await ctx.send("Pong!")
# Track command
await cordia_client.track_command(
command="ping",
user_id=str(ctx.author.id),
guild_id=str(ctx.guild.id) if ctx.guild else None
)
bot.run(os.getenv("DISCORD_TOKEN"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cordia-1.0.0.tar.gz
(3.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cordia-1.0.0.tar.gz.
File metadata
- Download URL: cordia-1.0.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07828ee09474eac48a0191d3e305871906058ea41bc036be98f54aee3641ca2
|
|
| MD5 |
ece13c416e356141872115d0345e58c1
|
|
| BLAKE2b-256 |
d4da51ce864dab8b6de718512f1ba2baccf00d0cbe8dd7d6d64a49c57bc2b41b
|
File details
Details for the file cordia-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cordia-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d0c3faa5b067584dac345eed3b02292c9bfcc09a1a88fe70a8f8320d56f90d8
|
|
| MD5 |
59f4f1c9eaa121eb8184363cb94517d7
|
|
| BLAKE2b-256 |
da944e0669b7e7add849d6c50e58ca6cd4768d2a0b694ee49f14fd23644a0c8f
|