module TelegramBot::RequestMethods
Constants
- CHAT_ACTIONS
- METHODS
Public Instance Methods
forward_message(msg, to, from = nil)
click to toggle source
# File lib/telegram_bot/request_methods.rb, line 35 def forward_message(msg, to, from = nil) from_chat = from.nil? ? msg.chat : Chat.from(from) params = { chat_id: Chat.from(chat).id, from_chat_id: from_chat.id, message_id: Message.from(msg).id } Message.from(request(:forward_message, params)) end
get_me()
click to toggle source
# File lib/telegram_bot/request_methods.rb, line 15 def get_me User.from(request(:get_me, {})) end
get_updates(offset: nil, limit: nil, timeout: nil)
click to toggle source
# File lib/telegram_bot/request_methods.rb, line 3 def get_updates(offset: nil, limit: nil, timeout: nil) params = { offset: offset, limit: limit, timouet: timeout }.reject {|_,v| v.nil?} request(:get_updates, params).map do |update| Update.from(update) end end
send_chat_action(chat, action)
click to toggle source
# File lib/telegram_bot/request_methods.rb, line 59 def send_chat_action(chat, action) unless CHAT_ACTIONS.include?(action.intern) warn "invalid chat action #{action}, available actions are" + " #{CHAT_ACTIONS.join(', ')}." action = CHAT_ACTIONS.first end params = { chat_id: Chat.from(chat).id, action: action.to_s } request(:send_chat_action, params) nil end
send_message(chat, text, disable_web_page_preview: nil, reply_to: nil, reply_markup: nil)
click to toggle source
# File lib/telegram_bot/request_methods.rb, line 19 def send_message(chat, text, disable_web_page_preview: nil, reply_to: nil, reply_markup: nil) reply_to = Message.from(reply_to) params = { chat_id: Chat.from(chat).id, text: text, disable_web_page_preview: disable_web_page_preview, reply_to_message_id: reply_to && reply_to.id, reply_markup: reply_markup ? reply_markup.to_json : nil }.reject {|_,v| v.nil?} Message.from(request(:send_message, params)) end
Private Instance Methods
todo(*args, &block)
click to toggle source
# File lib/telegram_bot/request_methods.rb, line 92 def todo(*args, &block) defn_at = self.method(__callee__).source_location warn "#{defn_at[0]}:<#{__callee__}>: not implemented" end