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

wv3-discord-rewrite

v1.0.5

Published

````md # WV3 Discord Utils Rewrite

Readme

# WV3 Discord Utils Rewrite

A modular CommonJS toolkit for building Electron apps, Discord bots, and Express servers with a unified WV3-style structure.

## Features

- Electron application builder
- Discord bot builder
- Express server builder
- Startup and initialization flow
- Built-in error manager
- Structured WV3 and Playwright error maps
- CommonJS-ready package layout

## Installation

```bash
npm install

Usage

const WV3 = require("./index");

Main Export

const WV3 = require("./index");

module.exports = {
  Application: {
    __init,
    error,
    build: {
      electron,
      discord,
      express
    }
  },
  Manager,
  Errors
};

Export Overview

Application.__init()

Runs the application startup and initialization flow.

Application.error

Shared error handler instance.

Application.build.electron

Electron application builder instance.

Application.build.discord

Discord bot builder instance.

Application.build.express

Express server builder instance.

Manager

Error manager class export.

Errors

Predefined error definitions.


Project Structure

.
├── index.js
├── builders
│   ├── ElectronBuilder.js
│   ├── DiscordBuilder.js
│   └── ExpressBuilder.js
├── managers
│   ├── ApplicationStart.js
│   ├── ApplicationEvents.js
│   └── ApplicationErrs.js
└── utils
    ├── ApplicationSetup.js
    ├── ApplicationRuntime.js
    └── ApplicationErrors.js

Quick Start

Run App Initialization

const WV3 = require("./index");

WV3.Application.__init();

Electron Builder

Build and control Electron windows with a chainable API.

Supported Options

  • app name
  • width and height
  • minimum width and height
  • background color
  • preload file
  • local HTML file
  • remote URL
  • theme mode
  • devtools
  • frameless mode
  • transparent mode

Example

const WV3 = require("./index");

WV3.Application.build.electron
  .setName("WV3 Desktop")
  .setSize(1400, 900)
  .setMinSize(1000, 700)
  .setHTML("index.html")
  .enableDevtools(true)
  .build();

Available Methods

setName(name)
setSize(width, height)
setMinSize(width, height)
setIcon(iconPath)
setPreload(preloadPath)
setHTML(htmlFile)
setURL(url)
setBackground(color)
enableDevtools(state)
setTheme(mode)
build()
getWindow()
quit()

Discord Builder

Create and manage a Discord bot using discord.js with a chainable setup flow.

Supported Features

  • bot token setup
  • prefix configuration
  • intents
  • partials
  • presence
  • command registration
  • event registration
  • runtime upgrade support
  • start and stop helpers

Example

const WV3 = require("./index");

const bot = WV3.Application.build.discord
  .setToken("YOUR_TOKEN")
  .setPrefix("!")
  .addCommand("ping", async ({ message }) => {
    await message.reply("pong");
  })
  .addEvent("ready", (client) => {
    console.log(`${client.user.tag} is online`);
  });

bot.start();

Available Methods

setToken(token)
setPrefix(prefix)
setIntents(intents)
addIntent(intent)
setPresence(presence)
addCommand(name, run)
addEvent(eventName, run, once)
buildClient()
upgrade(newOptions)
start()
stop()
getClient()

Express Builder

Create an Express server with chainable configuration and route helpers.

Supported Features

  • port and host setup
  • JSON middleware
  • URL-encoded middleware
  • static folder support
  • views folder support
  • view engine support
  • route helpers
  • render helper
  • JSON response helper
  • redirect helper
  • not found handler
  • error handler
  • server upgrade and stop support

Example

const WV3 = require("./index");

WV3.Application.build.express
  .setPort(3000)
  .setHost("0.0.0.0")
  .setViewEngine("ejs")
  .get("/", (req, res) => {
    res.send("WV3 Express Server Running");
  })
  .listen((port, host) => {
    console.log(`Server running on http://${host}:${port}`);
  });

Available Methods

setPort(port)
setHost(host)
setViews(viewsPath)
setPublic(publicPath)
setViewEngine(viewEngine)
set(name, value)
use(middleware)
useAt(route, middleware)
get(route, handler)
post(route, handler)
put(route, handler)
patch(route, handler)
delete(route, handler)
all(route, handler)
render(route, view, data)
json(route, data)
redirect(from, to)
notFound(handler)
error(handler)
listen(callback)
upgrade(newOptions)
stop()
getApp()
getServer()

Error System

WV3 includes a structured error system for internal application handling.

Included Error Groups

  • playwright
  • wv3

Example

const WV3 = require("./index");

try {
  WV3.Application.error.throw("wv3", "INIT_FAILED");
} catch (err) {
  console.log(err);
}

Error Manager Features

  • push mapped errors
  • throw grouped errors
  • get all stored errors
  • get a specific error
  • delete an error
  • clear errors
  • log formatted errors

Application Startup Flow

The initialization flow uses internal setup helpers for startup and runtime verification.

Startup Actions

  • prompts for Playwright install
  • installs Playwright
  • installs Chromium
  • installs WV3-related packages
  • verifies browser launch
  • continues initialization

Example

const WV3 = require("./index");

WV3.Application.__init();

Custom Client Events

The package includes a custom event-based client with cache support.

Event Names

{
  READY: "ready",
  MESSAGE_CREATE: "messageCreate",
  GUILD_CREATE: "guildCreate",
  CHANNEL_CREATE: "channelCreate",
  ERROR: "error",
  DEBUG: "debug",
  DISCONNECT: "disconnect"
}

Best Use Cases

WV3 is useful when you want one package to help you:

  • build a desktop Electron app
  • run a Discord bot
  • create an Express backend
  • keep a shared WV3 application structure
  • manage startup and error flows in one place

Example Combined Usage

const WV3 = require("./index");

// initialize
WV3.Application.__init();

// express
WV3.Application.build.express
  .setPort(3000)
  .get("/", (req, res) => res.send("Hello from WV3"))
  .listen();

// discord
WV3.Application.build.discord
  .setToken("YOUR_TOKEN")
  .setPrefix("!")
  .addCommand("ping", async ({ message }) => {
    await message.reply("pong");
  })
  .start();

// electron
WV3.Application.build.electron
  .setName("WV3 App")
  .setHTML("index.html")
  .build();

Notes

  • Built for CommonJS
  • Builder instances are exposed directly from the main export
  • Startup currently depends on install permissions and local package installation
  • Intended for WV3-style application scaffolding