npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

argus-discord-analytics

v0.4.0

Published

The all-seeing analytics SDK for Discord bots - track commands, errors, servers, and more

Readme

@argus/sdk

The all-seeing analytics SDK for Discord bots. Track commands, errors, and custom events with ease.

Installation

npm install @argus/sdk
# or
yarn add @argus/sdk
# or
pnpm add @argus/sdk

Quick Start

import { Argus } from '@argus/sdk';
import { Client, GatewayIntentBits } from 'discord.js';

// Initialize Argus with your API key
const argus = new Argus({
  apiKey: 'arg_live_your_api_key_here',
  endpoint: 'https://your-app.vercel.app', // Your Argus deployment URL
  debug: process.env.NODE_ENV === 'development',
});

const client = new Client({
  intents: [GatewayIntentBits.Guilds],
});

// Auto-track all interactions
client.on('interactionCreate', (interaction) => {
  argus.track(interaction);
});

// Track errors
client.on('error', (error) => {
  argus.trackError(error);
});

// Graceful shutdown
process.on('SIGINT', async () => {
  await argus.shutdown();
  process.exit(0);
});

client.login(process.env.DISCORD_TOKEN);

Configuration

const argus = new Argus({
  // Required: Your Argus API key
  apiKey: 'arg_live_xxxxxxxxxxxx',
  
  // Optional: API endpoint (defaults to http://localhost:3000)
  endpoint: 'https://your-app.vercel.app',
  
  // Optional: Enable debug logging (default: false)
  debug: true,
  
  // Optional: Number of events before auto-flush (default: 10)
  batchSize: 10,
  
  // Optional: Flush interval in milliseconds (default: 10000)
  flushInterval: 10000,
  
  // Optional: Hash user IDs for privacy (default: true)
  hashUserIds: true,
});

API

argus.track(interaction)

Track a Discord.js interaction automatically. Extracts command name, server ID, and user ID.

client.on('interactionCreate', (interaction) => {
  argus.track(interaction);
});

argus.trackEvent(type, name, options?)

Track a custom event.

argus.trackEvent('command', '/play', {
  serverId: '123456789',
  userId: '987654321',
  metadata: { song: 'Never Gonna Give You Up' },
});

argus.trackEvent('custom', 'playlist_created', {
  serverId: '123456789',
  metadata: { playlistName: 'My Playlist', songCount: 10 },
});

argus.trackError(error, options?)

Track an error with optional context.

try {
  await someRiskyOperation();
} catch (error) {
  argus.trackError(error, {
    command: '/play',
    serverId: interaction.guildId,
    userId: interaction.user.id,
  });
}

argus.flush()

Manually flush all queued events to the server.

await argus.flush();

argus.shutdown()

Gracefully shutdown the Argus instance, flushing any remaining events.

process.on('SIGINT', async () => {
  await argus.shutdown();
  process.exit(0);
});

Privacy

By default, Argus hashes user IDs before sending them to the server. This allows you to track unique users without storing their actual Discord IDs.

To disable hashing:

const argus = new Argus({
  apiKey: 'your_api_key',
  hashUserIds: false,
});

REST API Alternative

If you're not using Node.js, you can send events directly to the API:

curl -X POST https://your-app.vercel.app/api/events \
  -H "Authorization: Bearer arg_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [{
      "type": "command",
      "name": "/play",
      "serverId": "123456789",
      "userHash": "abc123",
      "timestamp": 1640000000000
    }]
  }'

License

MIT