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

@mks2508/telegram-bot-manager

v0.1.3

Published

Telegram Bot Manager - CLI & Library for BotFather automation via GramJS MTProto

Readme

@mks2508/telegram-bot-manager

CLI & Library for automating Telegram BotFather operations via GramJS MTProto.

Features

  • Create bots via @BotFather automatically
  • Create supergroups with forum mode enabled
  • Manage forum topics (create, delete, configure)
  • Multi-bot management with environment configs
  • Interactive CLI with spinners and prompts

Installation

As CLI (npx)

# Bootstrap a new bot interactively
npx @mks2508/telegram-bot-manager bootstrap

# List bots from BotFather
npx @mks2508/telegram-bot-manager bootstrap --list

# Manage configured bots
npx @mks2508/telegram-bot-manager bot list
npx @mks2508/telegram-bot-manager bot use mybot123bot

# Configure bot via BotFather
npx @mks2508/telegram-bot-manager configure commands mybot123bot
npx @mks2508/telegram-bot-manager configure description mybot123bot

# Create forum topics
npx @mks2508/telegram-bot-manager topics

As Library

npm install @mks2508/telegram-bot-manager

CLI Commands

| Command | Description | |---------|-------------| | bootstrap | Interactive bot setup wizard | | bootstrap --list | Import bots from BotFather | | bot list | List configured bots | | bot use <name> | Set active bot | | bot info <name> | Show bot details | | bot delete <name> | Delete bot config | | bot migrate | Migrate old .env files | | configure commands | Set bot commands | | configure description | Set bot description | | configure about | Set bot about text | | configure name | Set bot display name | | topics | Create forum topics |

Library Usage

import {
  BootstrapClient,
  BotFatherManager,
  GroupManager,
  TopicManager,
  EnvManager,
} from '@mks2508/telegram-bot-manager'

// Connect to Telegram via MTProto
const client = new BootstrapClient({
  apiId: 12345,
  apiHash: 'your_api_hash',
})
await client.ensureAuthorized()

// Create a bot via BotFather
const botFather = new BotFatherManager(client)
const result = await botFather.createBot({
  botName: 'My Bot',
  botUsername: 'mybot123bot',
})

if (result.success) {
  console.log('Bot created:', result.botToken)
}

// List all your bots
const bots = await botFather.getAllBotsWithTokens()
console.log('Your bots:', bots)

// Create a supergroup with forum mode
const groupManager = new GroupManager(client)
const group = await groupManager.createSupergroup({
  title: 'My Bot Control',
  forumMode: true,
})

// Create topics
const topicManager = new TopicManager(result.botToken)
await topicManager.createTopics(group.chatId, ['General', 'Logs', 'Control'])

// Manage bot configurations
const envManager = new EnvManager()
await envManager.createEnv('mybot123bot', 'local', {
  botToken: result.botToken,
  controlChatId: String(group.chatId),
})

API Reference

BootstrapClient

GramJS client wrapper for Telegram MTProto operations.

const client = new BootstrapClient({ apiId, apiHash })
await client.ensureAuthorized() // Interactive login
await client.disconnect()

BotFatherManager

Automate @BotFather interactions.

const botFather = new BotFatherManager(client)

// List bots
const bots = await botFather.listBots()

// Create bot
const result = await botFather.createBot({ botName, botUsername })

// Get all bots with tokens
const botsWithTokens = await botFather.getAllBotsWithTokens()

// Configure bot
await botFather.setCommands(username, commands)
await botFather.setDescription(username, description)
await botFather.setAboutText(username, aboutText)
await botFather.setName(username, displayName)

GroupManager

Create and manage Telegram groups/forums.

const groupManager = new GroupManager(client)

// Get user's forums
const forums = await groupManager.getUserForums()

// Create supergroup
const result = await groupManager.createSupergroup({
  title: 'My Group',
  forumMode: true,
})

// Add bot as admin
await groupManager.addBotAsAdmin(chatId, botUsername, {
  canManageTopics: true,
  canDeleteMessages: true,
})

// Get topics
const topics = await groupManager.getForumTopics(chatId)

TopicManager

Create forum topics using Bot API.

const topicManager = new TopicManager(botToken)

// Create single topic
const result = await topicManager.createTopic(chatId, 'Logs')

// Create multiple topics
const results = await topicManager.createTopics(chatId, [
  'General',
  'Logs',
  'Control',
  'Config',
])

EnvManager

Manage multi-bot environment configurations.

const envManager = new EnvManager()

// List configured bots
const bots = envManager.listBots()

// Get/set active bot
const active = envManager.getActiveBot()
await envManager.setActiveBot('mybot123bot')

// CRUD operations
await envManager.createEnv('mybot', 'local', { botToken, ... })
const config = await envManager.readEnv('mybot', 'local')
await envManager.updateEnv('mybot', 'local', { ... })
await envManager.deleteBot('mybot')

// Migrate old .env files
await envManager.migrateOldEnvs()

Requirements

  • Node.js >= 18.0.0
  • Telegram API credentials from https://my.telegram.org

License

MIT