sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.58k stars 1.31k forks source link

Ratelimit error not being thrown #936

Closed sqlninja closed 1 year ago

sqlninja commented 6 years ago

In the last few days I am no longer able to send DMs. Just getting this error:

TypeError: no implicit conversion of Symbol into Integer
/Users/johnhenderson/.rvm/gems/ruby-2.5.0/bundler/gems/twitter-844818cad07c/lib/twitter/rest/direct_messages.rb:194:in '[]'
/Users/johnhenderson/.rvm/gems/ruby-2.5.0/bundler/gems/twitter-844818cad07c/lib/twitter/rest/direct_messages.rb:194:in 'create_direct_message_event'

This line is breaking now because the response is empty

I know definitively this was working on 2018-07-20, because I was able to database the DM id from previous sends...

sqlninja commented 6 years ago

I think may have been something going on with Twitter, as messages are going through again, so disregarding for now...

sqlninja commented 6 years ago

Turns out to be a similar issue as #934 I have added more commentary on that issue

sqlninja commented 6 years ago

I'm poking this issue because it appears that the empty response could be related to a rate limit (we saw that we were limited via the web app), but the responses coming back from the gem were just empty, thus not throwing the TooManyRequests error.

sqlninja commented 6 years ago

So got feedback from Twitter about the empty response coming back:

@StackedSports - It sounds like you’re hitting the DM limit, either the: Technical limit: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event Or the daily limit: https://help.twitter.com/en/rules-and-policies/twitter-limits Whichever comes first.

Which leads to me why isn't the TooManyRequests error being thrown by the gem?