Coder Social home page Coder Social logo

Comments (4)

davidcelis avatar davidcelis commented on June 27, 2024

Oh! I should mention that if I do heroku run irb, load my bot, and call bot.tweet(bot.model.make_statement) manually, it'll post a tweet like usual.

from twitter_ebooks.

negatendo avatar negatendo commented on June 27, 2024

This would cause the bot to have a chance of tweeting once on startup. If you want the bot to tweet regularly you'll want a separate section in the behaviors to define that schedule. See the ebooks example: https://github.com/mispy/ebooks_example

On Jan 18, 2015, at 10:57 PM, David Celis [email protected] wrote:

Hey; I'm on the latest version of twitter_ebooks. I have my bot running on Heroku, and it doesn't seem to be tweeting. My on_startup usually looks like this:

def on_startup

90% chance to make a tweet in any hour

if rand > 0.9
tweet(model.make_statement)
end
end
My bot hasn't written its own tweet in almost two weeks. This started right about the time I upgraded to the latest major version of twitter_ebooks. To debug, I removed the conditional statement. So, after deploys, my bot should be immediately tweeting. But it isn't. A quick call of heroku logs also shows no errors. Only that my bot is streaming tweets. This makes me think there might be something up with the on_startup method... Any thoughts?


Reply to this email directly or view it on GitHub.

from twitter_ebooks.

davidcelis avatar davidcelis commented on June 27, 2024

Sorry! That was a mistake in my example... I should have just copied and pasted:

def on_startup
  # 10% chance to tweet something in any 60 minute interval
  scheduler.every '1h' do
    if rand > 0.90
      tweet(model.make_statement)
    end
  end
end

For my test I removed both the scheduler and if conditional, expecting it to make a tweet on startup, but it doesn't. So, to clarify... The following does not produce a tweet on startup like would be expected:

def on_startup
  tweet(model.make_statement)
end

from twitter_ebooks.

davidcelis avatar davidcelis commented on June 27, 2024

I found the issue. on_startup is fired by calling prepare on the bot, which I wasn't doing.

from twitter_ebooks.

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.