module Telegram::Reply

Public Class Methods

SEND(url:, params:) click to toggle source
# File lib/telegram/reply/request.rb, line 6
def self.SEND(url:, params:)
  uri = URI(url)
  uri.query = URI.encode_www_form(params)
  ::Net::HTTP.get_response(uri)
end

Public Instance Methods

forward_message(chat_id: @chat.id, from_chat_id:, message_id:, **options) click to toggle source
# File lib/telegram/reply/forward_message.rb, line 7
def forward_message(chat_id: @chat.id, from_chat_id:, message_id:, **options)
  url     = Telegram::URL.new(@telegram_bot_token).forward_message
  params  = {
              chat_id: chat_id,
              from_chat_id: from_chat_id,
              message_id: message_id,
              disable_notification: options[:disable_notification].presence
            }
  
  Telegram::Reply::SEND(url: url, params: params)
end
send_message(chat_id: @chat.id, text:, parse_mode: 'html', **options) click to toggle source
# File lib/telegram/reply/send_message.rb, line 7
def send_message(chat_id: @chat.id, text:, parse_mode: 'html', **options)
  url     = Telegram::URL.new(@telegram_bot_token).send_message
  params  = {
              chat_id: chat_id,
              text: text,
              parse_mode: parse_mode,
              disable_web_page_preview: options[:disable_web_page_preview].presence,
              disable_notification: options[:disable_notification].presence,
              reply_to_message_id: options[:reply_to_message_id].presence,
              reply_markup: options[:reply_markup].presence
            }
  
  Telegram::Reply::SEND(url: url, params: params)
end
send_photo(chat_id: @chat.id, photo:, **options) click to toggle source
# File lib/telegram/reply/send_photo.rb, line 7
def send_photo(chat_id: @chat.id, photo:, **options)
  url     = Telegram::URL.new(@telegram_bot_token).send_photo
  params  = {
              chat_id: chat_id,
              photo: photo,
              caption: options[:caption].presence,
              parse_mode: options[:parse_mode].presence,
              disable_notification: options[:disable_notification].presence,
              reply_to_message_id: options[:reply_to_message_id].presence,
              reply_markup: options[:reply_markup].presence
            }
  
  Telegram::Reply::SEND(url: url, params: params)
end