botemon 0.5.4.2 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c41d91421cfba1635a7477401852786c04c25a2f
4
- data.tar.gz: e5dd127b10dbf8983bcd1b26be612f8b2f0777f6
3
+ metadata.gz: f2d667948ffa1014e3e6571c89908931a248e566
4
+ data.tar.gz: 957e69a5bbd5138e4bd68f8a3bfa8ec07016c00f
5
5
  SHA512:
6
- metadata.gz: 4255fb64868d7a4c6c13d06a1b39a55cf99b1b6c77618675b40ad68025c39438f91a59d5014afd47f350e2d5c460e4a8caf966de972bcf610cf52cf036c503b3
7
- data.tar.gz: 14d8bcf0cee5330d5c53b0743990e1d332e3e2708af540a56d43af00743e5907c3e4c968acfeeecc7e3c40f55ae9e28236beb5ff524cd225dee9ab27ba508539
6
+ metadata.gz: 58e65bab3c4d97d3e548a2ced8f26afb600d8cff53758273cc76060ec7d583aafb98e02a9b4537e0e8a3b81c95f488459eb9b07510d50089948a8dbb033594fe
7
+ data.tar.gz: bfff0fb5e3c046e203abdbc31a198c9bed3ba5617f6ed70a00f1bb2939a2de7d0c922fb8a2aed3659e05686289f601341bd6ae744722f587ea70ad15ae731059
@@ -20,26 +20,28 @@
20
20
  #++
21
21
 
22
22
  require 'botemon'
23
+ require 'open-uri'
23
24
 
24
- abort 'Usage: botemon <bot_name> <bot_password> <server> <channels>' if ARGV.length < 4
25
+ abort 'Usage: botemon <bot_name> <server> <channels>' if ARGV.length < 3
25
26
 
