Comments (5)
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.
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.
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)
/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.
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.
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)
- How do i even run this? The wiki did not help. I opened command prompt type in Ruby chatterbot-register.rb and it said its not a command HOT 1
- deprecation warning HOT 4
- Running on Heroku HOT 5
- Handle config writing if disk is full
- 401 when streaming. Oauth_timestamp? HOT 9
- chatterbot-register no such file or directory HOT 6
- chatterbot-register failures HOT 14
- chatterbot-register access_token and secret swapped. HOT 1
- replies block is not working HOT 4
- Attaching Pic to Tweet/Direct Message HOT 5
- Breaking out of nested direct_messages block HOT 3
- Search still showing retweets HOT 3
- Retween with comment HOT 2
- Twitter Automated Experiences HOT 1
- Place / Location for tweet or reply? HOT 1
- New to this, any ideas how to use the docker? HOT 4
- only_interact_with_followers not working HOT 1
- Reply Tweets must start with an @ mention HOT 1
- only_interact_with_following ? HOT 4
- Documentation fix HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatterbot.