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

shegraf

v1.0.0

Published

Shegraf: multi-platform bot helper for WhatsApp (Baileys), Telegram and Discord.

Readme

shegraf

Multi-platform bot for WhatsApp (Baileys), Telegram, and Discord with colorful buttons and WhatsApp pairing code support.

This package is designed so anyone can quickly run a personal or small‑scale bot without touching the internal code.


Features

  • WhatsApp bot using @whiskeysockets/baileys
    • Device-link pairing code support
    • Simple command handler (e.g. !menu)
    • Reply with emoji-colored buttons (WhatsApp does not support true colored button backgrounds)
  • Telegram bot using Telegraf
    • /start and /menu commands
    • Inline buttons: Red, Green, Blue
  • Discord bot using discord.js v14
    • Text command (default: !menu)
    • Colored buttons (Danger/Success/Primary)
    • Colored embed response
  • Single CLI entry point to start all enabled platforms.

Installation

Install globally (recommended for running the bot from anywhere):

npm install -g shegraf

Or use it once without global install:

npx shegraf

CLI Usage

Once installed globally, run:

shegraf

Behind the scenes this runs the CLI script at src/index.js which:

  • Starts the WhatsApp bot (if WA_PHONE_NUMBER is set)
  • Starts the Telegram bot (if TELEGRAM_BOT_TOKEN is set)
  • Starts the Discord bot (if DISCORD_BOT_TOKEN is set)

If any of these environment variables is missing, that platform is simply skipped with an informational log message. The process does not crash.


Environment Variables

Set the following variables to enable each platform.

Common

  • COMMAND_PREFIX (optional)
    • Default: !
    • Used for text commands on WhatsApp and Discord (e.g. !menu)

WhatsApp (Baileys)

  • WA_PHONE_NUMBER (required to enable WhatsApp)
    • Format: international, numbers only.
      • Example (Indonesia): 62812xxxxxxxx

When WA_PHONE_NUMBER is provided and the device is not yet registered, the bot will:

  • Print a QR code to the terminal
  • Print a pairing code for device link

WhatsApp data is stored in a local folder (multi-file auth) under:

auth/whatsapp

Telegram

  • TELEGRAM_BOT_TOKEN (required to enable Telegram)
    • Example: 123456789:AA... from BotFather

Discord

  • DISCORD_BOT_TOKEN (required to enable Discord)
    • Obtain from Discord Developer Portal
    • Make sure the MESSAGE CONTENT INTENT is enabled for the bot

Platform Details

1. WhatsApp (Baileys)

Powered by @whiskeysockets/baileys.

Main behavior:

  • Connects using Baileys with multi-file auth
  • If not registered:
    • Requests pairing code for WA_PHONE_NUMBER

    • Logs something like:

      [WA] Pairing code for 62812xxxxxxxx: ABCD-EFGH

Pairing Steps

  1. Set WA_PHONE_NUMBER (numbers only, e.g. 62812xxxxxxxx)

  2. Run:

    shegraf
  3. In the terminal you will see:

    • QR code
    • Pairing code (e.g. ABCD-EFGH)
  4. On your phone:

    • Open WhatsApp
    • Go to Linked devices / Perangkat tertaut
    • Tap Link a device
    • Either scan the QR code or choose the option to enter a device code and type the pairing code from the terminal.

After pairing, the bot is connected to your WhatsApp account.

WhatsApp Commands

  • Default prefix: !

Send to the bot:

!menu

The bot responds with a menu containing three buttons:

  • 🔴 Merah
  • 🟢 Hijau
  • 🔵 Biru

Note: WhatsApp does not support true colored button backgrounds like Discord, so the color effect comes from the emojis and labels.


2. Telegram

Powered by telegraf.

Once TELEGRAM_BOT_TOKEN is set and the CLI is running, the bot:

  • Responds to /start
  • Responds to /menu

