botemon 0.5.6.2 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/botemon +38 -37
  3. data/lib/botemon/version.rb +1 -1
  4. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e254e2bc7218d048d03e63c8de966a41fa28b600
4
- data.tar.gz: a1c975c95e61bd28916c915202e1b3ac73fdda55
3
+ metadata.gz: 2179c0f12670f7491b138bdb2933c6a7952e0614
4
+ data.tar.gz: 37d9f84691640a8cc25927b0028d6c39eb49e110
5
5
  SHA512:
6
- metadata.gz: 3a6fcb20f19d1cbe005e457c82f25b0b641db9f04f830859a159655e70046d27c70fd1c6a5e3480ad9aa4b7aa16f31933b090b57824880ea88f665b21edde119
7
- data.tar.gz: 7cbdb157fd97db306f61cc069819663cc2dd402dbb03e532a830b59c97312f9972c45d57006f2d6173120ad8883f30fd3efa95e5e223047e2e30d086a3f97550
6
+ metadata.gz: cd34708b015bc66e0bce787ae9752701c89e2d94f146e70fa243f9fe67c1e8f472a350520ea87d28a7f655047423f50a42cd473988ebafe4105f78d13ba4599c
7
+ data.tar.gz: 1656445d3fd2cd54f2bb6a11cc42b1ebf7f40f52405e6d90288c3fc107737f96f38345b2fe7d58862ec5531c12e8b1c4cc15670d83a483235ba2d879441db124
@@ -21,6 +21,7 @@
21
21
 
22
22
  require 'botemon'
23
23
  require 'open-uri'
24
+ require 'cinch/colorize'
24
25
 
25
26
  abort 'Usage: botemon <bot_name> <bot_password> <server> <channels>' if ARGV.length < 4
26
27
 
