lib/tg-bot.rb in tg-bot-0.0.4 vs lib/tg-bot.rb in tg-bot-0.0.5

- old
+ new

@@ -6,11 +6,11 @@ class Bot include Telegram::Reply attr_reader :user, :forward_from, :chat, :forward_from_chat, :message, :text - def initialize(params) + def initialize(params:, telegram_bot_token:) # User @user = Telegram::Params::From.new(params) @forward_from = Telegram::Params::ForwardFrom.new(params) # Chat @@ -20,14 +20,17 @@ # Message @message = Telegram::Params::Message.new(params) # Text @text = @message.text + + # Token + @telegram_bot_token = telegram_bot_token end class << self - def SetWebhook(url) - uri = URI("https://api.telegram.org/bot#{ENV['telegram_bot_token']}/setWebhook?url=#{url}") + def SetWebhook(url:, token:) + uri = URI("https://api.telegram.org/bot#{token}/setWebhook?url=#{url}") Net::HTTP.get(uri) end end end end \ No newline at end of file