question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m tryng to use force_reply without success… any suggestion?

if (messaggio == '/love') {
    var opts = {
        ReplyKeyboardHide: {},
        reply_to_message_id: msg.message_id,

        reply_markup: JSON.stringify({
            "keyboard": [["Ti amo alla follia"], ["Mi spiace ma non fai per me"]], 
            "one_time_keyboard": true,
            "force_reply": true
        })

    };

bot.sendMessage(chatId, ‘Mi ami?’, opts); }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
yagopcommented, Jan 27, 2016

To be honest I haven’t tested force_reply and if I did I can’t remember. According with Telegram docs sendMessage can receive an optional reply_markup with a JSON serialized ReplyKeyboardMarkup OR ReplyKeyboardHide OR a ForceReply.

According with that, ReplyKeyboardHide and ForceReply doesn’t have to be JSON serialized. So I would do something like:

reply_markup: {
  "force_reply": true
};

But that makes no sense if you want to send a ReplyKeyboardMarkup too which is the common scenario so I would come with:

reply_markup: JSON.stringify({
  "keyboard": [["Ti amo alla follia"], ["Mi spiace ma non fai per me"]], 
  "one_time_keyboard": true,
  "force_reply": true
});

But you said isn’t working so, no idea.

5reactions
yagopcommented, Jan 30, 2016

Regarding with force_reply is working as expected:

var opts = {
  reply_markup: JSON.stringify(
    {
      force_reply: true,
      keyboard: [['Over 18'],['Under 18']]
    }
  )};
bot.sendMessage(USER, 'How old are you?', opts)

I added the bot.onReplyToMessage function which makes much easier to handle responses. See an example here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replyforce: B2B Data and Email Outreach Platform
Sales teams use Replyforce to find new prospects, automate personal email outreach and increase lead volumes.
Read more >
Force Reply All instead of Reply - Microsoft Community
Hi,. I wonder if I can take away the "Reply" button and only leave the "Reply All" button, or at least move the...
Read more >
[SOLVED] Force Reply All - MS Exchange
There's no way to force a reply all. A user can simply create a new email and forward it as an attachment. Forward...
Read more >
Using force reply/creating step by step flows · Issue #11 - GitHub
I can't seem to get forceReply to work :/ bot.command('CommandName', (msg, reply) => { const { id } = msg.user; reply .keyboard([['Option1' ...
Read more >
ForceReply — Pyrogram Documentation
Object used to force clients to show a reply interface. Upon receiving a message with this object, Telegram clients will display a reply...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found