Both commands send a message with inline buttons:

  • 🔴 Merah
  • 🟢 Hijau
  • 🔵 Biru

On button press, the bot replies with which color you selected.

Setup Steps

  1. Talk to @BotFather on Telegram and create a bot

  2. Copy the bot token and set it as:

    export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"

    or on Windows (PowerShell):

    setx TELEGRAM_BOT_TOKEN "your-telegram-bot-token"
  3. Run:

    shegraf
  4. Open your bot chat and send /start or /menu.


3. Discord

Powered by discord.js v14.

Once DISCORD_BOT_TOKEN is set and the CLI is running, the bot:

  • Listens to messages in guild channels
  • Responds to text command (default): !menu

The bot replies with a message containing three buttons:

  • Merah (Danger style, red)
  • Hijau (Success style, green)
  • Biru (Primary style, blurple/blue)

When you click a button, it responds with an embed:

  • Title: Pilihan Warna
  • Description: Kamu pilih <color>
  • Embed color matching the button (red/green/blue)

Setup Steps

  1. Create an application & bot at Discord Developer Portal

  2. Enable the MESSAGE CONTENT INTENT in the bot settings

  3. Generate an invite URL with bot scope and necessary permissions (e.g. Send Messages, Read Message History)

  4. Invite the bot to your server

  5. Set the environment variable:

    export DISCORD_BOT_TOKEN="your-discord-bot-token"

    or on Windows (PowerShell):

    setx DISCORD_BOT_TOKEN "your-discord-bot-token"
  6. Run:

    shegraf
  7. In a text channel, type:

    !menu

Programmatic Usage (Library)

You can also use this package as a library inside your own Node.js project, not only as a CLI.

Install in your project

npm install shegraf

Import and use

CommonJS example:

const {
  startWhatsApp,
  startTelegram,
  startDiscord,
  startAll,
  createShegraf
} = require("shegraf");

// Option 1: Start everything (WhatsApp, Telegram, Discord) reading from env
startAll();

// Option 2: Start everything with explicit options (no .env required)
startAll({
  whatsapp: {
    phoneNumber: "62812xxxxxxxx",
    pairingLog: ({ phoneNumber, code }) => {
      console.log("PAIRING", phoneNumber, code);
    }
  },
  telegram: {
    token: "your-telegram-bot-token"
  },
  discord: {
    token: "your-discord-bot-token",
    commandPrefix: "!"
  }
});

// Option 3: Start only specific platforms using options
startWhatsApp({ phoneNumber: "62812xxxxxxxx" });
startTelegram({ token: "your-telegram-bot-token" });
startDiscord({ token: "your-discord-bot-token", commandPrefix: "!" });

// Option 4: Use high-level Shegraf wrapper
const bot = createShegraf({
  whatsapp: { phoneNumber: "62812xxxxxxxx" },
  telegram: { token: "your-telegram-bot-token" },
  discord: { token: "your-discord-bot-token", commandPrefix: "!" }
});

bot.start();

All environment variables described in the previous sections (WA_PHONE_NUMBER, TELEGRAM_BOT_TOKEN, DISCORD_BOT_TOKEN, COMMAND_PREFIX) are still supported, but any explicit options you pass to the functions take precedence.

You can combine this with your own configuration file (for example config.js) and other application logic.


Local Development

If you clone the repository instead of using the published package:

git clone https://github.com/sherifcld/sherif-multi-bot.git
cd sherif-multi-bot
npm install

You can try the library example:

cd example
cp config.example.js config.js   # or copy manually on Windows

Edit config.js and fill in your own WhatsApp number and tokens, then run:

node index.js

This starts all enabled platforms based on your config file.


Security Notes

  • Never share your DISCORD_BOT_TOKEN, TELEGRAM_BOT_TOKEN, or WhatsApp auth files
  • If you suspect your tokens have leaked, revoke and regenerate them immediately
  • For production use, consider running the bot on a separate machine or server

License

MIT License. See the repository or npm page for full details.