Sha256: ff83db738ccafb263c99397e12c4311fef3166951f86ef9bbaeb0e6c63186063
Contents?: true
Size: 895 Bytes
Versions: 1
Compression:
Stored size: 895 Bytes
Contents
require 'net/http' require 'telegram/replies' require 'telegram/params' module Telegram class Bot include Telegram::Reply attr_reader :user, :forward_from, :chat, :forward_from_chat, :message, :text def initialize(params:, telegram_bot_token:) # 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) # Text @text = @message.text # Token @telegram_bot_token = telegram_bot_token end class << self def SetWebhook(url:, token:) uri = URI("https://api.telegram.org/bot#{token}/setWebhook?url=#{url}") Net::HTTP.get(uri) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tg-bot-0.0.5 | lib/tg-bot.rb |