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

@kevlid/discordmenus

v0.1.8

Published

some menu stuff for discord stuff

Readme

@kevlid/discordmenus

⚠️ Usage is NOT recommended

const fs = require("fs");
const path = require("path");
const { Client, GatewayIntentBits, REST, Routes, SlashCommandBuilder } = require("discord.js");
const { MenuManager, MenuBuilder, CustomIdPrefix, fromDiscordJS } = require("@kevlid/discordmenus");

const DATA = path.join(__dirname, "menu-data.json");
const store = new Map(
    Object.entries(fs.existsSync(DATA) ? JSON.parse(fs.readFileSync(DATA, "utf8")) : { prefix: "!" }),
);

function persist() {
    fs.writeFileSync(DATA, JSON.stringify(Object.fromEntries(store), null, 2));
}

const builder = new MenuBuilder()
    .setKey("settings")
    .setTitle("Settings")
    .createCategory(c => c.setKey("main"))
    .addString(o => o.setKey("prefix").setTitle("Prefix").setMinLength(1).setMaxLength(5).setPreview(true));

const manager = new MenuManager();

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

client.once("ready", async () => {
    await manager.registerMenu(builder, {
        get: (key) => store.get(key),
        save: (key, value) => {
            store.set(key, value);
            persist();
        },
    });
    await new REST().setToken(process.env.BOT_TOKEN).put(
        Routes.applicationGuildCommands(client.user.id, process.env.GUILD_ID),
        { body: [new SlashCommandBuilder().setName("menu").setDescription("Open").toJSON()] },
    );
});

client.on("interactionCreate", async (interaction) => {
    if (interaction.isChatInputCommand() && interaction.commandName === "menu") {
        await interaction.deferReply();
        await interaction.editReply(
            await manager.renderMenu("settings", { userId: interaction.user.id }),
        );
        return;
    }
    if (interaction.customId?.startsWith(CustomIdPrefix)) {
        const body = await manager.handleInteraction(fromDiscordJS(interaction));
        await interaction.client.rest.post(
            Routes.interactionCallback(interaction.id, interaction.token),
            { body },
        );
    }
});

client.login(process.env.BOT_TOKEN);

Role / user / channel selects

  • Persist IDs as strings (Discord snowflakes are too large for JS numbers; Mongo/JSON numbers will corrupt them and default_values won’t show on rerender).
  • Select custom_ids include category + page so paging doesn’t reuse the same component identity in the same slot across pages.