descartes 0.3.6 → 0.3.7
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/reply.rb +9 -9
- data/lib/descartes/modules/synonyms.rb +29 -0
- data/lib/descartes/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7210a8590818498b893495bd154a7635c6b84f6
|
4
|
+
data.tar.gz: 0998a0bfdec1ea0bfd29248517fe7d1adac04ef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ac65bab5fe97d93f37ba6e4713d746cb98d97140825b2cf243ffdb3cb02a529a55811c47567ce868b8ea86abaeaa9a1349922a0a80c1e6a4c2234820f092af
|
7
|
+
data.tar.gz: cc2d3c7e2f900fb7f5135e221f88713a413a259bd4d250cc54ab91b1dfbe032d7ef3b178b6d1a35fc61d9828220cd4befdb274f64408729612dda7790b2eb98f
|
@@ -13,17 +13,17 @@
|
|
13
13
|
##
|
14
14
|
|
15
15
|
class Descartes
|
16
|
-
|
17
|
-
|
16
|
+
class Reply
|
17
|
+
include Cinch::Plugin
|
18
18
|
|
19
|
-
|
19
|
+
match /#{@@nickname}.*\?/, :use_prefix => false
|
20
20
|
|
21
|
-
|
21
|
+
def execute(m)
|
22
22
|
file = File.expand_path '../reply/replies.txt', __FILE__
|
23
|
-
|
23
|
+
replies = [].tap { |ary|
|
24
24
|
File.read(file).each_line { |line| ary << line unless line.empty? }
|
25
25
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
26
|
+
m.reply replies[rand(1..replies.length)]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# ##
|
3
|
+
# ## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
4
|
+
# ## Version 2, December 2004
|
5
|
+
# ##
|
6
|
+
# ## Everyone is permitted to copy and distribute verbatim or modified
|
7
|
+
# ## copies of this license document, and changing it is allowed as long
|
8
|
+
# ## as the name is changed.
|
9
|
+
# ##
|
10
|
+
# ## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
+
# ## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
+
# ##
|
13
|
+
# ## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
+
# ##
|
15
|
+
require 'nokogiri'
|
16
|
+
require 'open-uri'
|
17
|
+
|
18
|
+
class Descartes
|
19
|
+
class Treccani
|
20
|
+
include Cinch::Plugin
|
21
|
+
match /syn ([a-zA-Z]+)/
|
22
|
+
|
23
|
+
def execute(m, word)
|
24
|
+
url = "http://www.treccani.it/vocabolario/#{word}_(Sinonimi-e-Contrari)/"
|
25
|
+
page = Nokogiri::HTML(open(url))
|
26
|
+
m.reply page.xpath('//div[@class="spiega attacco"]/p').text.strip + " di più qui: #{url}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/descartes/modules/seen.rb
|
85
85
|
- lib/descartes/modules/shinbo.rb
|
86
86
|
- lib/descartes/modules/sindaco.rb
|
87
|
+
- lib/descartes/modules/synonyms.rb
|
87
88
|
- lib/descartes/modules/trec.rb
|
88
89
|
- lib/descartes/modules/url.rb
|
89
90
|
- lib/descartes/utils.rb
|