dog-bot 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +2 -2
- data/dog.gemspec +1 -1
- data/dog_config_example.rb +21 -21
- data/lib/dog/command.rb +2 -2
- data/lib/dog/configure.rb +2 -2
- data/spec/dog/bot_spec.rb +1 -0
- data/spec/dog/configure_spec.rb +6 -6
- metadata +10 -10
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dog-bot (0.0
|
4
|
+
dog-bot (0.1.0)
|
5
5
|
blather (~> 0.8.0)
|
6
6
|
google_image_api (~> 0.0.1)
|
7
7
|
rufus-scheduler (~> 2.0.17)
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
connection_pool (~> 0.9.0)
|
25
25
|
google_image_api (0.0.1)
|
26
26
|
i18n (0.6.1)
|
27
|
-
multi_json (1.3.
|
27
|
+
multi_json (1.3.7)
|
28
28
|
niceogiri (1.0.2)
|
29
29
|
nokogiri (~> 1.4)
|
30
30
|
nokogiri (1.5.5)
|
data/dog.gemspec
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "dog-bot"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = "0.0
|
15
|
+
gem.version = "0.1.0"
|
16
16
|
|
17
17
|
gem.add_dependency "blather", "~> 0.8.0"
|
18
18
|
gem.add_dependency "google_image_api", "~> 0.0.1"
|
data/dog_config_example.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
chat_rooms "dog_test", "dog_test2"
|
2
2
|
|
3
|
-
command "get body of tweet" do
|
4
|
-
|
5
|
-
|
3
|
+
command "get body of tweet" do
|
4
|
+
matches /twitter\.com/
|
5
|
+
action do |message|
|
6
6
|
id = message.split("/").last
|
7
7
|
uri = URI.parse "https://api.twitter.com/1/statuses/show.json?id=#{id}"
|
8
8
|
tweet = JSON.parse uri.open.read
|
@@ -11,30 +11,30 @@ command "get body of tweet" do |c|
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
command "dog" do
|
15
|
-
|
16
|
-
|
14
|
+
command "dog" do
|
15
|
+
matches "dog"
|
16
|
+
action { "bark!" }
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
subcommand "xkcd" do
|
19
|
+
matches "xkcd"
|
20
|
+
action do
|
21
21
|
uri = URI.parse "http://xkcd.com/info.0.json"
|
22
22
|
comic = JSON.parse uri.open.read
|
23
23
|
"#{comic["img"]}\n#{comic["alt"]}"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
subcommand "fetch image" do
|
28
|
+
matches "fetch", "image"
|
29
|
+
action do |message|
|
30
30
|
query = message.split(" ")[2..-1].join(" ")
|
31
31
|
GoogleImageApi.find(query).images.first["url"]
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
subcommand "ruby gems" do
|
36
|
+
matches "gem"
|
37
|
+
action do |message|
|
38
38
|
begin
|
39
39
|
gem_name = message.split(" ").last
|
40
40
|
uri = URI.parse "http://rubygems.org/api/v1/gems/#{gem_name}.json"
|
@@ -47,13 +47,13 @@ command "dog" do |c|
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
subcommand "join channel" do
|
51
|
+
matches "join"
|
52
|
+
action { :join }
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
subcommand "reload config" do
|
56
|
+
matches "reload"
|
57
|
+
action { :reload }
|
58
58
|
end
|
59
59
|
end
|
data/lib/dog/command.rb
CHANGED
data/lib/dog/configure.rb
CHANGED
data/spec/dog/bot_spec.rb
CHANGED
data/spec/dog/configure_spec.rb
CHANGED
@@ -5,13 +5,13 @@ require_relative "../../lib/dog/configure.rb"
|
|
5
5
|
describe Dog::Configure do
|
6
6
|
let :config_string do
|
7
7
|
<<CONFIG
|
8
|
-
command "greet" do
|
9
|
-
|
10
|
-
|
8
|
+
command "greet" do
|
9
|
+
matches "hello", "hi", "whats up"
|
10
|
+
action { "hello!" }
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
subcommand "cool greet" do
|
13
|
+
matches "yo"
|
14
|
+
action { "yo yo yo, hello!" }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dog-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blather
|
16
|
-
requirement: &
|
16
|
+
requirement: &11215480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11215480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: google_image_api
|
27
|
-
requirement: &
|
27
|
+
requirement: &11214640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.0.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *11214640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rufus-scheduler
|
38
|
-
requirement: &
|
38
|
+
requirement: &11212500 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.17
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *11212500
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &11211640 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 0.9.2.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *11211640
|
58
58
|
description: Chatbot
|
59
59
|
email:
|
60
60
|
- ben@bmdev.org
|