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 🙏

© 2025 – Pkg Stats / Ryan Hefner

typicord

v3.2.5

Published

A modern, efficient Discord API library for Node.js with full TypeScript support

Readme

Typicord

Typicord Logo

npm version TypeScript License Build Status

A modern, type-safe Discord API wrapper built with TypeScript

DocumentationExamplesChangelogContributing

✨ Features

  • 🔷 TypeScript-First: Built from the ground up with TypeScript for complete type safety
  • 🎯 Modern API: Clean, intuitive interface designed for developer experience
  • 🔧 Modular Design: Extensible architecture with plugin support
  • 🚀 High Performance: Optimized with connection pooling and intelligent caching
  • 🛡️ Robust Error Handling: Comprehensive error handling with detailed logging
  • 🔄 Auto-Reconnection: Smart reconnection logic with exponential backoff
  • 📊 Built-in Debugging: Environment variable-based debug system (TYPI_DEBUG)
  • 🎪 Event System: Comprehensive event handling with Events namespace
  • ⚡ Gateway Management: Modular, scalable gateway event handler system

📋 Table of Contents

🚀 Installation

# Using npm
npm install typicord

# Using yarn
yarn add typicord

# Using pnpm
pnpm add typicord

⚡ Quick Start

import { Client, GatewayIntentBits, Events } from 'typicord';

const client = new Client('YOUR_BOT_TOKEN', GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages);

client.on('READY', (ready: Events.Ready) => {
  console.log(`🚀 ${ready.user.username} is online!`);
});

client.on('MESSAGE_CREATE', (message: Events.MessageCreate) => {
  if (message.content === '!ping') {
    client.sendMessage(message.channelId, 'Pong! 🏓');
  }
});

client.connect();

📚 Examples

Explore our comprehensive examples covering various use cases:

| Example | Description | Complexity | |---------|-------------|------------| | Basic Bot | Simple message handling and commands | ⭐ Beginner | | Advanced Bot | Complex bot with multiple features | ⭐⭐⭐ Advanced | | Slash Commands | Interaction handling and responses | ⭐⭐ Intermediate | | Guild Management | Guild events and server management | ⭐⭐ Intermediate | | Components Demo | Buttons, select menus, and components | ⭐⭐⭐ Advanced | | Debug Example | Using the debug system effectively | ⭐ Beginner | | Reconnection Demo | Connection resilience and recovery | ⭐⭐ Intermediate |

📖 API Reference

Core Classes

Client

The main client class for interacting with Discord.

const client = new Client(token: string, intents: number);

// Event handling
client.on(event: string, handler: Function);
client.once(event: string, handler: Function);

// Messaging
client.sendMessage(channelId: string, content: string, options?: MessageOptions);

// Guild operations
client.fetchGuild(guildId: string): Promise<Guild>;
client.fetchGuilds(options?: FetchGuildsOptions): Promise<Guild[]>;

// User operations
client.fetchUser(userId: string): Promise<User>;
client.createDM(userId: string): Promise<Channel>;

// Connection management
client.connect(): void;
client.disconnect(): void;
client.destroy(): void;

GatewayIntentBits

Constants for Discord Gateway intents.

import { GatewayIntentBits } from 'typicord';

const intents = GatewayIntentBits.Guilds | 
                GatewayIntentBits.GuildMessages | 
                GatewayIntentBits.MessageContent;

🎪 Event System

Typicord provides a comprehensive event system with TypeScript support:

import { Events } from 'typicord';

// All events are fully typed
client.on('READY', (event: Events.Ready) => {
  console.log(`Logged in as ${event.user.username}`);
  console.log(`Connected to ${event.guilds.length} guilds`);
});

client.on('MESSAGE_CREATE', (event: Events.MessageCreate) => {
  console.log(`New message: ${event.content} from ${event.author.username}`);
});

client.on('GUILD_CREATE', (event: Events.GuildCreate) => {
  console.log(`Joined guild: ${event.guild.name}`);
});

Available Events

  • READY - Bot is ready and connected
  • MESSAGE_CREATE - New message received
  • MESSAGE_UPDATE - Message was edited
  • MESSAGE_DELETE - Message was deleted
  • GUILD_CREATE - Joined a guild or guild became available
  • GUILD_UPDATE - Guild was updated
  • GUILD_DELETE - Left a guild or guild became unavailable
  • CHANNEL_CREATE - Channel was created
  • CHANNEL_UPDATE - Channel was updated
  • CHANNEL_DELETE - Channel was deleted
  • INTERACTION_CREATE - Slash command or component interaction
  • USER_UPDATE - User was updated
  • And many more...

🔍 Debugging

Typicord includes a powerful debugging system using environment variables:

# Enable all debug output
TYPI_DEBUG=* node your-bot.js

# Enable specific namespaces
TYPI_DEBUG=gateway,events node your-bot.js

# Available namespaces: gateway, events, heartbeat, interaction, rest

See our Debug Guide for detailed information.

🏗️ Architecture

Modular Gateway System

Typicord uses a modular dispatch handler system for scalability:

import { dispatchHandlerRegistry } from 'typicord/gateway';

// Register custom event handlers
dispatchHandlerRegistry.registerDispatchHandler('CUSTOM_EVENT', (client, data) => {
  // Handle custom event
});

Type Safety

All Discord API structures are fully typed:

  • Guilds: Complete guild structure with members, roles, channels
  • Messages: Full message data with embeds, attachments, reactions
  • Users: User profiles with presence and activity data
  • Interactions: Slash commands, buttons, select menus
  • Channels: All channel types with proper inheritance

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes: Follow our coding standards
  4. Add tests: Ensure your code is well-tested
  5. Commit your changes: git commit -m 'feat: add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/NotKeira/Typicord.git
cd Typicord

# Install dependencies
pnpm install

# Build the project
pnpm build

# Run tests
pnpm test

# Run benchmarks
pnpm benchmark

Commit Convention

We use Conventional Commits:

  • feat: - New features
  • fix: - Bug fixes
  • docs: - Documentation changes
  • style: - Code style changes (formatting, etc.)
  • refactor: - Code refactoring
  • test: - Adding or updating tests
  • chore: - Maintenance tasks

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with ❤️ by Keira Hopkins
  • Inspired by Discord.js
  • Thanks to all contributors and users

⬆ Back to Top

Made with 💜 for the Discord developer community