botemon 0.3.5 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/botemon +23 -11
- data/lib/botemon/movedex.rb +4 -12
- data/lib/botemon/movesetdex.rb +33 -0
- data/lib/botemon/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDA1NzA5OGQ4ODYzNDE1MDM1ODE2NjM3OTdmOTc0M2M5NjdkZjFkMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTM4NGZlNWQ1YmFlYzcxZTYzMjE5NmQ2Mjg2ODI2ZWE5OTdmZDZjOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWRiNTU5N2QwYWZjOTEwM2U5ZDFhYmIzOWIzN2VhMDVhNTdiYWE2N2E0N2Rk
|
10
|
+
Y2QxODQyODU1OTljOTllNTAwZjllYzVmYjc2ZDJlNzZmNTg4NDIyM2QwNDc4
|
11
|
+
YjBhYzU4MjU5NjRhYWFiYjhkYWI0OGY1ZGJhZDJlZWQ3NzliMGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDM0YTU3NjQ5ZDdjZmRjNDc1OTc3OTM1NzE4Yzk5NjdiMWRlNzBkNWM5OThj
|
14
|
+
NzQ3ZjU1MjhmMjI2ZDllZTE2NmE2MzhjMTc2YTkxODRjYjQ5MTJmNGQ3Yzhl
|
15
|
+
ZDZmZGRlZWM3ZTA1OWZhOThhM2U2MzU3ZjYwNjc2M2Q3OWRjMTQ=
|
data/bin/botemon
CHANGED
@@ -51,11 +51,32 @@ Cinch::Bot.new {
|
|
51
51
|
m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map { |l| Format(:red, l) }.join("\n") : 'Pokémon not found.'
|
52
52
|
end
|
53
53
|
|
54
|
+
on :message, /^ability (.+)/ do |m, name|
|
55
|
+
ability = Abilitydex.get name
|
56
|
+
if ability != nil
|
57
|
+
m.reply Format(:red, "#{ability.to_s.split("\n").map { |l| Format(:red, l) }.join("\n")}")
|
58
|
+
else
|
59
|
+
m.reply Format(:red, 'Ability not found.')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
on :message, /^move (.+)/ do |m, name|
|
64
|
+
name = Pokedex.id2name(name) if name.numeric?
|
65
|
+
|
66
|
+
|
67
|
+
move = Movedex.get name
|
68
|
+
if move != nil
|
69
|
+
m.reply Format(:red, move.to_s.split("\n").map { |l| Format(:red, l) }.join("\n"))
|
70
|
+
else
|
71
|
+
m.reply Format(:red, 'Move not found.')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
54
75
|
on :message, /^moveset (.+) (.+)/ do |m, name, tier|
|
55
76
|
name = Pokedex.id2name(name) if name.numeric?
|
56
77
|
|
57
78
|
|
58
|
-
movesets =
|
79
|
+
movesets = Movesetdex.get name, tier
|
59
80
|
if movesets != nil || movesets.any?
|
60
81
|
m.reply Format(:red, "--- #{movesets.first.pokemon} (#{movesets.first.tier}) ---")
|
61
82
|
movesets.each { |moveset| m.reply Format(:red, " -- #{moveset.name} --\n#{moveset.to_s.split("\n").map { |l| Format(:red, l) }.join("\n")}\n") }
|
@@ -64,15 +85,6 @@ Cinch::Bot.new {
|
|
64
85
|
end
|
65
86
|
end
|
66
87
|
|
67
|
-
on :message, /^ability (.+)/ do |m, name|
|
68
|
-
ability = Abilitydex.get name
|
69
|
-
if ability != nil
|
70
|
-
m.reply Format(:red, "#{ability.to_s.split("\n").map { |l| Format(:red, l) }.join("\n")}")
|
71
|
-
else
|
72
|
-
m.reply Format(:red, 'Ability not found.')
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
88
|
on :message, /^pktrivia$/ do |m|
|
77
89
|
@storage = Storage.new('./cache.db') unless @storage
|
78
90
|
|
@@ -100,7 +112,7 @@ Cinch::Bot.new {
|
|
100
112
|
m.reply Format(:red, "Nope, #{m.user.nick} was wrong.")
|
101
113
|
@trivia_wrong += 1
|
102
114
|
if @trivia_wrong >= 3
|
103
|
-
m.reply Format(:red, "
|
115
|
+
m.reply Format(:red, "No more chances. The secret Pokémon is #{@pokemon_trivia.name}!")
|
104
116
|
@pokemon_trivia = nil
|
105
117
|
@trivia_wrong = 0
|
106
118
|
end
|
data/lib/botemon/movedex.rb
CHANGED
@@ -17,17 +17,9 @@
|
|
17
17
|
# along with Botémon. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
class Movedex
|
21
|
-
def self.
|
22
|
-
return
|
23
|
-
|
24
|
-
rescue
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.get(name, tier)
|
30
|
-
return nil if name == nil || tier == nil
|
31
|
-
return Smogon::Movedex.get name, tier
|
20
|
+
class Movedex
|
21
|
+
def self.get(name)
|
22
|
+
return nil if name == nil
|
23
|
+
return Smogon::Movedex.get name
|
32
24
|
end
|
33
25
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of Botémon.
|
5
|
+
#
|
6
|
+
# Botémon is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Botémon is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Botémon. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
class Movesetdex
|
21
|
+
def self.id2name(id)
|
22
|
+
return begin
|
23
|
+
Nokogiri::HTML(open("http://pokemondb.net/pokedex/#{id}")).xpath('//div[@class="navbar"]/h1')[0].text
|
24
|
+
rescue
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.get(name, tier)
|
30
|
+
return nil if name == nil || tier == nil
|
31
|
+
return Smogon::Movesetdex.get name, tier
|
32
|
+
end
|
33
|
+
end
|
data/lib/botemon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botemon
|
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-07-
|
11
|
+
date: 2013-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -80,7 +80,8 @@ dependencies:
|
|
80
80
|
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description: IRC bot for Pokéfag with (Poké|Move|
|
83
|
+
description: IRC bot for Pokéfag with (Poké|Ability|Move|Moveset)dex and a trivia
|
84
|
+
game.
|
84
85
|
email: webmaster@giovannicapuano.net
|
85
86
|
executables:
|
86
87
|
- botemon
|
@@ -89,6 +90,7 @@ extra_rdoc_files: []
|
|
89
90
|
files:
|
90
91
|
- lib/botemon/abilitydex.rb
|
91
92
|
- lib/botemon/movedex.rb
|
93
|
+
- lib/botemon/movesetdex.rb
|
92
94
|
- lib/botemon/pokedex.rb
|
93
95
|
- lib/botemon/smogon/moveset.rb
|
94
96
|
- lib/botemon/smogon/pokemon.rb
|