Распечатать & ldquo; доступный метод & rdquo; Telegram API Ruby в сообщении

0
задан mechnicov 4 March 2019 в 00:59
поделиться

1 ответ

bot.api.get_chat_members_count(chat_id: message.chat.id) возвращает хэш в формате {"ok"=>true, "result"=>8}

. Для этого вам нужно использовать ключ:

Telegram::Bot::Client.run(token) do |bot|
  bot.listen do |message|
    if message.text == '/start'
      count = bot.api.get_chat_members_count(chat_id: message.chat.id)['result']
      bot.api.send_message(chat_id: message.chat.id, text: "Result: #{count}")
    end
  end
end
0
ответ дан mechnicov 4 March 2019 в 00:59
поделиться
Другие вопросы по тегам:

Похожие вопросы: