Skip to content

Commit fd038b9

Browse files
committed
Lo robot
1 parent 008294d commit fd038b9

File tree

6 files changed

+448
-0
lines changed

6 files changed

+448
-0
lines changed

Gemfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
source "http://rubygems.org"
2+
3+
ruby "2.0.0"
4+
5+
gem "mongo", "~> 1.9.2"
6+
gem "bson_ext", "~> 1.9.2"
7+
gem "cinch", "~> 2.0.12"
8+
gem "cinch-identify", "~> 1.5.1"
9+
gem "cinch-url-scraper", "~> 1.1.0"
10+
gem "cinch-urbandict", "~> 1.0.3"
11+
gem "cinch-wikipedia", "~> 1.0.3"
12+
gem "cleverbot", "~> 0.2.0"
13+
gem "simple-rss", "~> 1.3.1"

Gemfile.lock

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
bson (1.9.2)
5+
bson_ext (1.9.2)
6+
bson (~> 1.9.2)
7+
cinch (2.0.12)
8+
cinch-cooldown (1.1.5)
9+
cinch (~> 2)
10+
time-lord (~> 1.0, >= 1.0.1)
11+
cinch-identify (1.5.1)
12+
cinch (~> 2.0)
13+
cinch-toolbox (1.1.4)
14+
nokogiri (~> 1.6.0)
15+
cinch-urbandict (1.0.4)
16+
cinch (~> 2)
17+
cinch-cooldown (~> 1.1, >= 1.1.1)
18+
cinch-toolbox (~> 1.1)
19+
cinch-url-scraper (1.1.0)
20+
cinch (~> 2)
21+
mechanize (~> 2)
22+
cinch-wikipedia (1.0.4)
23+
cinch (~> 2)
24+
cinch-cooldown (~> 1.1, >= 1.1.1)
25+
cinch-toolbox (~> 1.1)
26+
cleverbot (0.2.0)
27+
httparty (>= 0.8.1, < 1.0)
28+
domain_name (0.5.22)
29+
unf (>= 0.0.5, < 1.0.0)
30+
http-cookie (1.0.2)
31+
domain_name (~> 0.5)
32+
httparty (0.13.1)
33+
json (~> 1.8)
34+
multi_xml (>= 0.5.2)
35+
json (1.8.1)
36+
mechanize (2.7.3)
37+
domain_name (~> 0.5, >= 0.5.1)
38+
http-cookie (~> 1.0)
39+
mime-types (~> 2.0)
40+
net-http-digest_auth (~> 1.1, >= 1.1.1)
41+
net-http-persistent (~> 2.5, >= 2.5.2)
42+
nokogiri (~> 1.4)
43+
ntlm-http (~> 0.1, >= 0.1.1)
44+
webrobots (>= 0.0.9, < 0.2)
45+
mime-types (2.4.3)
46+
mini_portile (0.6.0)
47+
mongo (1.9.2)
48+
bson (~> 1.9.2)
49+
multi_xml (0.5.5)
50+
net-http-digest_auth (1.4)
51+
net-http-persistent (2.9.4)
52+
nokogiri (1.6.3.1)
53+
mini_portile (= 0.6.0)
54+
ntlm-http (0.1.1)
55+
simple-rss (1.3.1)
56+
time-lord (1.0.1)
57+
unf (0.1.4)
58+
unf_ext
59+
unf_ext (0.0.6)
60+
webrobots (0.1.1)
61+
62+
PLATFORMS
63+
ruby
64+
65+
DEPENDENCIES
66+
bson_ext (~> 1.9.2)
67+
cinch (~> 2.0.12)
68+
cinch-identify (~> 1.5.1)
69+
cinch-urbandict (~> 1.0.3)
70+
cinch-url-scraper (~> 1.1.0)
71+
cinch-wikipedia (~> 1.0.3)
72+
cleverbot (~> 0.2.0)
73+
mongo (~> 1.9.2)
74+
simple-rss (~> 1.3.1)

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bluebot: bundle exec ruby bluebot.rb