26
27
  Cinch::Bot.new {
27
28
  configure do |c|
28
29
  c.nick = ARGV[0]
29
30
  c.realname = ARGV[0]
30
31
  c.user = ARGV[0]
31
- c.password = ARGV[1]
32
- c.server = ARGV[2]
33
- c.channels = ARGV.drop(3).map { |c| "\##{c}" }
32
+ c.password = 'dat_password'
33
+ c.server = ARGV[1]
34
+ c.channels = ARGV.drop(2).map { |c| "\##{c}" }
34
35
 
35
36
  c.plugins.plugins = [Cinch::Plugins::Login]
36
- c.plugins.options[Cinch::Plugins::Login] = { :password => ARGV[1] }
37
+ c.plugins.options[Cinch::Plugins::Login] = { :password => 'dat_password' }
37
38
 
38
39
  @storage = Storage.new './cache.db'
39
40
  @pokemon_trivia = nil
40
41
  @players = []
41
42
  @trivia_owner = ''
42
43
  @trivia_wrong = 0
44
+ @bot_admin = [ 'mirkosp', 'RoxasShadowRS' ]
43
45
  end
44
46
 
45
47
  on :message, /^pkmn (.+)/ do |m, name|
@@ -81,7 +83,7 @@ Cinch::Bot.new {
81
83
  end
82
84
  end
83
85
 
84
- on :message, /^pstats (.+) (.+) (.+) (.+)/ do |m, name, level, nature, evs|
86
+ on :message, /^pstats (\S*) (\S*) (\S*) (.*)/ do |m, name, level, nature, evs|
85
87
  @storage = Storage.new('./cache.db') unless @storage
86
88
 
87
89
  name = Smogon::Pokemon.id2name(name) if name.numeric?
@@ -89,13 +91,13 @@ Cinch::Bot.new {
89
91
 
90
92
  hidden_values = evs.strip.split
91
93
  if hidden_values.length == 2
92
- evs = hidden_values[0].strip.split ?/
93
- ivs = hidden_values[1].strip.split ?/
94
+ evs = hidden_values[0].split ?/
95
+ ivs = hidden_values[1].split ?/
94
96
  else
95
- evs = evs.strip.split ?/
97
+ evs = evs.split ?/
96
98
  ivs = '31/31/31/31/31/31'.split ?/
97
99
  end
98
-
100
+
99
101
  m.reply "#{pokemon.name}: (#{pokemon.types.join(?-)}) #{pokemon.stats(level.to_i, nature, evs, ivs).join(?/)}"
100
102
  end
101
103
 
@@ -110,7 +112,7 @@ Cinch::Bot.new {
110
112
  @storage = Storage.new('./cache.db') unless @storage
111
113
 
112
114
  if @pokemon_trivia != nil
113
- m.reply Format(:red, 'Other players are playing, wait until they finish.')
115
+ m.reply Format(:red, 'Other players are playing, please wait until they finish.')
114
116
  m.reply Format(:red, @pokemon_trivia.clues)
115
117
  else
116
118
  @pokemon_trivia = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)).delete(?'), @storage
@@ -137,7 +139,7 @@ Cinch::Bot.new {
137
139
  m.reply Format(:red, "Nope, #{m.user.nick} was wrong.")
138
140
  @trivia_wrong += 1
139
141
  if @trivia_wrong >= 3
140
- m.reply Format(:red, "No more chances. The secret Pokémon is #{@pokemon_trivia.name}!")
142
+ m.reply Format(:red, "You have no more chances. The secret Pokémon is #{@pokemon_trivia.name}!")
141
143
  @pokemon_trivia = nil
142
144
  @trivia_wrong = 0
143
145
  end
@@ -145,25 +147,26 @@ Cinch::Bot.new {
145
147
  end
146
148
 
147
149
  on :message, /^pkstop$/ do |m|
148
- if @pokemon_trivia != nil && (m.user.nick == 'mirkosp' || m.user.nick == 'RoxasShadowRS' || m.user.nick == @trivia_owner)
150
+ if @pokemon_trivia != nil && (@bot_admin.include?(m.user.nick) || m.user.nick == @trivia_owner)
149
151
  @pokemon_trivia = nil
150
152
  @trivia_owner = ''
151
153
  @trivia_wrong = 0
152
154
  m.reply Format(:red, "Game aborted by #{m.user.nick}.")
153
155
  elsif @pokemon_trivia == nil
154
- m.reply Format(:red, 'Game not started.')
156
+ m.reply Format(:red, 'Game not started yet.')
155
157
  else
156
- m.reply Format(:red, "Only ops and the game luncher can stop the game. #{m.user.nick} GTFO.")
158
+ m.reply Format(:red, "Only channel operators and the game luncher can stop the game. #{m.user.nick} GTFO.")
157
159
  end
158
160
  end
159
161
 
160
162
  on :message, /^pkdebug$/ do |m|
161
163
  if @pokemon_trivia == nil
162
164
  m.reply Format(:red, 'Game not started.')
163
- elsif m.user.nick == 'mirkosp' || m.user.nick == 'RoxasShadowRS'
165
+ elsif @bot_admin.include?(m.user.nick)
164
166
  m.reply Format(:red, @pokemon_trivia.name)
165
167
  else
166
- m.reply Format(:red, "GO TO DIG THE EARTH #{m.user.nick} ヽ(`Д´)ノ ┻━┻")
168
+ proverbs = open('http://pastebin.com/raw.php?i=qWF65TcP').read.each_line.to_a.sample.strip
169
+ m.reply Format(:red, proverbs)
167
170
  end
168
171
  end
169
172
 
@@ -179,7 +182,8 @@ Cinch::Bot.new {
179
182
 
180
183
  m.reply Format(:red, 'Cache created.')
181
184
  else
182
- m.reply Format(:red, "Only ops can create the cache. #{m.user.nick} GTFO.")
185
+ proverbs = open('http://pastebin.com/raw.php?i=qWF65TcP').read.each_line.to_a.sample.strip
186
+ m.reply Format(:red, proverbs)
183
187
  end
184
188
  end
185
189
 
@@ -189,10 +193,15 @@ Cinch::Bot.new {
189
193
  end
190
194
 
191
195
  on :message, /^pkhelp$/ do |m|
192
- m.reply Format(:red, "- pkmn Bulbasaur / 1 ")
193
- m.reply Format(:red, "- ability Synchronize ")
194
- m.reply Format(:red, "- move Reflect ")
195
- m.reply Format(:red, "- moveset Bulbasaur LC (BW) ")
196
- m.reply Format(:red, "- pkrandom, pktrivia, pkstop, pkversion ")
196
+ m.reply Format(:red, "- pkmn Bulbasaur ")
197
+ m.reply Format(:red, "- pkmn 1 ")
198
+ m.reply Format(:red, "- ability Synchronize ")
199
+ m.reply Format(:red, "- item Leftovers ")
200
+ m.reply Format(:red, "- move Reflect ")
201
+ m.reply Format(:red, "- moveset Bulbasaur LC ")
202
+ m.reply Format(:red, "- moveset Bulbasaur LC DP ")
203
+ m.reply Format(:red, "- pstats Scizor 70 Adamant 0/252/0/0/6/252 15/31/30/2/31/31 ")
204
+ m.reply Format(:red, "- pstats Scizor 70 Adamant 0/252/0/0/6/252 ")
205
+ m.reply Format(:red, "- pkrandom, pktrivia, pkdebug, pkstop, pkcache, pkversion ")
197
206
  end
198
207
  }.start
@@ -42,6 +42,7 @@ class Storage
42
42
  alias :dump :get_all
43
43
 
44
44
  def add(pokemon)
45
+ return unless pokemon
45
46
  @db << pokemon unless is_cached?(pokemon.name)
46
47
  end
47
48
  alias :put :add
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Botemon
21
21
  def self.version
22
- '0.5.4.2'
22
+ '0.5.5'
23
23
  end
24
24
  end
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.5.4.2
4
+ version: 0.5.5
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-16 00:00:00.000000000 Z
11
+ date: 2013-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri