module Dialog::Wrappers
Public Class Methods
apiGetFilePath(file_id)
click to toggle source
# File lib/telegram/wrappers.rb, line 17 def apiGetFilePath(file_id) c = Dialog::BotApi.socks5_connection url="/bot#{Dialog.config.secure.token}/getFile?file_id=#{file_id}" response = c.get url response_json = JSON.parse response.body file_path=response_json["result"]["file_path"] return file_path end
downloadFile(args)
click to toggle source
# File lib/telegram/wrappers.rb, line 27 def downloadFile(args) file = args[:mmsg][:fqndata][:f][:file] c = Dialog::BotApi.socks5_connection url_file="/file/bot#{Dialog.config.secure.token}/#{file[:path]}" response = c.get url_file file.has_key?(:name) ? name = file[:name] : name = file[:path].split('/')[1] File.open("#{Dialog.config.path.dialogTmpfiles}/#{name}", 'wb') { |fp| fp.write(response.body) } return name end