benjick / meteor-telegram-bot

Telegram bot plugin for Meteor
24 stars 15 forks source link

Custom Keyboard doesn't show up #11

Closed alexivanovvv closed 8 years ago

alexivanovvv commented 8 years ago

Hi @benjick, great package, thanks for the effort. Meanwhile, I couldn't make custom keyboard work. Here is a sample which should, according to Telegram API, work, but somehow no keyboard is shown.

    TelegramBot.addListener('/a', function(command, username, original) {
      var kb = {
        keyboard: [
        ['one'],
        ['two', 'three'],
        ['four', 'five', 'six']
        ],
        one_time_keyboard: true
      };

      var message = "Which is more likely?";

      TelegramBot.method('sendMessage',{
        chat_id: original.chat.id,
        text: message,
        reply_markup: kb
      });
    });
alexivanovvv commented 8 years ago

Resolved: Telegram needs stringified keyboard as an input for reply_markup, not an object. Resolved by adding: keyboard= EJSON.stringify(kb); EJSON package is needed (https://atmospherejs.com/meteor/ejson)

benjick commented 8 years ago

Can't you just use JSON.stringify?

alexivanovvv commented 8 years ago

I tried it but didn't work for some reason, so just installed EJSON.

On Mon, Feb 15, 2016 at 8:24 PM, Max Malm < notifications@github.com > wrote: Can't you just use JSON.stringify ?

— Reply to this email directly or view it on GitHub .