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

telespam

v0.9.0

Published

Self-hosted anti-spam bot for Telegram groups — keyword filtering, profile photo check, multi-step verification & auto-approval

Readme

English | 中文

🤖 Telespam

npm version npm downloads license node version

Self-hosted anti-spam bot for Telegram groups — keeps your community clean with keyword filtering, profile photo checks & multi-step verification.

Features

  • 🔑 Keyword Blacklist — Block join requests whose name or bio contains blacklisted keywords (case-insensitive)
  • 🖼️ Profile Photo Check — Require users to have a profile photo before joining
  • ✅ Auto-Approve — Automatically approve requests that pass all rules
  • ❓ Verification Questions — Challenge users with single or multi-step quizzes after approval
  • 🌐 Multi-Language — Built-in English and Chinese (中文) bot messages
  • 🔄 Multi-Instance — Run multiple bots from a single config file
  • 🐧 Systemd Service — One-command install for systemd-based Linux servers

Prerequisites

The Bot must be added as a group administrator with at least "Invite Users" permission to receive chat_join_request events and approve / decline join requests. If verification questions are enabled, "Ban Users" permission is also required to kick users who fail.

Installation

sudo npm i -g telespam

Configuration

Create a /etc/telespam/your-telegram-bot.json file with the following structure:

{
  "language": "en",
  "apiKey": "123456:ABC-DEF",
  "requireProfilePhoto": false,
  "requireBio": false,
  "autoApprove": false,
  "keywordBlacklist": ["spam", "广告"],
  "verification": null
}

| Option | Type | Default | Description | | --------------------- | -------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------- | | language | "en" | "zh" | "en" | Language for bot messages | | apiKey | string | (required) | Bot API key from @BotFather | | requireProfilePhoto | boolean | false | Require users to have a profile photo | | requireBio | boolean | false | Require users to have a bio | | autoApprove | boolean | false | Auto-approve requests that pass all rules | | keywordBlacklist | string[] | [] | Blacklisted keywords in names & bio (case-insensitive). Wrap with / for regex (e.g. /^spam\d+$/) | | verification | object | object[] | null | null | Verification question(s) sent after approval |

Verification

A single verification question:

{
  "verification": {
    "question": "What is 1 + 1?",
    "options": ["1", "2", "3"],
    "answer": 1,
    "timeout": 180
  }
}

Multiple verification questions (multi-step):

{
  "verification": [
    {
      "question": "What is 2 + 2?",
      "options": ["3", "4", "5"],
      "answer": 1,
      "timeout": 60
    },
    {
      "question": "Which city is the capital of France?",
      "options": ["London", "Berlin", "Paris"],
      "answer": 2,
      "timeout": 60
    }
  ]
}

Users must answer all questions correctly in order. A wrong answer at any step results in an immediate kick.

| Field | Type | Default | Description | | ---------- | ---------- | ------------ | ----------------------------------------- | | question | string | (required) | The question text | | options | string[] | (required) | Answer options as inline buttons | | answer | number | (required) | 0-based index of the correct option | | columns | number | 2 | Number of options displayed per row | | timeout | number | 180 | Seconds before kicking unresponsive users |

Multi-instance

To run multiple bots with a single config file, use a JSON array. Each bot username is auto-detected via the Telegram API and included in log output:

[
  {
    "language": "en",
    "apiKey": "123456:ABC-DEF",
    "requireProfilePhoto": true,
    "autoApprove": true,
    "keywordBlacklist": ["spam"],
    "verification": null
  },
  {
    "language": "zh",
    "apiKey": "654321:GHI-JKL",
    "requireProfilePhoto": false,
    "autoApprove": false,
    "keywordBlacklist": ["广告"],
    "verification": [
      {
        "question": "What is 1 + 1?",
        "options": ["1", "2", "3"],
        "answer": 1,
        "timeout": 180
      }
    ]
  }
]

Systemd Service

To install and start the service:

telespam install

To stop and uninstall the service:

telespam uninstall

To restart after config changes or package updates:

telespam restart

To view live logs:

telespam logs

Programmatic Usage

import { Telespam } from 'telespam';

const bot = new Telespam({
  language: 'zh',
  apiKey: '123456:ABC-DEF',
  requireProfilePhoto: true,
  autoApprove: true,
  keywordBlacklist: ['spam', '广告'],
  verification: [
    {
      question: 'What is 1 + 1?',
      options: ['1', '2', '3'],
      answer: 1,
      timeout: 180,
    },
  ],
});

await bot.start();

API

new Telespam(options)

| Option | Type | Default | Description | | --------------------- | ---------------------------------------------- | ------------ | ---------------------------------------------------------------------------------- | | language | 'en' \ | 'zh' | 'en' | Language for bot messages | | apiKey | string | (required) | Bot API key from @BotFather | | requireProfilePhoto | boolean | false | Require users to have a profile photo | | autoApprove | boolean | false | Auto-approve requests that pass all rules | | keywordBlacklist | string[] | [] | Blacklisted keywords in first_name / last_name / username / bio (case-insensitive) | | verification | VerificationConfig | VerificationConfig[] | null | Verification question(s) sent after approval |

VerificationConfig

| Field | Type | Default | Description | | ---------- | ---------- | ------------ | ----------------------------------------- | | question | string | (required) | The question text | | options | string[] | (required) | Answer options as inline buttons | | answer | number | (required) | 0-based index of the correct option | | timeout | number | 180 | Seconds before kicking unresponsive users |

bot.start()

Starts long-polling for Telegram updates and reviews incoming join requests.

bot.stop()

Stops the bot and releases resources.