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

discint

v0.5.0

Published

Discord Intent Validation Library

Readme

Discord Intent Validation Library (discint)

npm version npm downloads GitHub Workflow Status Security Audit License: BSL-1.0

A comprehensive TypeScript library for validating and analyzing Discord application intents/flags. Provides detailed analysis, recommendations, and warnings for Discord bot developers.


Features

  • Full TypeScript Support - Complete type definitions with strict typing
  • 🔍 Comprehensive Analysis - Detailed breakdown of Discord intents and capabilities
  • 🎯 Smart Recommendations - Context-aware suggestions for missing intents
  • ⚠️ Warning System - Detect potential issues and conflicts
  • 📊 Capability Detection - Understand what your bot can and cannot do
  • 🏗️ Modular Architecture - Well-organized codebase with separate concerns

Installation

npm install discint
# or
pnpm add discint
# or
yarn add discint

Usage

Basic Usage

import { validateDiscordIntents, formatValidationResponse } from "discint";

// Analyze Discord application flags
const flags = 262144; // GATEWAY_MESSAGE_CONTENT
const analysis = validateDiscordIntents(flags);

console.log(analysis.capabilities.canReadMessageContent); // true
console.log(analysis.intents.active.length); // 1
console.log(analysis.recommendations); // Array of recommendations

// Format for API responses
const formatted = formatValidationResponse(analysis);
console.log(formatted.success); // true
console.log(formatted.validation.completeness); // 10 (10% of available intents)

Advanced Usage

import {
  validateDiscordIntents,
  DISCORD_APPLICATION_FLAGS,
  INTENT_CATEGORIES,
  type DiscordIntentsAnalysis,
} from "discint";

// Use constants for specific intents
const myFlags =
  DISCORD_APPLICATION_FLAGS.GATEWAY_MESSAGE_CONTENT |
  DISCORD_APPLICATION_FLAGS.GATEWAY_GUILD_MEMBERS |
  DISCORD_APPLICATION_FLAGS.APPLICATION_COMMAND_BADGE;

const result = validateDiscordIntents(myFlags);

if ("error" in result) {
  console.error("Validation failed:", result.error);
} else {
  // Type-safe access to analysis
  const analysis: DiscordIntentsAnalysis = result;

  console.log("Privileged intents:", analysis.intents.privileged);
  console.log("Bot capabilities:", analysis.capabilities);
  console.log("Warnings:", analysis.warnings);
}

API Reference

Main Functions

validateDiscordIntents(flags: number): DiscordIntentsResult

Validates Discord application flags and provides comprehensive analysis.

Parameters:

  • flags - The application flags from Discord API (number)

Returns: DiscordIntentsAnalysis | DiscordIntentsError

formatValidationResponse(analysis: DiscordIntentsResult): FormattedValidationResponse

Formats the validation result for API responses.

Constants

DISCORD_APPLICATION_FLAGS

Object containing all Discord application flag constants with their bit values.

INTENT_CATEGORIES

Object categorizing intents into PRIVILEGED, FUNCTIONAL, and SYSTEM groups.

Types

The library exports comprehensive TypeScript types for all data structures:

  • DiscordIntentsAnalysis - Complete analysis result
  • BotCapabilities - What the bot can do
  • Recommendation - Suggestions for improvement
  • Warning - Potential issues detected
  • And many more...

Project Structure

src/
├── index.ts          # Main entry point and exports
├── types.ts          # TypeScript type definitions
├── constants.ts      # Discord flags and categories
├── validator.ts      # Main validation logic
├── formatter.ts      # Response formatting
├── capabilities.ts   # Capability analysis
├── recommendations.ts # Recommendation generation
├── warnings.ts       # Warning detection
└── utils.ts          # Utility functions

Development

# Install dependencies
pnpm install

# Build the project
pnpm run build

# Lint and format
pnpm run lint
pnpm run format

# Type check
pnpm run build

License

BSL-1.0 - See LICENSE file for details.


Contributing

Contributions are welcome! Please ensure all TypeScript types are properly defined and the code follows the established patterns.


Security

If you discover a security vulnerability, please see SECURITY.md for how to report it.