mispy-archive / twitter_ebooks

Better twitterbots for all your friends~
MIT License
972 stars 140 forks source link

Possibly PEBCAK issue #32

Closed mattstratton closed 9 years ago

mattstratton commented 9 years ago

I have generated the model, and added in all the auth stuff in my generated bot. But when I run ruby run.rb it all fires up just fine, but nothing ever happens. I'm fairly certain it doesn't actually connect to twitter, either, as I replace the keys, secrets, and tokens with gibberish (or even completely comment them out) and it still fires up without error.

I'm sure I'm missing something here. My steps:

1) Create app under the twitter account that will be my bot (let's call it 'mattbot' - NOTE: That is NOT the real account name) 2) Ensure that the app has r/w/dm rights. Generate oauth token for mattbot under that app 3) Run ebooks new mattbot to create the new repo 4) Edit the bots.rb in the mattbot repo to put in all the keys, secrets, tokens, et al 5) Uncomment out a few handlers in bots.rb:

  bot.on_mention do |tweet, meta|
    # Reply to a mention
    bot.reply(tweet, meta[:reply_prefix] + "oh hullo")
  end

  bot.on_timeline do |tweet, meta|
    # Reply to a tweet in the bot's timeline
    bot.reply(tweet, meta[:reply_prefix] + "nice tweet")
  end
  1. Within the mattbot repo, enter ruby run.rb
 ~/src/mattbot/ [master] ruby run.rb
Faraday::Builder is now Faraday::RackBuilder.
@mattbot: starting stream for petechesbot
@mattbot: Online!
  1. Attempt to reply to mattbot on twitter
  2. Nothing happens
  3. Edit bots.rb and comment out all lines with secret keys, etc
  4. Attempt to ruby run.rb again
  5. Same result

What am I missing?

_For the record, I tried this all by pushing it to heroku first, with much the same result. I switched back to running ruby run.rb locally for efficiency of troubleshooting_

rabbitmaiden commented 9 years ago

Did you verify your bot's account email? Twitter will not let API activity happen until you do so.

mattstratton commented 9 years ago

I will double check. It does work from Tweetbot so I assume API activity is functional. 

mattstratton commented 9 years ago

OK, email address was verified. I determined the same behavior if I basically clone down https://github.com/mispy/ebooks_example and replace it with my own data.

The bit I'm wondering has to do with the Oauth token - on the twitter apps page, this is now referred to as "Your Access Token" - I presume that is the same token referred to?

mattstratton commented 9 years ago

OK. It is working after all. That is, I can see the bot generating tweets (well, it did it twice). It doesn't seem to interact with @ replies, but that's a problem for another day.