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

@messanger/bot-sdk

v1.0.0

Published

Official Bot SDK for Mess&Anger Messenger — Build powerful P2P bots

Readme

@messanger/bot-sdk

Official Bot SDK for Mess&Anger Messenger — Build powerful P2P bots with TypeScript

npm version License: MIT TypeScript


🚀 Features

  • Command Routing/command handlers with auto-matching
  • Message Handling — Text, media, and callback messages
  • Inline Keyboards — Beautiful button layouts
  • FSM Support — Multi-step conversations out of the box
  • Webhooks — External integrations (Paymento, APIs)
  • Payments — Accept Stars from users
  • Analytics — Track bot usage and performance
  • P2P Native — No servers required, direct WebRTC connections
  • TypeScript — Full type safety

📦 Installation

npm install @messanger/bot-sdk

📖 Quick Start

1. Create a Bot

First, create a bot in Mess&Anger:

  1. Open Settings → Bots → Create Bot
  2. Enter name, description, commands
  3. Copy the token

2. Write Bot Code

import { MessAngerBot, InlineKeyboardBuilder } from '@messanger/bot-sdk';

// Initialize bot
const bot = new MessAngerBot({
  token: 'bot:your-token-here',
  name: 'MyHelperBot',
  commands: [
    { command: '/start', description: 'Start the bot' },
    { command: '/help', description: 'Show help' },
  ],
});

// Handle /start command
bot.onCommand('/start', async (ctx) => {
  await ctx.reply('👋 Привет! Я бот-помощник.\n\nИспользуй /help для списка команд.');
});

// Handle /help command
bot.onCommand('/help', async (ctx) => {
  const keyboard = new InlineKeyboardBuilder()
    .callback('📚 Документация', 'docs')
    .callback('💬 Поддержка', 'support')
    .row()
    .url('🌐 Сайт', 'https://mess.cvr.name')
    .build();

  await ctx.reply('📖 Справка:', { keyboard });
});

// Handle callback queries
bot.onCallbackQuery('docs', async (ctx) => {
  await ctx.answerCallback();
  await ctx.reply('📚 Документация: https://github.com/joker096/mESS/tree/main/docs');
});

bot.onCallbackQuery('support', async (ctx) => {
  await ctx.answerCallback();
  await ctx.reply('💬 Поддержка: @support_bot');
});

// Handle regular messages
bot.onMessage(async (ctx) => {
  if (ctx.text) {
    await ctx.reply(`🤔 Я не понимаю "${ctx.text}". Используй /help для списка команд.`);
  }
});

// Start bot
await bot.start();
console.log('✅ Bot started!');

3. Run Bot

# Development
npx tsx bot.ts

# Production
npm run build
node dist/bot.js

📚 API Reference

MessAngerBot(options)

Main bot class.

| Option | Type | Required | Description | |--------|------|----------|-------------| | token | string | ✅ | Bot token from Mess&Anger | | name | string | ✅ | Display name | | description | string | ❌ | Bot description | | commands | BotCommand[] | ❌ | List of commands |

bot.onCommand(command, handler)

Register command handler.

bot.onCommand('/start', async (ctx) => {
  await ctx.reply('Hello!');
});

bot.onMessage(handler)

Handle non-command messages.

bot.onMessage(async (ctx) => {
  if (ctx.text) {
    await ctx.reply(`You said: ${ctx.text}`);
  }
});

bot.onCallbackQuery(pattern, handler)

Handle inline keyboard callbacks.

bot.onCallbackQuery('settings', async (ctx) => {
  await ctx.answerCallback();
  await ctx.reply('Settings...');
});

bot.setFSM(fsm)

Enable multi-step conversations.

import { BotFSM } from '@messanger/bot-sdk';

const fsm = new BotFSM({
  initialState: 'idle',
  states: {
    idle: {
      onMessage: async (ctx) => {
        if (ctx.text === '/register') return 'waiting_name';
      },
    },
    waiting_name: {
      onEnter: async (ctx) => await ctx.reply('What is your name?'),
      onMessage: async (ctx, fsmCtx) => {
        fsmCtx.data.name = ctx.text;
        return 'done';
      },
    },
    done: {
      onEnter: async (ctx, fsmCtx) => {
        await ctx.reply(`Nice to meet you, ${fsmCtx.data.name}!`);
      },
    },
  },
});

bot.setFSM(fsm);

🎨 Examples

See examples/ directory:

  • echo-bot.ts — Simple echo bot
  • menu-bot.ts — Bot with inline keyboard menu
  • registration-bot.ts — Multi-step registration with FSM
  • payment-bot.ts — Bot that accepts payments
  • webhook-bot.ts — Bot with external webhooks

🔒 Security

  • Tokens are encrypted — never share them publicly
  • Bot permissions limit what bots can do
  • All P2P messages are E2E encrypted

📄 License

MIT


💬 Support