mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-30 22:05:28 +00:00
Update README.md
This commit is contained in:
18
README.md
18
README.md
@@ -1,5 +1,23 @@
|
||||
[](https://travis-ci.org/yagop/telegram-bot-api) [](https://coveralls.io/r/yagop/telegram-bot-api?branch=develop)
|
||||
|
||||
```sh
|
||||
npm install node-telegram-bot-api
|
||||
```
|
||||
|
||||
```js
|
||||
var TelegramBot = require('node-telegram-bot-api');
|
||||
|
||||
var token = 'YOUR_TELEGRAM_BOT_TOKEN';
|
||||
// Setup polling way
|
||||
var bot = new TelegramBot(token, {polling: true});
|
||||
bot.on('message', function (msg) {
|
||||
var chatId = msg.chat.id;
|
||||
// photo can be: a file path, a stream or a Telegram file_id
|
||||
var photo = 'bot.gif';
|
||||
bot.sendPhoto(chatId, photo, {caption: "I'm a bot!"});
|
||||
});
|
||||
```
|
||||
|
||||
* * *
|
||||
|
||||
## Class: TelegramBot
|
||||
|
Reference in New Issue
Block a user