BESPOKE CHANGES FOR ROBINBOT

This commit is contained in:
Joel McCoy
2015-01-19 12:50:26 -05:00
parent f0743ea887
commit 99edc86414
6 changed files with 22 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
source 'http://rubygems.org'
ruby '2.1.3'
gem 'twitter_ebooks', '3.0.6'
gem 'twitter_ebooks', '3.0.7'
gem 'dotenv'

View File

@@ -10,7 +10,6 @@ GEM
dotenv (1.0.2)
engtagger (0.2.0)
equalizer (0.0.9)
eventmachine (1.0.4)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
fast-stemmer (1.0.2)
@@ -24,7 +23,7 @@ GEM
http (0.6.3)
http_parser.rb (~> 0.6.0)
http_parser.rb (0.6.0)
json (1.8.1)
json (1.8.2)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (0.8.2)
@@ -52,9 +51,8 @@ GEM
memoizable (~> 0.4.0)
naught (~> 1.0)
simple_oauth (~> 0.3.0)
twitter_ebooks (3.0.6)
twitter_ebooks (3.0.7)
engtagger
eventmachine (~> 1.0.3)
fast-stemmer
gingerice
highscore
@@ -72,4 +70,4 @@ PLATFORMS
DEPENDENCIES
dotenv
twitter_ebooks (= 3.0.6)
twitter_ebooks (= 3.0.7)

View File

@@ -1,18 +1,17 @@
# boodoo_ebooks
# mu_ebooks
A turn-key, beginner-friendly, ready-to-deploy implementation of a traditional \_ebooks bot using Mispy's [twitter_ebooks](https://github.com/mispy/twitter_ebooks) library.
I'M SORRY IT'S COME TO THIS
## Usage
Create your [Twitter app](https://apps.twitter.com) and generate access tokens with *Read, Write and Direct Messages* privileges.
Click this:
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/BooDoo/ebooks_example/tree/robinbot)
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/BooDoo/ebooks_example/tree/deploy)
Put your BOT_NAME, SOURCE_USERNAME, and API secrets into Heroku Config Vars using the web dashboard.
Put your API secrets into Heroku Config Vars using the web dashboard.
Scale your app to 1 dyno using the Heroku web dashboard.
Bob's your uncle.
You're ready to go.
## Default Behavior
Tweets once on startup.
@@ -25,11 +24,3 @@ Favorites tweets that it likes.
- **BANNED_TERMS**: words or phrases to obscure/censor
- DM commands (tweet, follow, unfollow, block, mention...)
- Follower parity (periodically compares following/followers and follows/unfollows as needed)
- Want something else? Create an [issue](https://github.com/BooDoo/ebooks_example/issues). No promises.
## TODO:
- Support full archive (via CSV uploaded elsewhere)
# DISCLAIMER:
I'm making this because I wrote a two-part tutorial for an older version of the twitter_ebooks gem and my mentions turned into a tech support hellscape for months.
Please [create issues](https://github.com/BooDoo/ebooks_example/issues) if you have trouble. 🙏 Please do not tweet at me. 🙏

View File

@@ -1,7 +1,7 @@
{
"name": "BooDooBooks",
"name": "robinbot",
"description": "Turn-key _ebooks deployment using twitter_ebooks",
"repository": "https://github.com/BooDoo/ebooks_example/tree/deploy",
"repository": "https://github.com/BooDoo/ebooks_example/tree/robinbot",
"keywords": [
"twitter",
"bot",
@@ -12,8 +12,8 @@
],
"env": {
"LANG": "en_US.UTF-8",
"BOT_NAME": "",
"SOURCE_USERNAME": "",
"BOT_NAME": "mu_ebooks",
"SOURCE_USERNAME": "calaminii",
"CONSUMER_KEY": "",
"CONSUMER_SECRET": "",
"ACCESS_TOKEN": "",

16
bots.rb
View File

@@ -63,11 +63,10 @@ class BoodooBot
@attempts = 0
@followers = []
@following = []
@archive_path = "corpus/#{@original}.json"
@model_path = "model/#{@original}.model"
@archive_path = "corpus/robin.csv"
@model_path = "model/robin.model"
if can_run?
get_archive!
make_model!
else
missing_fields.each {|missing|
@@ -101,12 +100,6 @@ class BoodooBot
scheduler.interval @update_follows_interval do
follow_parity
end
scheduler.interval @refresh_model_interval do
log "Refreshing archive/model..."
get_archive!
make_model!
end
end
def on_message(dm)
@@ -229,8 +222,11 @@ class BoodooBot
def load_model!
return if @model
@model_path ||= "model/#{original}.model"
@corpus_path ||= "corpus/robin.csv"
@model_path ||= "model/robin.model"
log "Consuming corpus #{@corpus_path}"
Ebooks::Model.consume(@corpus_path).save(@model_path)
log "Loading model #{model_path}"
@model = Ebooks::Model.load(model_path)
end

View File

@@ -1,5 +1,5 @@
BOT_NAME=
SOURCE_USERNAME=
BOT_NAME=mu_ebooks
SOURCE_USERNAME=calaminii
CONSUMER_KEY=
CONSUMER_SECRET=
ACCESS_TOKEN=