Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-bot

Simple JavaScript API for Telegram Bot

Installation

$ npm install telegram-bot

Example

const TelegramBot = require('telegram-bot');

const { TELEGRAM_BOT_TOKEN: token } = process.env;

const bot = new TelegramBot({
  token
});

bot.on('message', message => {
  const { from, chat, text } = message;
  console.log(`${from.username}:`, text);
  bot.sendMessage({ chat_id: chat.id, text });
});

(async () => {

  const { first_name, username } = await bot.getMe();
  console.log(`${first_name} (@${username}) is logged in.`);
  
  await bot.startPolling();

})();

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT

This work is licensed under the MIT license.


About

🤖 Simple JavaScript API for Telegram Bot

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages