Kohone
10/14/2016 - 2:31 PM

node.js

node.js

var TelegramBot = require('node-telegram-bot-api');
var token = '279169393:AAHhQRsQtTZhahAeNb6PRsl7fDvnjdBStL0';
var bot = new TelegramBot(token, {polling: true});

bot.on('message', function (msg) {

    var chatId = msg.chat.id;

    bot.onText(/.*баланс.*/i, function (msg, match) {

        console.log();
        var chatId = msg.chat.id;
        bot.sendMessage(chatId, 'У Вас нет доступа к данной информации.');
    });

    const yesno = {
        parse_mode: "Markdown",
        reply_markup: {
            keyboard: [["Yes"], ["Back"]],
            resize_keyboard: true,
            one_time_keyboard: true,
        },
    };


    console.log(msg);
    bot.sendMessage(chatId, "Hello!", yesno);
});