class BotMessage
Attributes
audio[RW]
caption[RW]
channel_chat_created[RW]
chat[RW]
contact[RW]
date[RW]
delete_chat_photo[RW]
disable_notification[RW]
disable_web_page_preview[RW]
document[RW]
entities[RW]
forward_date[RW]
forward_from[RW]
from[RW]
group_chat_created[RW]
left_chat_member[RW]
location[RW]
message_id[RW]
migrate_from_chat_id[RW]
migrate_to_chat_id[RW]
new_chat_little[RW]
new_chat_member[RW]
new_chat_photo[RW]
parse_mode[RW]
photo[RW]
pinned_message[RW]
reply_markup[RW]
reply_to_message[RW]
reply_to_message_id[RW]
sticker[RW]
supergroup_chat_created[RW]
text[RW]
for message
venue[RW]
video[RW]
voice[RW]
Public Instance Methods
send()
click to toggle source
# File lib/telegram_bot_builder/bot_message.rb, line 41 def send method = 'sendMessage' params = { chat_id: chat.id, text: text, } if parse_mode == :markdown params[:parse_mode] = 'Markdown' elsif parse_mode == :html params[:parse_mode] = 'HTML' end if disable_web_page_preview != nil params[:disable_web_page_preview] = disable_web_page_preview end if disable_notification != nil params[:disable_notification] = disable_notification end if reply_markup == :inline params[:reply_markup] = 'InlineKeyboardMarkup' elsif reply_markup == :reply params[:reply_markup] = 'ReplyKeyboardMarkup' elsif reply_markup == :reply_hide params[:reply_markup] = 'ReplyKeyboardHide' elsif reply_markup == :force_reply params[:reply_markup] = 'ForceReply' end uri = URI.parse(BotAPI::URLBUIDER.build(method)) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data(params) result = http.request(request) if result.code == "200" return BotAPI.parse(method, result.body) end end