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

trivious

v2.3.6

Published

Spend less time wiring, and more time writing behaviour.

Readme

Trivious

Spend less time wiring, and more time writing behaviour.

  • declarative handlers
  • structured files
  • encoded interaction routing
  • slash command auto-loading & deployment
  • builtin permission handling

Looking for support? Join the Alien Logger server: https://discord.gg/ScY9s6xjFb


Installation

npm install trivious
yarn add trivious
pnpm add trivious

Requires Node.js 22+


Quick Start

// src/index.ts
import { TriviousClient } from "trivious";
import { GatewayIntentBits } from "discord.js";

const client = new TriviousClient({
	credentials: {
		tokenReference: "BOT_TOKEN",
		clientIdReference: "CLIENT_ID",
	},
	corePath: "core", // Folder containing your bot's handlers
	intents: [GatewayIntentBits.Guilds],
	ownerUserIds: ["1234"],

	// Auto-deploy slash commands.
	// Using the commandHash feature is recommended
	// since it won't redeploy unchanged commands every restart.
	commandHashConfig: {
		enabled: true,
		persistentDataPath: "data",
	},
});

(async () => {
	try {
		await client.start();
		// Registers all commands, events, components, modules;
		// Deploys slash commands globally and then logs into the bot

		// To separately deploy commands - use client.deploy() followed by client.login()
	} catch (err: unknown) {
		const error = err as Error;
		console.error("Failed to start bot:", error);
	}
})();

Additional packages

Google Sheets API client - Integrate your bot with a Google Service Account to automate certain processes on Sheets

Trello API client - Integrate your bot with Trello to automate cards handling


Included Default Events

Trivious automatically includes and inserts clientReady and interactionCreate handlers, which can be overwritten. It is recommended to use the default interactionCreate handler, which requires zero setup in your own code.

These default events can be found in src/features/events/presets in the Trivious repository.


Code examples

Examples for commands, components, events and modules can be found at https://github.com/commonly-ts/discord-bot-template/tree/main/templates.


Creating a Slash Command

// commands/debug/index.ts
import { ApplicationCommandType, SlashCommandBuilder } from "discord.js";
import { createSlashCommand, SlashCommandData } from "trivious";

export default {
	active: true,
	context: "SlashCommand",
	commandType: ApplicationCommandType.ChatInput,
	flags: ["Cached", "EphemeralReply", "DeferReply"],
	data: new SlashCommandBuilder().setName("debug").setDescription("Debug commands"),
} satisfies SlashCommandData;

// Or alternatively...
export default createSlashCommand({
	active: true,
	flags: ["Cached", "EphemeralReply", "DeferReply"],
	data: new SlashCommandBuilder().setName("debug").setDescription("Debug commands"),
});

// You have the choice to do export default {} satisfies <...> OR use
// a builder such as createSlashCommand (cleaner & less repetitive).
// There are builders available for commands, components, events and modules.

Creating a Subcommand Group

// commands/debug/config/index.ts
import { Collection, SlashCommandSubcommandGroupBuilder } from "discord.js";
import { SlashSubcommandGroupData } from "trivious";

export default {
	context: "SlashSubcommandGroup",
	data: new SlashCommandSubcommandGroupBuilder()
		.setName("config")
		.setDescription("Config commands"),
	subcommands: new Collection(),
} satisfies SlashSubcommandGroupData;

Subcommands go in the same directory as the subcommand group file and are auto-detected.


Creating a Subcommand

// commands/debug/ping.ts
import { ApplicationCommandType, SlashCommandSubcommandBuilder } from "discord.js";
import { interactionReply, SlashSubcommandData } from "trivious";

export default {
	active: true,
	context: "SlashSubcommand",
	commandType: ApplicationCommandType.ChatInput,
	data: new SlashCommandSubcommandBuilder().setName("ping").setDescription("Ping pong!"),

	async execute(client, interaction) {
		const ping = (await interaction.fetchReply()).createdTimestamp - interaction.createdTimestamp;

		await interactionReply({
			interaction,
			replyPayload: {
				content: `Pong!\nBot latency: ${ping}ms, API latency: ${client.ws.ping.toString()}ms`,
			},
			flags: ["EphemeralReply"],
		});
	},
} satisfies SlashSubcommandData;

Project Structure

Any project structure (e.g. type-based, feature-based) is acceptable as long as everything you expect to be registered is within the core directory.

For example, if all of your commands, components, events and modules are anywhere inside src/features, assuming they export the correct data, they will be detected and registered to the client.

The only required specific structure is for slash commands, as shown below.

command/
├── index.ts*
├── subcommand.ts
└── subcommand-group/
		├── index.ts*
 		└── subcommand.ts

*file name must be exact