【问题标题】:how to add post reactions telegram bot node.js如何添加后反应电报机器人node.js
【发布时间】:2018-12-27 04:25:58
【问题描述】:

你能帮帮我吗? 我不知道如何在我的电报机器人中使用 Node.JS 编写的任何消息添加喜欢\不喜欢的反应

问题是我不知道如何更改 query.message.message_id 因为 message_id 每次在其他聊天中都不同。

如何计算喜欢\不喜欢我也不知道。

有人可以向我解释如何做好吗?

谢谢

bot.on('callback_query', query => {
const chatID = query.message.chat.id

switch (query.data) {
    case 'good':
        console.log(query)

        User.find({}).then(users => {
            for(var i=0; i < users.length; i++){
                var pars = users[i]
                bot.editMessageReplyMarkup({
                    inline_keyboard: [
                        [
                            {
                                text: '????1',
                                callback_data: 'good'
                            },
                            {
                                text: '????',
                                callback_data: 'bad'
                            }
                        ]
                    ]
                }, {chat_id: pars.telegramId, message_id: query.message.message_id}).catch(e => console.log(e))
            }
        })

        break
    case 'bad':

        break
}

})

【问题讨论】:

    标签: node.js bots telegram-bot


    【解决方案1】:

    在这里为您服务:?

    const helpKeyboard = [[{
      text: `back`,
      callback_data: `back3`
    }]]
    
    
    
    bot.on('callback_query', msg => {
      if (msg.data == `back3`) {
        bot.editMessageText(`?`, {
          parse_mode: 'Markdown',
          message_id: msg.message.message_id,
          chat_id: msg.message.chat.id,
          reply_markup: {
            inline_keyboard: [[{
              text: `?`,
              callback_data: `?`
            }]]
          }
        })
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2016-09-17
      • 2017-08-18
      • 2023-01-20
      • 1970-01-01
      • 2016-11-11
      • 2020-03-22
      • 2021-03-24
      • 2021-09-12
      • 1970-01-01
      相关资源
      最近更新 更多