descartes 0.3.16 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/descartes +27 -2
- data/lib/descartes/modules/crunchyroll.rb +4 -4
- data/lib/descartes/modules/dicteng.rb +2 -2
- data/lib/descartes/modules/google.rb +2 -2
- data/lib/descartes/modules/sindaco.rb +2 -2
- data/lib/descartes/modules/url.rb +4 -4
- data/lib/descartes/version.rb +1 -1
- data/lib/descartes.rb +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0b57aa9de1df1c113ebb033c34a5130f36ee934
|
4
|
+
data.tar.gz: 73d20235abaf909f4410e04ddbbab5725dc5b0f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 581c343dd71d0140fff87c46f61687df21fd04acd02ee8b8a926cbabd1f83528880cbe426cb8f1852cd1c396808b1af38d4fbf9a424cd978d57ce8c016d04805
|
7
|
+
data.tar.gz: b35bde8554bcafd40e517f27e5fb64a91cf53d13d4455688c2f51d9b3e387015745a3136398952a3bb815889d0867b79e6c4249c6231a17dec153243a75668f8
|
data/bin/descartes
CHANGED
@@ -33,8 +33,33 @@ Cinch::Bot.new {
|
|
33
33
|
c.plugins.options[Cinch::Plugins::Login] = { :password => 'dat_password' }
|
34
34
|
end
|
35
35
|
|
36
|
-
on :message, '!
|
37
|
-
m.
|
36
|
+
on :message, '!help' do |m|
|
37
|
+
m.bot.plugins.each { |plugin|
|
38
|
+
plugin.handlers.each { |handler|
|
39
|
+
pattern = handler.pattern
|
40
|
+
name = plugin.to_s.split('::')[1].split(?:)[0]
|
41
|
+
|
42
|
+
prefix = case pattern.prefix
|
43
|
+
when Regexp then pattern.prefix.source
|
44
|
+
when String then pattern.prefix
|
45
|
+
else ''
|
46
|
+
end
|
47
|
+
|
48
|
+
suffix = case pattern.suffix
|
49
|
+
when Regexp then pattern.suffix.source
|
50
|
+
when String then pattern.suffix
|
51
|
+
else ''
|
52
|
+
end
|
53
|
+
|
54
|
+
regex = case pattern.pattern
|
55
|
+
when Regexp then pattern.pattern.source
|
56
|
+
when String then pattern.pattern
|
57
|
+
else ''
|
58
|
+
end
|
59
|
+
|
60
|
+
m.reply regex.empty? ? name : "#{name}: #{prefix}#{regex}#{suffix}"
|
61
|
+
}
|
62
|
+
}
|
38
63
|
end
|
39
64
|
|
40
65
|
on :message, '!è' do |m|
|
@@ -24,11 +24,11 @@ class Descartes
|
|
24
24
|
series = Crunchyroll::find m.params[1].split('.cr ')[1]
|
25
25
|
|
26
26
|
if series
|
27
|
-
# m.reply "#{
|
28
|
-
m.reply "#{
|
27
|
+
# m.reply "#{series[:title].colorize} is a series airing on #{series[:where].colorize} at #{series[:day].colorize} #{series[:hour].colorize}:#{series[:min].colorize} which is in #{series[:left].colorize}."
|
28
|
+
m.reply "#{series[:title].colorize} è una serie trasmessa da #{series[:where].colorize} il #{series[:day].to_ita.colorize} alle #{series[:hour].colorize}:#{series[:min].colorize}, cioè tra #{series[:left].to_ita.colorize}."
|
29
29
|
else
|
30
|
-
# m.reply
|
31
|
-
m.reply
|
30
|
+
# m.reply 'Anime not found'.colorize
|
31
|
+
m.reply 'Anime non trovato'.colorize
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -22,8 +22,8 @@ class Descartes
|
|
22
22
|
match /([a-zA-Z]+) ([a-zA-Z]+)/, :use_prefix => false
|
23
23
|
|
24
24
|
def execute(m, action, word)
|
25
|
-
url
|
26
|
-
page = Nokogiri::HTML
|
25
|
+
url = "http://www.wordreference.com/#{action}/#{word}"
|
26
|
+
page = Nokogiri::HTML open(url)
|
27
27
|
m.reply "#{page.xpath('//table[@class="WRD"]/tr[2]').text} di più qui: #{url}"
|
28
28
|
end
|
29
29
|
end
|
@@ -22,11 +22,11 @@ class Descartes
|
|
22
22
|
match /google (.+)/
|
23
23
|
|
24
24
|
def search(query)
|
25
|
-
page = Nokogiri::HTML
|
25
|
+
page = Nokogiri::HTML open("http://www.google.com/search?q=#{CGI.escape(query)}")
|
26
26
|
|
27
27
|
[].tap { |res|
|
28
28
|
page.search('cite').each { |r|
|
29
|
-
res << { :
|
29
|
+
res << { url: r.inner_text }
|
30
30
|
}
|
31
31
|
|
32
32
|
page.xpath('//h3[@class="r"]').each_with_index { |r, i|
|
@@ -16,10 +16,10 @@ class Descartes
|
|
16
16
|
class Sindaco
|
17
17
|
include Cinch::Plugin
|
18
18
|
|
19
|
-
match
|
19
|
+
match 'Sindaco'
|
20
20
|
|
21
21
|
def execute(m)
|
22
|
-
file
|
22
|
+
file = File.expand_path '../files/sindaco.txt', __FILE__
|
23
23
|
m.reply [].tap { |ary|
|
24
24
|
File.read(file).each_line { |line| ary << line unless line.strip.empty? }
|
25
25
|
}.sample
|
@@ -23,12 +23,12 @@ class Descartes
|
|
23
23
|
|
24
24
|
def execute(m, ssl, url)
|
25
25
|
begin
|
26
|
-
page = Nokogiri::HTML
|
26
|
+
page = Nokogiri::HTML open("http#{ssl}://#{url}").read, nil, 'utf-8'
|
27
27
|
|
28
|
-
if url.match
|
29
|
-
m.reply
|
28
|
+
if url.match 'youtube.com|youtu.be'
|
29
|
+
m.reply "[Youtube] #{page.css('//title').first.text.chomp(' - YouTube')}".colorize :pink
|
30
30
|
else
|
31
|
-
m.reply
|
31
|
+
m.reply "[URL] #{page.css('//title').first.text.strip}".colorize :red
|
32
32
|
end
|
33
33
|
rescue; end
|
34
34
|
end
|
data/lib/descartes/version.rb
CHANGED
data/lib/descartes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: descartes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cinch
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cinch-colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: nokogiri
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|