# tg-bot > A simple Telegram Bot gem for Ruby on Rails # Usage 1. Setup your ENV - Use bash to set environment variable ```bash export telegram_bot_token='Your bot token' ``` - Use [figaro](https://github.com/laserlemon/figaro) gem to set environment variable ```yaml telegram_bot_token: Your bot token ``` 2. Add this gem to your `Gemfile` ```ruby gem 'tg-bot', '~> 0.0.2' ``` 3. Setup your Controller > e.g. my webhook is https://xxxxx/telegram ```ruby def telegram telegram = Telegram::Bot.new(params) end ``` 4. It has 3 ways to reply message ```ruby def telegram telegram = Telegram::Bot.new(params) # 1. reply text message telegram.send_message(text: 'enter what you want to reply') # 2. reply forward_message telegram.forward_message( chat_id: 'The chatroom you want to reply', from_chat_id: 'The chatroom you want to forward', message_id: 'The message you want to forward') # 3. reply photo by file or string telegram.send_photo(photo: "https://picsum.photos/200/300/?random=#{Random.new_seed}") end ``` # Methods ## setWebhook ```ruby def xxx Telegram::Bot.SetWebhook(url) end ```