README.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
Bluebot
2+
=======
3+
4+
**An IRC bot that runs on Heroku.**
5+
6+
7+
Bluebot is written in Ruby using the [Cinch IRC framework](https://github.com/cinchrb). You can easily customize it by using many existing [Cinch plugins](https://rubygems.org/search?utf8=%E2%9C%93&query=cinch) or by writing your own.
8+
9+
It requires a single Dyno and uses the free [MongoHQ](https://addons.heroku.com/mongohq) add-on as its persistence backend, which means you can essentially run Bluebot on Heroku for free, forever.
10+
11+
12+
Features
13+
--------
14+
15+
- URL title scraping.
16+
- Karma system.
17+
- Quotes manager.
18+
- Ability to respond as [Cleverbot](http://www.cleverbot.com/).
19+
- Wikipedia, Urban Dictionary and LMGTFY plugins.
20+
21+
22+
Supported commands
23+
------------------
24+
25+
### Karma system ###
26+
27+
* `!karma` prints your current karma.
28+
* `!karma <foo>` prints the current karma for `<foo>`.
29+
* `<foo>++` increments karma for `<foo>`.
30+
* `<foo>--` decrements karma for `<foo>`.
31+
32+
### Quotes manager ###
33+
34+
* `!addquote <quote>` records a new quote.
35+
* `!quote` prints a random quote.
36+
* `!quote <number>` prints quote with index `<number>`.
37+
* `!lastquote` prints the last quote recorded.
38+
* `!searchquote <keywords>` prints the quotes matching `<keywords>`.
39+
40+
### Respond as Cleverbot ###
41+
42+
Talk to the bot by prefixing your messages with the bot's nickname and it shall respond as Cleverbot.
43+
44+
Example:
45+
46+
```
47+
<Louie> Bluebot: What's the Answer to the Ultimate Question of Life, the Universe and Everything?
48+
<Bluebot> Louie: 42.
49+
```
50+
51+
### Wikipedia ###
52+
53+
* `!wiki <query>` searches Wikipedia for `<wiki>`.
54+
55+
### Urban Dictionary ###
56+
57+
* `!ud <query>` searches Urban Dictionary for `<query>`.
58+
59+
### LMGTFY ###
60+
61+
* `!google <query>` generates a Let Me Google That For You search for `<query>`.
62+
63+
64+
Deployment instructions
65+
-----------------------
66+
67+
1. Set up a new [Heroku](http://heroku.com/) app and add the free [MongoHQ](https://addons.heroku.com/mongohq) Sandbox add-on.
68+
69+
```
70+
cd Bluebot
71+
heroku create
72+
heroku addons:add mongohq:sandbox
73+
```
74+
75+
2. Tell Bluebot where to connect, what nickname to use, and optionally the required password to identify against the network's NickServ service.
76+
77+
```
78+
heroku config:set BLUEBOT_SERVER=irc.myserver.com
79+
heroku config:set BLUEBOT_CHANNEL=#mychannel
80+
heroku config:set BLUEBOT_NICK=mybluebot
81+
heroku config:set BLUEBOT_PASSWORD=password # Optional
82+
```
83+
84+
3. Push the code.
85+
86+
```
87+
git push heroku master
88+
```
89+
90+
4. Launch Bluebot.
91+
92+
```
93+
heroku scale bluebot=1
94+
```
95+
96+
You can later shut down the bot by running `heroku scale bluebot=0` and relaunch it by running `heroku scale bluebot=1`.
97+
98+
99+
Local development
100+
-----------------
101+
102+
As you start customizing the bot and adding new featuers, you'll want to test these changes in your local development environment. In order to do this, you'll have to:
103+
104+
1. Launch a local MongoDB server.
105+
106+
```
107+
sudo service mongodb start # Ubuntu
108+
sudo /etc/init.d/mongodb start # Debian
109+
systemctl start mongodb # Arch Linux
110+
```
111+
112+
2. Launch Bluebot.
113+
114+
```
115+
ruby bluebot.rb
116+
```
117+
118+
By default, Bluebot connects to `irc.freenode.net #cinch-bot` using the nickname `bluebot`. You can override this by exporting the necessary global variables (see deployment instructions), e.g.: `BLUEBOT_NICKNAME=mybot ruby bluebot.rb`.

0 commit comments

Comments
 (0)