A comprehensive TypeScript library for validating and analyzing Discord application intents/flags. Provides detailed analysis, recommendations, and warnings for Discord bot developers.
- β 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
npm install discint
# or
pnpm add discint
# or
yarn add discintimport { 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)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);
}Validates Discord application flags and provides comprehensive analysis.
Parameters:
flags- The application flags from Discord API (number)
Returns: DiscordIntentsAnalysis | DiscordIntentsError
Formats the validation result for API responses.
Object containing all Discord application flag constants with their bit values.
Object categorizing intents into PRIVILEGED, FUNCTIONAL, and SYSTEM groups.
The library exports comprehensive TypeScript types for all data structures:
DiscordIntentsAnalysis- Complete analysis resultBotCapabilities- What the bot can doRecommendation- Suggestions for improvementWarning- Potential issues detected- And many more...
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
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Lint and format
pnpm run lint
pnpm run format
# Type check
pnpm run buildBSL-1.0 - See LICENSE file for details.
Contributions are welcome! Please ensure all TypeScript types are properly defined and the code follows the established patterns.
If you discover a security vulnerability, please see SECURITY.md for how to report it.