Method: TelegramAPI#sendDocument

Defined in:
lib/telegramAPI.rb

#sendDocument(to, path, options = {}) ⇒ Message

Send a general document (file, image, audio)

Parameters:

  • path (String)

    The path of the file to send

  • to (Integer)

    chat_id to which send the message. Usually message.chat.id

  • options (Hash<String, String>) (defaults to: {})

    Optional settings

Returns:

  • (Message)

    Message with the Photo sent



99
100
101
# File 'lib/telegramAPI.rb', line 99

def sendDocument to, path, options={}
  Message.new JSON.parse(RestClient.post(@@core+@token+"/sendDocument", {:document=>File.new(path,'rb'), :chat_id=>to.to_s}.merge(parse_hash(options))).body)["result"]
end