Giter Site home page Giter Site logo

Comments (8)

muffinista avatar muffinista commented on July 18, 2024

Can I see your whole script?
On Sep 9, 2012 1:27 AM, "Amrit Ayalur" [email protected] wrote:

How do I make sure the bot doesn't reply to the same tweet every time?

The following loop replies to tweets it has already replied to each time
the script runs.

replies do |tweet|
reply "Hi #USER#, thanks for your interest.", tweetend


Reply to this email directly or view it on GitHubhttps://github.com//issues/8.

from chatterbot.

amrit avatar amrit commented on July 18, 2024

Sure thing!

#!/usr/bin/env ruby

require 'rubygems'
require 'chatterbot/dsl'

verbose


replies do |tweet|
  reply "Hi #USER#, thanks for your interest.", tweet
end

from chatterbot.

muffinista avatar muffinista commented on July 18, 2024

When you run this, do you get any errors? Also, are you using a database to store your config or is it in a YAML file?

from chatterbot.

amrit avatar amrit commented on July 18, 2024

I don't get any errors. I'm not storing my config anywhere - should I?

from chatterbot.

muffinista avatar muffinista commented on July 18, 2024

Yeah, I'm actually confused as to what is happening here. I just tested your code, and it runs fine with a proper config (see https://twitter.com/echoes_bot/status/247765604021465088 for the tweet). I would recommend that you run chatterbot-register and create a new bot from scratch, and see if that helps.

from chatterbot.

staringispolite avatar staringispolite commented on July 18, 2024

@muffinista I have this same problem. I assume it's because the bot's config isn't written to file or DB like you said above. How would I configure that? (Sorry if this is a standard Ruby thing - not new to programming, but new to Ruby)

EDIT: Got it working. In case anyone in the future is in my position, here's what worked.

  • Make a mysql database and user for your bot; give that bot user all privileges for that database (and only that database unless you're feeling lucky)
  • Save any edits to your bot.rb and bot.yml files in a temporary place and delete the originals.
  • Re-create the skeleton with ./bin/chatterbot-register -d <mysql URI here>
  • Re-auth and re-enter your bot data. You should see mysql info in the output.
  • Make sure your new .yml now has a line for :db_uri:. If not, add it.
  • Merge changes back to bot.rb
  • Remove or comment out the no_update line in bot.rb
  • Run it twice with debug on; in the bot's output, make sure the "check for replies since ___" number updates

You should see some output like "storing config to database -- you don't need local file anymore"

(Note that you'll still need the .yml file to tell it the db_uri, otherwise it'll prompt for API_KEY and such all over again)

from chatterbot.

muffinista avatar muffinista commented on July 18, 2024

Glad you got it working! I actually removed db support in the 2.0 version of chatterbot -- it was difficult to use and maintain.

from chatterbot.

staringispolite avatar staringispolite commented on July 18, 2024

@muffinista Neat! Does it persist to the YML file in 2.0? I'd actually prefer that IMHO, just couldn't see how to get that working.

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.