@@ -49,25 +50,25 @@ bot = Cinch::Bot.new {
49
50
  name = Smogon::Pokemon.id2name(name) if name.numeric?
50
51
 
51
52
  pokemon = Pokedex.get name.delete(?'), @storage
52
- m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map { |l| Format(:red, l) }.join("\n") : Format(:red, 'Pokémon not found.')
53
+ m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map(&:colorize).join("\n") : 'Pokémon not found.'.colorize
53
54
  end
54
55
 
55
56
  on :message, /^ability (.+)/ do |m, name|
56
57
  ability = Abilitydex.get name
57
58
 
58
- m.reply ability ? "#{ability.to_s}\n#{ability.url}".split("\n").map { |l| Format(:red, l) }.join("\n") : Format(:red, 'Ability not found.')
59
+ m.reply ability ? "#{ability.to_s}\n#{ability.url}".split("\n").map(&:colorize).join("\n") : 'Ability not found.'.colorize
59
60
  end
60
61
 
61
62
  on :message, /^item (.+)/ do |m, name|
62
63
  item = Itemdex.get name
63
64
 
64
- m.reply item ? "#{item.to_s}\n#{item.url}".split("\n").map { |l| Format(:red, l) }.join("\n") : Format(:red, 'Item not found.')
65
+ m.reply item ? "#{item.to_s}\n#{item.url}".split("\n").map(&:colorize).join("\n") : 'Item not found.'.colorize
65
66
  end
66
67
 
67
68
  on :message, /^move (.+)/ do |m, name|
68
69
  move = Movedex.get name
69
70
 
70
- m.reply move ? "#{move.to_s}\n#{move.url}".split("\n").map { |l| Format(:red, l) }.join("\n") : Format(:red, 'Move not found.')
71
+ m.reply move ? "#{move.to_s}\n#{move.url}".split("\n").map(&:colorize).join("\n") : 'Move not found.'.colorize
71
72
  end
72
73
 
73
74
  on :message, /^moveset (.+) (.+) (.+)/ do |m, name, tier, metagame|
@@ -75,10 +76,10 @@ bot = Cinch::Bot.new {
75
76
 
76
77
  movesets = Movesetdex.get name.delete(?'), tier, (metagame.empty? ? 'bw' : metagame)
77
78
  if movesets != nil || movesets.any?
78
- m.reply Format(:red, "--- #{movesets.first.pokemon} (#{movesets.first.tier}) ---")
79
- movesets.each { |moveset| m.reply Format(:red, " -- #{moveset.name} --\n#{moveset.to_s.split("\n").map { |l| Format(:red, l) }.join("\n")}\n") }
79
+ m.reply "--- #{movesets.first.pokemon} (#{movesets.first.tier}) ---".colorize
80
+ movesets.each { |moveset| m.reply " -- #{moveset.name} --\n#{moveset.to_s.split("\n").map(&:colorize).join("\n")}\n".colorize }
80
81
  else
81
- m.reply Format(:red, 'Moveset not found.')
82
+ m.reply 'Moveset not found.'.colorize
82
83
  end
83
84
  end
84
85
 
@@ -104,41 +105,41 @@ bot = Cinch::Bot.new {
104
105
  @storage = Storage.new('./cache.db') unless @storage
105
106
 
106
107
  pokemon = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)).delete(?'), @storage
107
- m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map { |l| Format(:red, l) }.join("\n") : Format(:red, 'Pokémon not found.')
108
+ m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map(&:colorize).join("\n") : 'Pokémon not found.'.colorize
108
109
  end
109
110
 
110
111
  on :message, /^pktrivia$/ do |m|
111
112
  @storage = Storage.new('./cache.db') unless @storage
112
113
 
113
114
  if @pokemon_trivia != nil
114
- m.reply Format(:red, 'Other players are playing, please wait until they finish.')
115
- m.reply Format(:red, @pokemon_trivia.clues)
115
+ m.reply 'Other players are playing, please wait until they finish.'.colorize
116
+ m.reply @pokemon_trivia.clues.colorize
116
117
  else
117
118
  @pokemon_trivia = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)).delete(?'), @storage
118
119
  @trivia_owner = m.user.nick
119
120
  @trivia_wrong = 0
120
121
 
121
122
  if @pokemon_trivia
122
- m.reply @pokemon_trivia.clues.split("\n").map { |l| Format(:red, l) }.join("\n")
123
- m.reply Format(:red, 'You have 3 chances to try to say which Pokémon is this!')
123
+ m.reply @pokemon_trivia.clues.split("\n").map(&:colorize).join("\n")
124
+ m.reply 'You have 3 chances to try to say which Pokémon is this!'.colorize
124
125
  else
125
- m.reply Format(:red, 'An error is occurred searching the Pokémon.')
126
+ m.reply 'An error is occurred searching the Pokémon.'.colorize
126
127
  end
127
128
  end
128
129
  end
129
130
 
130
131
  on :message, /^pktrivia (.+)/ do |m, pokemon|
131
132
  if @pokemon_trivia == nil
132
- m.reply Format(:red, 'You have to start the game before to play.')
133
+ m.reply 'You have to start the game before to play.'.colorize
133
134
  elsif pokemon.downcase == @pokemon_trivia.name.downcase
134
- m.reply Format(:red, "Right, #{m.user.nick} won!")
135
+ m.reply "Right, #{m.user.nick} won!".colorize
135
136
  @pokemon_trivia = nil
136
137
  @trivia_wrong = 0
137
138
  else
138
- m.reply Format(:red, "Nope, #{m.user.nick} was wrong.")
139
+ m.reply "Nope, #{m.user.nick} was wrong.".colorize
139
140
  @trivia_wrong += 1
140
141
  if @trivia_wrong >= 3
141
- m.reply Format(:red, "You have no more chances. The secret Pokémon is #{@pokemon_trivia.name}!")
142
+ m.reply "You have no more chances. The secret Pokémon is #{@pokemon_trivia.name}!".colorize
142
143
  @pokemon_trivia = nil
143
144
  @trivia_wrong = 0
144
145
  end
@@ -150,22 +151,22 @@ bot = Cinch::Bot.new {
150
151
  @pokemon_trivia = nil
151
152
  @trivia_owner = ''
152
153
  @trivia_wrong = 0
153
- m.reply Format(:red, "Game aborted by #{m.user.nick}.")
154
+ m.reply "Game aborted by #{m.user.nick}.".colorize
154
155
  elsif @pokemon_trivia == nil
155
- m.reply Format(:red, 'Game not started yet.')
156
+ m.reply 'Game not started yet.'.colorize
156
157
  else
157
- m.reply Format(:red, "Only channel operators and the game luncher can stop the game. #{m.user.nick} GTFO.")
158
+ m.reply "Only channel operators and the game luncher can stop the game. #{m.user.nick} GTFO.".colorize
158
159
  end
159
160
  end
160
161
 
161
162
  on :message, /^pkdebug$/ do |m|
162
163
  if @pokemon_trivia == nil
163
- m.reply Format(:red, 'Game not started.')
164
+ m.reply 'Game not started.'.colorize
164
165
  elsif m.user.nick == 'mirkosp' || m.user.nick == 'RoxasShadowRS'
165
- m.reply Format(:red, @pokemon_trivia.name)
166
+ m.reply @pokemon_trivia.name.colorize
166
167
  else
167
168
  proverbs = open('http://pastebin.com/raw.php?i=qWF65TcP').read.each_line.to_a.sample.strip
168
- m.reply Format(:red, proverbs)
169
+ m.reply proverbs.colorize
169
170
  end
170
171
  end
171
172
 
@@ -179,29 +180,29 @@ bot = Cinch::Bot.new {
179
180
  @trivia_owner = ''
180
181
  @trivia_wrong = 0
181
182
 
182
- m.reply Format(:red, 'Cache created.')
183
+ m.reply 'Cache created.'.colorize
183
184
  else
184
185
  proverbs = open('http://pastebin.com/raw.php?i=qWF65TcP').read.each_line.to_a.sample.strip
185
- m.reply Format(:red, proverbs)
186
+ m.reply proverbs.colorize
186
187
  end
187
188
  end
188
189
 
189
190
  on :message, /^pkversion$/ do |m|
190
- m.reply Format(:red, "Botémon: #{Botemon::version}")
191
- m.reply Format(:red, "Smogon-API: #{Smogon::version}")
191
+ m.reply "Botémon: #{Botemon::version}".colorize
192
+ m.reply "Smogon-API: #{Smogon::version}".colorize
192
193
  end
193
194
 
194
195
  on :message, /^pkhelp$/ do |m|
195
- m.reply Format(:red, "- pkmn Bulbasaur ")
196
- m.reply Format(:red, "- pkmn 1 ")
197
- m.reply Format(:red, "- ability Synchronize ")
198
- m.reply Format(:red, "- item Leftovers ")
199
- m.reply Format(:red, "- move Reflect ")
200
- m.reply Format(:red, "- moveset Bulbasaur LC ")
201
- m.reply Format(:red, "- moveset Bulbasaur LC DP ")
202
- m.reply Format(:red, "- pstats Scizor 70 Adamant 0/252/0/0/6/252 15/31/30/2/31/31 ")
203
- m.reply Format(:red, "- pstats Scizor 70 Adamant 0/252/0/0/6/252 ")
204
- m.reply Format(:red, "- pkrandom, pktrivia, pkdebug, pkstop, pkcache, pkversion ")
196
+ m.reply "- pkmn Bulbasaur ".colorize
197
+ m.reply "- pkmn 1 ".colorize
198
+ m.reply "- ability Synchronize ".colorize
199
+ m.reply "- item Leftovers ".colorize
200
+ m.reply "- move Reflect ".colorize
201
+ m.reply "- moveset Bulbasaur LC ".colorize
202
+ m.reply "- moveset Bulbasaur LC DP ".colorize
203
+ m.reply "- pstats Scizor 70 Adamant 0/252/0/0/6/252 15/31/30/2/31/31 ".colorize
204
+ m.reply "- pstats Scizor 70 Adamant 0/252/0/0/6/252 ".colorize
205
+ m.reply "- pkrandom, pktrivia, pkdebug, pkstop, pkcache, pkversion ".colorize
205
206
  end
206
207
  }
207
208
  bot.start
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Botemon
21
21
  def self.version
22
- '0.5.6.2'
22
+ '0.5.7'
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.5.6.2
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cinch-colorize
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'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: smogon
71
85
  requirement: !ruby/object:Gem::Requirement