Git Product home page Git Product logo

Comments (5)

muffinista avatar muffinista commented on June 29, 2024

Hey, I'd probably accept a pull request with that, but I'm not sure how to go about it and keep things clean. That said, since you can access the client instance directly, it should possible to do media tweets now with something like this:

#
# ... assorted chatterbot code ...
#
replies do |tweet|
  client.update_with_media "hello!", File.open(path_to_image), in_reply_to_status_id:tweet.id
end

That's untested, but it or something like it should work.

from chatterbot.

sdh100shaun avatar sdh100shaun commented on June 29, 2024

thanks, I have for the time being gone down the access the client directly route - will fork and thing about a clean way to go about the addition of media

from chatterbot.

zackphilipps avatar zackphilipps commented on June 29, 2024

Hey guys! I tried accessing the client directly and received the following error even though my app has read and write permissions... Any ideas?

/Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/response/raise_error.rb:15:in 'on_complete': Read-only application cannot POST. (Twitter::Error::Unauthorized)

    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/response.rb:9:in `block in call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/response.rb:57:in `on_complete'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/response.rb:8:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/request/multipart.rb:14:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/request/multipart_with_file.rb:19:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/request.rb:33:in `perform'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/utils.rb:50:in `perform_request'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/utils.rb:72:in `perform_request_with_object'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/utils.rb:64:in `perform_post_with_object'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/rest/tweets.rb:233:in `update_with_media'
    from ./boop_almbot.rb:112:in `block in <main>'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/handler.rb:26:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/handler.rb:26:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/streaming.rb:29:in `handle_streaming_object'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/bot.rb:90:in `block in stream!'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/client.rb:116:in `block in request'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/response.rb:27:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/response.rb:27:in `block in on_body'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/response.rb:25:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/response.rb:25:in `on_body'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/response.rb:16:in `<<'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/response.rb:16:in `<<'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/connection.rb:22:in `stream'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/client.rb:119:in `request'
    from /Library/Ruby/Gems/2.0.0/gems/twitter-5.16.0/lib/twitter/streaming/client.rb:37:in `filter'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/bot.rb:89:in `stream!'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/bot.rb:63:in `run_or_stream'
    from /Library/Ruby/Gems/2.0.0/gems/chatterbot-2.0.2/lib/chatterbot/bot.rb:49:in `block in initialize'

from chatterbot.

muffinista avatar muffinista commented on June 29, 2024

That probably means that when you registered with Twitter, you setup an application to be read-only. You'll need to update those settings with Twitter, and maybe re-authenticate.

from chatterbot.

zackphilipps avatar zackphilipps commented on June 29, 2024

Yeah I figured it out. It was initially set up as read/write but I had to escalate to DM privileges and re-authenticate anyway. Weird. Thanks for responding, and thanks for the tool!

from chatterbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.