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

xaxaxage-telegrambot-library

v2.0.0

Published

<h1 align="center"><b>Telegram bot library</b></h1>

Readme

Class TelegramBot with constructor TelegramBot(token)

Bot.data

Bot.data.update_id - Update id Bot.data.message.message_id - Message id Bot.data.message.from.id - User id Bot.data.message.from.is_bot - If user is bot. (true or false) Bot.data.message.from.first_name - User firstname Bot.data.message.from.last_name - User lastname Bot.data.message.from.username - User username Bot.data.message.from.language_code User laguage code Bot.data.message.chat.id - Chat id Bot.data.message.chat.type - Chat type (private or public) Bot.data.message.date - Message date Bot.data.message.text - Message text

Function getMessage

Takes two arguments: gettingText, callBack

gettingText - Message bot has to answer (string) (required) callBack - Function that bot has to call if gettingText was sent to bot (function) (required)

Function sendMessage

Takes two arguments: messageText and parse_mode

messageText - Message to response (string) (required) parse_mode - Parse mode (string) (not required)

Must be called only in getMessage or setCommand functions

Function sendSticker

Takes one argument: sticker_id

sticker_id - Id of sticker to send (string) (required)

Must be called only in getMessage or setCommand functions

Function setCommand

Takes three arguments: command, description and callBack

command - Command to get (string) (required) description - Description for command. If no description leave '' (string) (required) callBack - Function that bot has to call if command was sent to bot (function) (required)

Function setChatMenu

Takes no arguments

Adding menu button to a telegram bot

Function setReplyKeyboard

Takes one argument: Object with text, keyboard, is_persisent, resize_keyboard, input_field_placeholder, one_time_keyboard, selective

Object - {text: messageText, keyboard: keyboard, is_persisent: is_persisent, resize_keyboard: resize_keyboard, input_field_placeholder: input_field_placeholder selective: selective}

text - Message to send (string) (required) keyboard - Buttons of a keyboard (Array of a buttons) (required)

Look at documentation:

is_persisent (bool) (not required)resize_keyboard (bool) (not required)input_field_placeholder (string) (not required)one_time_keyboard (bool) (not required)selective (bool) (not required)

Must be called only in getMessage or setCommand functions

Function replyKeyboardRemove

Takes one argument: chat_id

chat_id - Id of the chat. Must be: Bot.data.message.chat.id (string or integer) (required)

Must be called only in getMessage or setCommand functions

Function setReplyKeyboard

Takes one argument: Object with text, keyboard

Object - {text: messageText, keyboard: keyboard}

text - Message to send (string) (required) keyboard - Buttons of a keyboard (Array of a buttons) (required)

Look at documentation:
Must be called only in getMessage or setCommand functions

Function polling

Takes no arguments

Starts the bot

const Bot = new TelegramBot(token)

// --sendMessage--------------------------------------------------------------------------

Bot.getMessage('message', () => {
   Bot.sendMessage('message to send', 'parse mode')
})

// --setCommand--------------------------------------------------------------------------

Bot.setCommand('/command', 'description', () => {
   Bot.sendMessage('message to send', 'parse mode')
})

// --sendSticker-------------------------------------------------------------------------

Bot.getMessage('message2', () => {
   Bot.sendSticker('sticker id')
})

// --setChatMenu-------------------------------------------------------------------------

Bot.setChatMenu()

// --setReplyKeyboard--------------------------------------------------------------------

Bot.getMessage('keyboard', () => {
   const markup = 
      [
         ['Button1_row_1', 'Button2_row_1'], 
         ['Button1_row_2', 'Button2_row_2'], 
      ]

   Bot.setReplyKeyboard({text: 'Keyboard', keyboard: markup})
})

// --replyKeyboardRemove-----------------------------------------------------------------

Bot.getMessage('keyboard button message', () => {
   Bot.replyKeyboardRemove(Bot.data.message.chat.id)
})

// --setInlineKeyboard-------------------------------------------------------------------

Bot.getMessage('inline keyboard', () => {
   const markup = 
      [
         [{text: 'Button1_row1', url: 'url'}, {text: 'Button2_row1'}],
         [{text: 'Button1_row2', url: 'url'}, {text: 'Button2_row2'}]
      ]

   Bot.setInlineKeyboard({text: 'Keyboard', keyboard: markup})
})

// --polling-----------------------------------------------------------------------------

Bot.polling()