2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-30 05:48:00 +00:00

Update polling.js

This commit is contained in:
Yago 2015-10-19 20:44:02 +02:00
parent 604d0ff155
commit bbcf28bccc

View File

@ -12,14 +12,14 @@ bot.getMe().then(function (me) {
console.log('Hi my name is %s!', me.username); console.log('Hi my name is %s!', me.username);
}); });
bot.onText(/\/photo.*/, function (msg) { bot.onText(/\/photo/, function (msg) {
var chatId = msg.chat.id; var chatId = msg.chat.id;
// From file // From file
var photo = __dirname+'/../test/bot.gif'; var photo = __dirname+'/../test/bot.gif';
bot.sendPhoto(chatId, photo, {caption: "I'm a bot!"}); bot.sendPhoto(chatId, photo, {caption: "I'm a bot!"});
}); });
bot.onText(/\/audio.*/, function (msg) { bot.onText(/\/audio/, function (msg) {
var chatId = msg.chat.id; var chatId = msg.chat.id;
var url = 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg'; var url = 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg';
// From HTTP request! // From HTTP request!
@ -32,7 +32,7 @@ bot.onText(/\/audio.*/, function (msg) {
}); });
}); });
bot.onText(/\/love.*/, function (msg) { bot.onText(/\/love/, function (msg) {
var chatId = msg.chat.id; var chatId = msg.chat.id;
var opts = { var opts = {
reply_to_message_id: msg.message_id, reply_to_message_id: msg.message_id,