telegram-bot

Ruby wrapper for Telegram's Bot API.

Installation

Add following line to your Gemfile:

gem 'telegram-bot', github: 'atipugin/telegram-bot'

And then execute:

$ bundle

Usage

First things first, you need to obtain a token for your bot. Then create your Telegram bot like this:

token = 'YOUR_TELEGRAM_BOT_API_TOKEN'

Telegram::Bot::Runner.run(token) do |bot|
  bot.listen do |message|
    case message.text
    when /^hello/
      bot.api.sendMessage(chat_id: message.chat.id, text: "Hello, #{message.from.username}")
    end
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request