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 🙏

© 2025 – Pkg Stats / Ryan Hefner

telebot.js

v1.0.1

Published

> telegram bot api for node.js written in typescript

Readme

Telegram API (Node.js with TypeScript)

telegram bot api for node.js written in typescript

Telegram API is a Node.js library written in TypeScript that provides a simple interface for interacting with the Telegram Bot API. With this library, you can easily send messages, get information about your bot, and handle updates from Telegram. The library also supports polling and events for real-time interaction with the Telegram server.

Example

import { Client, User, Message, Update } from 'telegram-api';

const token = 'YOUR_TELEGRAM_BOT_TOKEN'; // Replace with telegram bot token
const client = new Client(token);

(async () => {
  try {
    // Get information about the bot
    const me: User = await client.getMe();
    console.log('Bot Info:', me);

    // Send a message
    const chatId = 'CHAT_ID'; // Replace with the destination chat ID
    const message: Message = await client.sendMessage(chatId, 'Hello, Telegram!');
    console.log('Message Sent:', message);

    // Get updates
    const updates: Update[] = await client.getUpdates();
    console.log('Updates:', updates);
  } catch (error) {
    console.error('Error:', error);
  }
})();

API Methods

getMe()

Get information about the bot.

sendMessage()

Send a message to a specified chat.

chat_id: The ID of the chat where the message will be sent.
text: The text of the message.
reply_to_message_id (Optional): ID of the message to reply to.
allow_sending_without_reply (Optional): Whether to allow sending without a reply.

getUpdates()

Get updates from the Telegram server.

offset (Optional): The starting update ID.
limit (Optional): Maximum number of updates to retrieve.
timeout (Optional): Timeout in seconds for long polling.
allowed_updates (Optional): List of update types to receive.

startPolling()

Start polling for updates from the Telegram server.

timeout (Default 30): Timeout in seconds for long polling.

stopPolling()

Stop polling for updates.

TODO

  • Add more methods for extended API coverage. ✅ [COMPLETED]
  • Implement polling and events for real-time updates. ✅ [COMPLETED]

Documentation

For detailed documentation, refer to the Typedoc generated documentation in the docs folder.

To generate documentation

npm run docs

Testing

This project uses Mocha and Chai for testing. Run tests using the following command:

npm test

Contributing

Feel free to contribute to this project by opening issues or submitting pull requests. Your feedback and contributions are welcome!

License

This project is licensed under the GPL-3 License - see the LICENSE file for details.