Comments (8)
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.
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.
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.
I don't get any errors. I'm not storing my config anywhere - should I?
from chatterbot.
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.
@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.
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.
@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)
- 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.