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

swb.js

v1.0.1

Published

A simple, beginner-friendly WhatsApp bot framework powered by Baileys. Inspired by aoi.js style command handling.

Readme

swb.js

swb.js is a lightweight, beginner-friendly WhatsApp bot framework built on top of @whiskeysockets/baileys. It provides a simple command-based interface, inspired by the ease of use of libraries like aoi.js, allowing developers to build WhatsApp bots quickly and efficiently.

⚠️ Disclaimer

swb.js is currently in early development and may not be production-ready. Some features are experimental, and breaking changes may occur as the project evolves.

We welcome all contributions, feedback, and suggestions to help improve the library. If you’d like to be part of its growth, feel free to open an issue, submit a pull request, or star the project on GitHub.

Together, we can make swb.js better for everyone. 💚


🪙 Support

If you like this project, please star on this repository, thank you ⭐ You can support me by:


✨ Features

  • ⚡ Simple command system with $variables
  • 📸 Fetch profile picture, about, last seen, and more
  • ⏱️ Built-in uptime, latency, date/time utilities
  • 📚 Fully customizable prefix and bot name
  • 🧩 Easily extendable and maintainable

📦 Installation

npm install swb.js

🚀 Quick Start

Create a new file index.js:

const { SWBClient } = require("swb.js");

const bot = new SWBClient({
  prefix: "/",          // Command prefix (default: /)
  name: "MyBot",        // Bot name (optional)
});

// Simple ping command
bot.command({
  name: "ping",
  code: "Pong!"
});

// Greeting the sender
bot.command({
  name: "hello",
  code: "Hello $senderName, I am $botName."
});

// Show current uptime
bot.command({
  name: "uptime",
  code: "⏱ Bot has been active for $uptime."
});

// Random number
bot.command({
  name: "random",
  code: "🎲 Your lucky number is: $random[1;100]"
});

// Show info about yourself
bot.command({
  name: "me",
  code: `
🧍 *Your Number:* $number
📝 *About:* $about
📷 *PP URL:* $ppUrl
🕒 *Last Seen:* $lastSeen
  `
});

Then just run:

node index.js

🔧 Supported Variables

| Variable | Description | | ------------------ | ---------------------------------------------------- | | $senderName | Name of the message sender | | $botName | The name you set for your bot | | $botNumber | The phone number of your bot | | $uptime | How long the bot has been running | | $latency | Message latency in milliseconds | | $now | Current time (Asia/Jakarta) | | $day[timezone] | Current weekday (default: Asia/Jakarta) | | $date[timezone] | Current date (default: Asia/Jakarta) | | $args[n] | Argument at index n (e.g., $args[0]) | | $random[min;max] | Random number between min and max (default: 0–9) | | $upper[text] | Convert text to uppercase | | $lower[text] | Convert text to lowercase |


📱 WhatsApp Specific Variables

| Variable | Description | | ---------------- | --------------------------------- | | $number | Your number (without domain) | | $number[num] | Target number | | $about | Your "about" info | | $about[num] | Target's "about" info | | $ppUrl | Your profile picture URL | | $ppUrl[num] | Target's profile picture URL | | $lastSeen | Your last seen (if available) | | $lastSeen[num] | Target's last seen (if available) | | $mention[n] | Mentioned user at index n | | $groupName | Current group name (if in group) | | $groupDesc | Group description (if in group) | | $groupId | Group ID (JID) |


📂 Folder Structure (Recommended)

swb-bot/
├── index.js          # Main bot file
├── package.json
└── node_modules/

💡 Tips

  • To test group features, make sure to add your bot to a WhatsApp group.
  • To use $mention, mention someone when calling the command.
  • Commands are case-insensitive (e.g., /PING works the same as /ping).

📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.


🛠 Built With

  • Baileys - WhatsApp Web API library
  • Node.js

🤝 Contributing

Pull requests and feature suggestions are welcome! Feel free to open an issue or submit a PR if you have something to add.