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

@nodxteam/discord-utils

v1.0.0

Published

Utility library for Discord.js v14 bots

Readme

@nodxteam/discord-utils

Utility library for Discord.js v14 bots. Covers the building blocks every bot needs — styled embeds, cooldown tracking, paginated listings, and confirmation prompts.

Install

npm install @nodxteam/discord-utils

Requires discord.js v14 as a peer dependency.

Usage

Embeds

Pre-configured embed builders with a consistent color palette.

import { successEmbed, errorEmbed, warnEmbed, infoEmbed, Colors } from '@nodxteam/discord-utils';

await interaction.reply({ embeds: [successEmbed('Done', 'User was banned.')] });
await interaction.reply({ embeds: [errorEmbed('Failed', 'Missing permissions.')] });
await interaction.reply({ embeds: [warnEmbed('Warning', 'This action is irreversible.')] });
await interaction.reply({ embeds: [infoEmbed('Info', 'The server has 120 members.')] });

// Use Colors directly
new EmbedBuilder().setColor(Colors.Primary);

Available colors: Success (green), Error (red), Warning (yellow), Info / Primary (blurple), Dark, White.


CooldownManager

Per-user, per-command cooldown tracking. Optionally scoped to a guild.

import { CooldownManager } from '@nodxteam/discord-utils';

const cooldowns = new CooldownManager();

// In your command handler:
const remaining = cooldowns.check(interaction.user.id, 'ban');
if (remaining > 0) {
  await interaction.reply({
    content: `Wait **${CooldownManager.format(remaining)}** before using this again.`,
    flags: MessageFlags.Ephemeral,
  });
  return;
}

cooldowns.set(interaction.user.id, 'ban', 10_000); // 10 second cooldown
// ... execute the command

API

| Method | Description | |--------|-------------| | check(userId, command, guildId?) | Returns remaining ms, 0 if not on cooldown | | set(userId, command, duration, guildId?) | Apply a cooldown | | clear(userId, command, guildId?) | Remove a specific cooldown | | clearUser(userId, guildId?) | Remove all cooldowns for a user | | purge() | Delete expired entries from memory | | CooldownManager.format(ms) | Format ms into "1m 30s" style string |


Paginator

Navigate through a list of embeds with previous/next buttons. Buttons are automatically disabled when the collector times out.

import { Paginator } from '@nodxteam/discord-utils';
import { EmbedBuilder } from 'discord.js';

const pages = [
  new EmbedBuilder().setTitle('Page 1').setDescription('First page content'),
  new EmbedBuilder().setTitle('Page 2').setDescription('Second page content'),
  new EmbedBuilder().setTitle('Page 3').setDescription('Third page content'),
];

const paginator = new Paginator({ pages, timeout: 60_000 });
await paginator.send(interaction);

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | pages | EmbedBuilder[] | required | One embed per page | | timeout | number | 60000 | Collector timeout in ms | | showPageCount | boolean | true | Add "Page X / Y" footer | | ephemeral | boolean | false | Send as ephemeral reply |


Confirm Dialog

Ask the user to confirm an action before proceeding. Resolves false on Cancel or timeout.

import { confirm } from '@nodxteam/discord-utils';

const ok = await confirm(interaction, {
  message: 'Are you sure you want to ban this user?',
  timeout: 30_000,
});

if (ok) {
  await member.ban();
  await interaction.followUp({ embeds: [successEmbed('Banned', member.user.tag)] });
} else {
  await interaction.followUp('Action cancelled.');
}

You can also pass an EmbedBuilder as the message:

const ok = await confirm(interaction, {
  message: warnEmbed('Ban user', `This will ban **${member.user.tag}** permanently.`),
  confirmLabel: 'Ban',
  cancelLabel: 'Cancel',
  ephemeral: true,
});

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | message | string \| EmbedBuilder | required | Prompt text or embed | | timeout | number | 30000 | Timeout in ms | | ephemeral | boolean | false | Send as ephemeral reply | | confirmLabel | string | "Confirm" | Confirm button label | | cancelLabel | string | "Cancel" | Cancel button label |

License

MIT