descartes 0.3.7.3 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/descartes/modules/quotone.rb +35 -0
- data/lib/descartes/modules/reply.rb +3 -4
- data/lib/descartes/modules/sindaco.rb +3 -4
- data/lib/descartes/modules/url.rb +8 -6
- data/lib/descartes/utils.rb +9 -0
- data/lib/descartes/version.rb +1 -1
- metadata +30 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc616a48a2d57f44b088447a516715fc9404ebe5
|
4
|
+
data.tar.gz: 49747ef59f9cbe448ada135dd49767ff57335292
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48bf793d8ecc118c0e6710797b68f320ad86837378472589f90f3c025d7248fb410cd9adda48b9e65a16408fe1b4c5dd06171ff444039ce3edb37bb34939038b
|
7
|
+
data.tar.gz: 8e9c4ebc012ff1b3a3226220a371fdb208658fab76ad1ded0a554da2c320f1b0bae542ea4e459c5745a79b2b79f23c0cc53202f0949896ff42887934d562b8fc
|
@@ -0,0 +1,35 @@
|
|
1
|
+
##
|
2
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
## Version 2, December 2004
|
4
|
+
##
|
5
|
+
## Everyone is permitted to copy and distribute verbatim or modified
|
6
|
+
## copies of this license document, and changing it is allowed as long
|
7
|
+
## as the name is changed.
|
8
|
+
##
|
9
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
10
|
+
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
11
|
+
##
|
12
|
+
## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
13
|
+
##
|
14
|
+
|
15
|
+
require 'open-uri'
|
16
|
+
require 'json'
|
17
|
+
|
18
|
+
class Descartes
|
19
|
+
class Quotone
|
20
|
+
include Cinch::Plugin
|
21
|
+
|
22
|
+
match /quotone/
|
23
|
+
|
24
|
+
def get(url)
|
25
|
+
open(url) { |f|
|
26
|
+
quote = JSON.parse f.read
|
27
|
+
return "\##{quote['id']} - #{quote['source']} (#{quote['tags']})\n#{quote['quote'].nl2(' / ').decode}"
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute(m)
|
32
|
+
m.reply get 'http://www.quotone.unsigned.it/api/random.json'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -20,10 +20,9 @@ class Descartes
|
|
20
20
|
|
21
21
|
def execute(m)
|
22
22
|
file = File.expand_path '../reply/replies.txt', __FILE__
|
23
|
-
|
24
|
-
File.read(file).each_line { |line| ary << line unless line.empty? }
|
25
|
-
}
|
26
|
-
m.reply replies[rand(1..replies.length)]
|
23
|
+
m.reply [].tap { |ary|
|
24
|
+
File.read(file).each_line { |line| ary << line unless line.strip.empty? }
|
25
|
+
}.sample
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
@@ -20,10 +20,9 @@ class Descartes
|
|
20
20
|
|
21
21
|
def execute(m)
|
22
22
|
file = File.expand_path '../reply/sindaco.txt', __FILE__
|
23
|
-
|
24
|
-
File.read(file).each_line { |line| ary << line unless line.empty? }
|
25
|
-
}
|
26
|
-
m.reply replies[rand(1..replies.length)]
|
23
|
+
m.reply [].tap { |ary|
|
24
|
+
File.read(file).each_line { |line| ary << line unless line.strip.empty? }
|
25
|
+
}.sample
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
@@ -22,13 +22,15 @@ class Descartes
|
|
22
22
|
match /http(s)?:\/\/(\S+)/, :use_prefix => false
|
23
23
|
|
24
24
|
def execute(m, ssl, url)
|
25
|
-
|
25
|
+
begin
|
26
|
+
page = Nokogiri::HTML(open("http#{ssl}://#{url}").read, nil, 'utf-8')
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
if url.match('youtube.com|youtu.be') != nil
|
29
|
+
m.reply page.css('//title').first.text.chomp(' - YouTube')
|
30
|
+
else
|
31
|
+
m.reply page.css('//title').first.text.strip
|
32
|
+
end
|
33
|
+
rescue; end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
data/lib/descartes/utils.rb
CHANGED
data/lib/descartes/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: descartes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: htmlentities
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: json
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
description: A serious modular ruby IRC bot.
|
70
98
|
email: webmaster@giovannicapuano.net
|
71
99
|
executables:
|
@@ -77,6 +105,7 @@ files:
|
|
77
105
|
- lib/descartes/modules/crunchyroll.rb
|
78
106
|
- lib/descartes/modules/currency.rb
|
79
107
|
- lib/descartes/modules/google.rb
|
108
|
+
- lib/descartes/modules/quotone.rb
|
80
109
|
- lib/descartes/modules/reply/replies.txt
|
81
110
|
- lib/descartes/modules/reply/sindaco.txt
|
82
111
|
- lib/descartes/modules/reply.rb
|