Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument Error #1

Open
unn4m3d opened this issue Jul 2, 2015 · 1 comment
Open

Argument Error #1

unn4m3d opened this issue Jul 2, 2015 · 1 comment

Comments

@unn4m3d
Copy link

unn4m3d commented Jul 2, 2015

Log

[INFO] Uploading /home/metal/.bot13_telegram/tmp/159126536
/var/lib/gems/2.1.0/gems/ruby-multipart-post-0.4.0/lib/stream.rb:17:in `read': wrong number of arguments (2 for 1) (ArgumentError)
    from /usr/lib/ruby/2.1.0/net/http/generic_request.rb:202:in `copy_stream'
    from /usr/lib/ruby/2.1.0/net/http/generic_request.rb:202:in `send_request_with_body_stream'
    from /usr/lib/ruby/2.1.0/net/http/generic_request.rb:132:in `exec'
    from /usr/lib/ruby/2.1.0/net/http.rb:1406:in `block in transport_request'
    from /usr/lib/ruby/2.1.0/net/http.rb:1405:in `catch'
    from /usr/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'
    from /usr/lib/ruby/2.1.0/net/http.rb:1378:in `request'
    from /var/lib/gems/2.1.0/gems/ruby-multipart-post-0.4.0/lib/multi_part_post.rb:44:in `block in submit'
    from /usr/lib/ruby/2.1.0/net/http.rb:853:in `start'
    from /var/lib/gems/2.1.0/gems/ruby-multipart-post-0.4.0/lib/multi_part_post.rb:44:in `submit'
    from /home/metal/.bot13_telegram/tgapi.rb:150:in `sendPhoto'
    from (eval):89:in `block in loadfile'
    from /home/metal/.bot13_telegram/api.rb:170:in `call'
    from /home/metal/.bot13_telegram/api.rb:170:in `execute'
    from ./core.rb:147:in `msgcb'
    from ./core.rb:205:in `block in <main>'
    from /home/metal/.bot13_telegram/tgapi.rb:78:in `call'
    from /home/metal/.bot13_telegram/tgapi.rb:78:in `call'
    from /home/metal/.bot13_telegram/tgapi.rb:165:in `block (2 levels) in update'
    from /home/metal/.bot13_telegram/tgapi.rb:161:in `each'
    from /home/metal/.bot13_telegram/tgapi.rb:161:in `block in update'
    from /home/metal/.bot13_telegram/tgapi.rb:160:in `each'
    from /home/metal/.bot13_telegram/tgapi.rb:160:in `update'
    from /home/metal/.bot13_telegram/tgapi.rb:103:in `main'
    from /home/metal/.bot13_telegram/tgapi.rb:113:in `block in start'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/timer.rb:97:in `call'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/timer.rb:97:in `fire'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/events.rb:43:in `fire'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/events.rb:85:in `block in fire'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/events.rb:84:in `reverse_each'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/events.rb:84:in `fire'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/group.rb:80:in `fire'
    from /var/lib/gems/2.1.0/gems/timers-4.0.1/lib/timers/group.rb:64:in `wait'
    from ./core.rb:229:in `block in <main>'
    from ./core.rb:229:in `loop'
    from ./core.rb:229:in `<main>'

Code :

def sendPhoto(chat_id,file,caption=nil,rtmi=nil,rmu=nil)
            sendChatAction(chat_id,"upload_photo")
            params = {
                "chat_id"=>chat_id.to_s,
                "photo"=>FileUploadIO.new(file,"image/jpeg")
            }
            puts "[INFO] Uploading #{file}"
            p = MultiPart::Post.new(params)
            p.submit("https://api.telegram.org/bot#{@token}/sendPhoto")
        end
@bentimms
Copy link

bentimms commented Jul 3, 2015

From what I can see, this is an incompatible with Ruby 2 and above. I have the same issue and am looking into how to resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants