https://github.com/lsongdev/telegram-bot
🤖 Simple JavaScript API for Telegram Bot
https://github.com/lsongdev/telegram-bot
telegram-bot
Last synced: about 1 year ago
JSON representation
🤖 Simple JavaScript API for Telegram Bot
- Host: GitHub
- URL: https://github.com/lsongdev/telegram-bot
- Owner: lsongdev
- License: mit
- Created: 2019-10-16T11:55:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-16T12:16:05.000Z (over 6 years ago)
- Last Synced: 2025-02-13T22:23:49.287Z (about 1 year ago)
- Topics: telegram-bot
- Language: JavaScript
- Homepage: https://core.telegram.org/bots/api
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## telegram-bot
> Simple JavaScript API for Telegram Bot
### Installation
```bash
$ npm install telegram-bot
```
### Example
```js
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](./LICENSE).
---