Sha256: eff5768626a3c93684ab1ebaa55f0195b56c8d280ac51421eed1be26a48ce695
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 Bytes
Contents
require 'net/http' require 'telegram_bot/replies' require 'telegram_bot/params' module Telegram class Bot include Telegram::Reply attr_reader :user, :forward_from, :chat, :forward_from_chat, :message def initialize(params) # User @user = Telegram::Params::From.new(params) @forward_from = Telegram::Params::ForwardFrom.new(params) # Chat @chat = Telegram::Params::Chat.new(params) @forward_from_chat = Telegram::Params::ForwardChat.new(params) # Message @message = Telegram::Params::Message.new(params) end class << self def setWebhook(url) uri = URI("https://api.telegram.org/bot#{ENV['telegram_bot_token']}/setWebhook?url=#{url}") Net::HTTP.get(uri) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tg-bot-0.0.2 | lib/telegram_bot.rb |
tg-bot-0.0.1 | lib/telegram_bot.rb |