botemon 0.3.2 → 0.3.3

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjdjMjU4Y2VjNGRkMDlkY2Y2ZTNjNDIyNDNlMjRjZmJhODMxYzFjMg==
4
+ MmZjYjdlYjhhNzhiODU4Y2M5MTdjOTYyNTQ5ODAwODExYTI1MTkwNA==
5
5
  data.tar.gz: !binary |-
6
- NmMzMTQyNzlhNWRlZjM5MTg0YTlhOWFlZTc4OWRmY2I5MTYwYjAwOQ==
6
+ MmU1NzRhMDMxNDgwZDFmNWZlNDQ5NmE0ZjM3YmM3MGIwODJiM2E3YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YTA5YWE3MDg4YjA5YTM5YTZlZDc2YmVmMzI1MGI2MmZmMTBlMGExYTUzM2Zi
10
- ZTExYTFiZmZhMjA2MDg5NDU2MDRhYmI5NWJiNDI2MGE0Zjc4NTNmNzc3Mjc1
11
- MjQ2NWZkYzc4NmEwMWE0ODRmMTY0NzBhNWIwMTE2YTczOGZjZWI=
9
+ NDY2MjMyMDFmNDRkNzUyZWJhNWQxOWRjZDIzYWJiOGE2OTBlZDY3NTQ1ZDU3
10
+ MDMwZjQwZmZiMTA2MWU2MTQ2Yzc2ZjRkMjdiNzUwMGJmODdkYWY3OTc5MTIz
11
+ ZGRkZTZiNmIyNjIwYmEzZmQ1ZTAzNjM4YjhlYjVkOTgwNmZkN2Q=
12
12
  data.tar.gz: !binary |-
13
- YTY3NWIyNTFkM2M2M2IwOGMxMWYxMDIzNDhhNDhmYTJmNmQ4NTE5NGQ2Mjg2
14
- OTkxN2Y5NmEzZWVmM2QwMTZhOTBhODdjYjQ5ODQwZWY2MTQzYzhiZWQzMTI5
15
- NDgzOGQ2MGIwMzQ1MDA0OWU0OWRiNDRiNjY3YWE5MDZlMDFkM2I=
13
+ NTRiMzI1MzBhOTc0NGE2YTcwZGRhZDc1ZGRjMWZmNzgzOWYyNWZjNTIzMzFk
14
+ ZDEwYmRmMDAxMjVhZWNlNTE4Y2MxZWRhNGZkMDc0OWEwYzNiNzIwYzVhNGQy
15
+ MDYzNWIxZDljNWNmZGVkNDMzMmEwMjczZDkxZGQ4M2RlNjUyYzk=
data/bin/botemon CHANGED
@@ -46,28 +46,30 @@ Cinch::Bot.new {
46
46
  @storage = Storage.new('./cache.db') unless @storage
47
47
 
48
48
  name = Pokedex.id2name(name) if name.numeric?
49
-
50
- if name == nil
51
- m.reply Format(:red, 'Pokémon not found.')
52
- else
53
- pokemon = Pokedex.get name, @storage
54
- m.reply pokemon ? "#{pokemon.to_s}\nhttp://www.smogon.com/bw/pokemon/#{name}".split("\n").map { |l| Format(:red, l) }.join("\n") : 'Pokémon not found.'
55
- end
49
+
50
+ pokemon = Pokedex.get name, @storage
51
+ m.reply pokemon ? "#{pokemon.to_s}\nhttp://www.smogon.com/bw/pokemon/#{name}".split("\n").map { |l| Format(:red, l) }.join("\n") : 'Pokémon not found.'
56
52
  end
57
53
 
58
54
  on :message, /^moveset (.+) (.+)/ do |m, name, tier|
59
55
  name = Pokedex.id2name(name) if name.numeric?
60
56
 
61
- if name == nil
62
- m.reply Format(:red, 'Pokémon not found.')
57
+
58
+ movesets = Movedex.get name, tier
59
+ if movesets != nil || movesets.any?
60
+ m.reply Format(:red, "--- #{movesets.first.pokemon} (#{movesets.first.tier}) ---")
61
+ movesets.each { |moveset| m.reply Format(:red, " -- #{moveset.name} --\n#{moveset.to_s.split("\n").map { |l| Format(:red, l) }.join("\n")}\n") }
63
62
  else
64
- movesets = Movedex.get name, tier
65
- if movesets != nil || movesets.any?
66
- m.reply Format(:red, "--- #{movesets.first.pokemon} (#{movesets.first.tier}) ---")
67
- movesets.each { |moveset| m.reply Format(:red, " -- #{moveset.name} --\n#{moveset.to_s.split("\n").map { |l| Format(:red, l) }.join("\n")}\n") }
68
- else
69
- m.reply Format(:red, 'Moveset not found.')
70
- end
63
+ m.reply Format(:red, 'Moveset not found.')
64
+ end
65
+ end
66
+
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.')
71
73
  end
72
74
  end
73
75
 
data/lib/botemon.rb CHANGED
@@ -32,5 +32,6 @@ require 'botemon/smogon/moveset'
32
32
  require 'botemon/storage'
33
33
  require 'botemon/pokedex'
34
34
  require 'botemon/movedex'
35
+ require 'botemon/abilitydex'
35
36
 
36
37
  require 'botemon/version'
@@ -0,0 +1,25 @@
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 Abilitydex
21
+ def self.get(name)
22
+ return nil if name == nil
23
+ return Smogon::Abilitydex.get name
24
+ end
25
+ end
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Botemon
21
21
  def self.version
22
- '0.3.2'
22
+ '0.3.3'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: botemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
@@ -87,6 +87,7 @@ executables:
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - lib/botemon/abilitydex.rb
90
91
  - lib/botemon/movedex.rb
91
92
  - lib/botemon/pokedex.rb
92
93
  - lib/botemon/smogon/moveset.rb