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 ||
case .text
when /^hello/
bot.api.sendMessage(chat_id: .chat.id, text: "Hello, #{.from.username}")
end
end
end
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request