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

@wayofmono/telegram

v1.0.2

Published

WayOfMono first-party Telegram SDK package.

Readme

@wayofmono/telegram

This package provides a first-party TypeScript SDK for interacting with the Telegram Bot API. It aims to replace the external pi-telegram extension and unify Telegram integration within the WayOfMono ecosystem.

Features

  • Telegram Bot API Client: Provides a TelegramBot class to interact with the Telegram Bot API.
  • Token Validation: setupTelegramBot(token) function to validate bot tokens.
  • Message Sending: sendMessage method with Markdown support.
  • Webhook Management: setWebhook and deleteWebhook methods.
  • Long Polling: startPolling and stopPolling for receiving updates.
  • File Handling: getFile and downloadFile methods for media.

Installation

pnpm add @wayofmono/telegram
# or
npm install @wayofmono/telegram
# or
yarn add @wayofmono/telegram

Usage

import { setupTelegramBot } from '@wayofmono/telegram';

async function main() {
  const token = process.env.TELEGRAM_BOT_TOKEN;
  if (!token) {
    console.error('TELEGRAM_BOT_TOKEN environment variable is not set.');
    process.exit(1);
  }

  try {
    const { bot, botInfo } = await setupTelegramBot(token);
    console.log(`Bot connected: ${botInfo.username}`);

    // Example: Send a message
    // await bot.sendMessage('<YOUR_CHAT_ID>', 'Hello from WayOfMono Telegram Bot!');

    // Example: Start polling for updates
    // bot.startPolling(async (update) => {
    //   if (update.message) {
    //     console.log(`Received message from ${update.message.from?.username}: ${update.message.text}`);
    //     // await bot.sendMessage(update.message.chat.id.toString(), `You said: ${update.message.text}`);
    //   }
    // });

  } catch (error) {
    console.error('Failed to set up Telegram Bot:', error);
  }
}

main();

API

setupTelegramBot(token: string): Promise<{ bot: TelegramBot; botInfo: BotInfo }>

Validates the provided bot token using getMe and returns a TelegramBot instance along with the BotInfo.

class TelegramBot

constructor(token: string)

Initializes the TelegramBot instance with the provided token.

async getMe(): Promise<BotInfo>

Returns basic information about the bot.

async setWebhook(url: string): Promise<boolean>

Specifies a URL to receive incoming updates via an outgoing webhook.

async deleteWebhook(): Promise<boolean>

Removes webhook integration.

async startPolling(handler: (update: Update) => Promise<void>, intervalMs?: number): Promise<void>

Starts long polling for updates.

async stopPolling(): Promise<void>

Stops the active long polling.

async sendMessage(chatId: string, text: string, opts?: SendMessageOpts): Promise<Message>

Sends a text message. opts can include parse_mode, disable_web_page_preview, etc.

async getFile(fileId: string): Promise<File>

Returns basic information about a file and prepares it for downloading.

async downloadFile(filePath: string, dest: string): Promise<void>

Downloads a file from Telegram servers.

Contributing

Please refer to the main repository's contributing guidelines.