meimei 0.1.2 → 0.3.0

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.
Files changed (54) hide show
  1. data/.document +5 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +20 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +40 -9
  7. data/VERSION +1 -0
  8. data/cron.sh +8 -0
  9. data/lib/meimei/client.rb +18 -8
  10. data/lib/meimei.rb +0 -25
  11. data/plugins/an2.rb +5 -0
  12. data/plugins/ann.rb +47 -0
  13. data/plugins/autoping.rb +5 -0
  14. data/plugins/cco.rb +4 -0
  15. data/plugins/choose.rb +13 -0
  16. data/plugins/courage.rb +7 -0
  17. data/plugins/dan.rb +13 -0
  18. data/plugins/dg.rb +25 -0
  19. data/plugins/dwiki.rb +6 -0
  20. data/plugins/eta.rb +43 -0
  21. data/plugins/g.rb +30 -0
  22. data/plugins/gc.rb +34 -0
  23. data/plugins/godfinger.rb +9 -0
  24. data/plugins/hammerhell.rb +7 -0
  25. data/plugins/hanase.rb +14 -0
  26. data/plugins/hellheaven.rb +6 -0
  27. data/plugins/help.rb +7 -0
  28. data/plugins/jtime.rb +9 -0
  29. data/plugins/nai_ja_nai.rb +4 -0
  30. data/plugins/note.rb +10 -0
  31. data/plugins/ranking.rb +422 -0
  32. data/plugins/reload.rb +3 -0
  33. data/plugins/retard.rb +4 -0
  34. data/plugins/rs.rb +8 -0
  35. data/plugins/shiningfinger.rb +9 -0
  36. data/plugins/shuffle.rb +3 -0
  37. data/plugins/sugei_inaka.rb +4 -0
  38. data/plugins/suki_dakara.rb +4 -0
  39. data/plugins/ts.rb +25 -0
  40. data/plugins/tsundere.rb +5 -0
  41. data/plugins/tt.rb +50 -0
  42. data/plugins/ttt.rb +5 -0
  43. data/plugins/uptime.rb +20 -0
  44. data/plugins/wawawa.rb +5 -0
  45. data/plugins/weather.rb +39 -0
  46. data/test/helper.rb +18 -0
  47. data/test/test_meimei.rb +7 -0
  48. metadata +139 -56
  49. data/CHANGES +0 -10
  50. data/LICENSE +0 -31
  51. data/README +0 -30
  52. data/lib/meimei/gemspec.rb +0 -45
  53. data/lib/meimei/specification.rb +0 -128
  54. data/lib/meimei/version.rb +0 -18
@@ -0,0 +1,422 @@
1
+ define_plugin("!ranking") do |msg|
2
+ reply "No more rankings until the corporatocracy is overthrown in the United States of America."
3
+ if false
4
+
5
+ blue = "\00311"
6
+ red = "\00307"
7
+ normal = "\00316"
8
+
9
+ imouto = "sora
10
+ kirino
11
+ ui
12
+ nazuna
13
+ kotomi
14
+ satsuki
15
+ erika
16
+ mikan
17
+ kurokoneko
18
+ miya
19
+ chika
20
+ itsuki
21
+ imouto-san"
22
+
23
+ rankers = "evirus
24
+ albert
25
+ divine
26
+ nakar
27
+ halotron
28
+ cortana"
29
+
30
+ rankings = "anime 2k10
31
+ music 2k10
32
+ imouto
33
+ music 2k9
34
+ touhou
35
+ anime 2k11
36
+ eromanga 2k9
37
+ eromanga all
38
+ artists
39
+ games
40
+ rankers"
41
+
42
+ artists = "naruko hanaharu
43
+ happoubi jin
44
+ hijiri rei
45
+ misaki kurehito
46
+ kuroya shinobu
47
+ inoue kiyoshirou
48
+ nekoi mie
49
+ sameda koban
50
+ yamatogawa
51
+ shiwasu no okina
52
+ gumma
53
+ ino
54
+ nishieda
55
+ nakajima yuka
56
+ royal koyonagi
57
+ ishikei
58
+ takamichi
59
+ toshiaki kaneko
60
+ takemura sesshu
61
+ cuvie
62
+ inuburo
63
+ inazuma
64
+ bolze
65
+ inu
66
+ amano ameno
67
+ bosshi
68
+ raita
69
+ jingrock
70
+ kizuki aruchu
71
+ otsuka kotora
72
+ da hootch
73
+ sanbun kyouden
74
+ tsukino jyogi
75
+ bow ditama"
76
+
77
+ music_2010 = "basia bulat - heart of my own
78
+ zola jesus - stridulum
79
+ tallest man on earth - wild hunt
80
+ yeasayer - odd blood
81
+ beach house - teen dream
82
+ ra ra riot - the orchard
83
+ the-dream - love king
84
+ sound horizon - marchen
85
+ girl talk - all day
86
+ first aid kit - big black & the blue
87
+ band of horses - infinite arms
88
+ broken social scene - forgiveness rock record
89
+ das racist - sit down man
90
+ dessa - badly broken code
91
+ of montreal - false priest
92
+ el ten eleven - still like a secret
93
+ titus andronicus - monitor
94
+ joanna newsom - have one on me
95
+ janelle monae - archandroid
96
+ robyn - body talk
97
+ drake - thank me later
98
+ corinne bailey rae - the sea
99
+ arcade fire - the suburbs
100
+ black keys - brothers
101
+ vampire weekend - contra
102
+ big boi - sir lucious left foot
103
+ matthew dear - black city
104
+ holy fuck - latin
105
+ four tet - there is love
106
+ ariel pink - before today
107
+ hot chip - one life stand
108
+ erykah badu - new amerykah part two
109
+ twin shadow - forget
110
+ sade - soldier of love
111
+ jenny and johnny - i'm having fun now
112
+ lcd soundsystem - this is happening
113
+ walkmen - lisbon
114
+ girls - broken dreams club
115
+ kid cudi - man on the moon ii
116
+ rick ross - teflon don
117
+ spoon - transference
118
+ abe vigoda - crush
119
+ midlake - courage of others
120
+ halcali - tokyo groove
121
+ fresh and onlys - play it strange
122
+ delorean - subiza
123
+ magnetic fields - realism
124
+ blitzen trapper - destroyer of the void
125
+ deerhunter - halcyon digest
126
+ ted leo - brutalist bricks
127
+ broken bells - broken bells
128
+ mountain man - made the harbor
129
+ no age - everything in between
130
+ emeralds - does it look like i'm here
131
+ pernice brothers - goodbye killer
132
+ los campesinos - romance is boring
133
+ kylesa - spiral shadow
134
+ miniature tigers - forest
135
+ antony & the johnsons - swanlights
136
+ avey tare - down there
137
+ tyler the creator - bastard
138
+ belle & sebastian - write about love
139
+ forest swords - dagger paths
140
+ teddybears - devil's music
141
+ new pornographers - together
142
+ best coast - best coast"
143
+
144
+ music_2009 = "neko case - middle cyclone
145
+ grizzly bear - veckatimest
146
+ phoenix - wolfgang amadeus mozart
147
+ avett brothers - i and love and you
148
+ animal collective - merriweather
149
+ the xx - xx
150
+ dj quick & kurupt - blaqkout
151
+ bear in heaven - beast rest
152
+ wild beasts - two dancers
153
+ telekinesis - telekinesis
154
+ antlers - hospice
155
+ kid cudi - man on the moon
156
+ atlas sound - logos
157
+ data - skywriter
158
+ raekwon - only built 4 cuban linx pt ii
159
+ future of the left - travels
160
+ jj - jj no 2
161
+ mf doom - born like this
162
+ clientele - bonfires
163
+ fever ray - fever ray
164
+ neon indian - psychic chasms
165
+ taken by trees - east of eden
166
+ girls - album
167
+ place to bury strangers - exploding head
168
+ mount eerie - wind's poem
169
+ antony - crying light
170
+ bill callahan - sometimes i wish
171
+ dirty projectors - bitte orca
172
+ camera obscura - my maudlin career
173
+ yo la tengo - popular songs"
174
+
175
+ anime_2011 = "#{blue}level e
176
+ #{blue}madoka magica
177
+ #{blue}yumekui merry
178
+ #{blue}mitsudomoe 2
179
+ #{blue}fractale
180
+ #{blue}star driver
181
+ #{normal}-- MANABI LINE --
182
+ #{blue}toaru majutsu no index 2
183
+ #{blue}gosick
184
+ #{blue}kore wa zombie
185
+ #{blue}infinite stratos
186
+ #{blue}cardfight vanguard
187
+ #{normal}-- FUCKIN DROPPED --
188
+ #{blue}rio rainbow gate
189
+ #{blue}oniichan no koto
190
+ #{blue}freezing
191
+ #{blue}hourou musuko
192
+ #{blue}dragon crisis"
193
+
194
+ anime_2010 = "k-on!!
195
+ ore no imouto
196
+ break blade
197
+ seitokai yakuin domo
198
+ seikon no qwaser
199
+ shinryaku ika musume
200
+ tatami galaxy
201
+ baka to test
202
+ milky holmes
203
+ yosuga no sora
204
+ shiki
205
+ panty & stocking
206
+ otome youkai zakuro
207
+ kuragehime*
208
+ sora no otoshimono forte
209
+ soredemo machi*
210
+ star driver
211
+ strike witches 2
212
+ shin koihime musou otome tairan
213
+ amagami ss
214
+ durarara
215
+ railgun
216
+ golgo 13
217
+ cobra
218
+ saraiya goyou
219
+ fortune arterial
220
+ highschool of the dead
221
+ hanamaru youchien
222
+ mitsudomoe
223
+ asobi ni iku yo
224
+ sora no woto
225
+ kuroshitsuji ii
226
+ toaru majutsu no index ii
227
+ hidamari sketch 3
228
+ shukufuku no campanella
229
+ giant killing
230
+ working!!
231
+ katanagatari
232
+ heartcatch precure
233
+ bakuman
234
+ rainbow
235
+ super robot wars og the inspector
236
+ arakawa under the bridge
237
+ b gata h kei
238
+ ichiban ushiro no daimaou
239
+ ookami-san to shichinin
240
+ chu-bra
241
+ angel beats
242
+ ladies versus butlers
243
+ mm!
244
+ motto toloveru
245
+ vampire bund
246
+ densetsu no yuusha
247
+ heroman
248
+ ikkitousen xx
249
+ seikimatsu occult gakuin
250
+ ookami kakushi"
251
+
252
+ touhou = "sanae
253
+ yukari
254
+ hisou tensoku
255
+ yuyuko
256
+ kanako
257
+ flandre
258
+ tenko
259
+ kaguya
260
+ eirin
261
+ patche
262
+ reisen
263
+ suika
264
+ suwako
265
+ alice
266
+ sakuya
267
+ kogasa
268
+ tewi
269
+ byakuren
270
+ reimu
271
+ nue
272
+ remilia
273
+ marisa
274
+ satori
275
+ shikieiki
276
+ koishi
277
+ daiyousei
278
+ cirno
279
+ mokou
280
+ keine
281
+ akyu
282
+ utsuho
283
+ aya
284
+ mima
285
+ star
286
+ luna
287
+ sunny
288
+ momiji
289
+ yuka
290
+ meiling
291
+ iku
292
+ elly
293
+ yumeko
294
+ rumia
295
+ youmu
296
+ hina
297
+ hatate
298
+ nazrin
299
+ chiyuri
300
+ minoriko
301
+ shizuha
302
+ yugi
303
+ yorihime
304
+ toyohime
305
+ komachi
306
+ murasa
307
+ mystia
308
+ koakuma
309
+ nitori
310
+ orin
311
+ rinnosuke
312
+ unzan
313
+ ran
314
+ myon
315
+ yamame
316
+ wriggle
317
+ chen
318
+ medicine
319
+ shinki
320
+ rikako
321
+ lily white
322
+ reisen ii
323
+ parsee
324
+ ichirin
325
+ lily black
326
+ letty
327
+ shou
328
+ tokiko
329
+ lunasa
330
+ merlin
331
+ lyrica
332
+ kisume
333
+ namazu
334
+ buront"
335
+
336
+ eromanga_2009 = "yamatogawa - tayutayu
337
+ shiwasu no okina - jc ecchi
338
+ f4u - konya no sikorsky
339
+ maguro teikoku - island ingyaku no shou
340
+ arima zin - muchipuri"
341
+
342
+ eromanga_all = "yukimi - birthday
343
+ hanaharu - shoujo material
344
+ yamatogawa - tayutayu
345
+ gumma - giri giri sisters
346
+ maruta - kimi no suki na onnanoko no katachi
347
+ sameda koban - beastie girls
348
+ f4u - konya no sikorsky
349
+ inuburo - inumimi zukan
350
+ maguro teikoku - island ingyaku no shou
351
+ nylon - nylon 100%
352
+ cuvie - hoshigari
353
+ inu - hatsu inu
354
+ sekiya asami - your dog
355
+ koume keito - pollinic girls
356
+ arima zin - muchipuri"
357
+
358
+ case msg
359
+ when /imouto/
360
+ s = imouto
361
+
362
+ when /anime 2k10/, /anime 2010/
363
+ s = anime_2010
364
+
365
+ when /anime 2k11/, /anime 2011/, /anime/
366
+ s = anime_2011
367
+
368
+ when /touhou/
369
+ s = touhou
370
+
371
+ when /eromanga all/
372
+ s = eromanga_all
373
+
374
+ when /eromanga 2k9/
375
+ s = eromanga_2009
376
+
377
+ when /music 2k10/, /music 2010/
378
+ s = music_2010
379
+
380
+ when /music 2k9/, /music 2009/
381
+ s = music_2009
382
+
383
+ when /rankers/
384
+ s = rankers
385
+
386
+ when /rankings/
387
+ s = rankings
388
+
389
+ when /artists/
390
+ s = artists
391
+
392
+ else
393
+ s = rankings
394
+ end
395
+
396
+ s = s.split(/\n/)
397
+ lines = []
398
+ line = ""
399
+
400
+ while true
401
+ x = s.shift
402
+
403
+ if x.nil?
404
+ lines << line unless line == ""
405
+ break
406
+ else
407
+ line << "#{x} > "
408
+ if line.size > 400
409
+ lines << line
410
+ line = ""
411
+ end
412
+ end
413
+ end
414
+
415
+ lines[-1].gsub!(/ > $/, "")
416
+
417
+ lines.each do |l|
418
+ reply l
419
+ sleep 1
420
+ end
421
+ end
422
+ end
data/plugins/reload.rb ADDED
@@ -0,0 +1,3 @@
1
+ define_plugin("!reload") do |msg|
2
+ load_plugins()
3
+ end
data/plugins/retard.rb ADDED
@@ -0,0 +1,4 @@
1
+ define_plugin("retard") do |msg|
2
+ next unless msg =~ /^you're a retard, (.+)$/i
3
+ reply "Marude hakuchi da na, #{$1}-san.", false
4
+ end
data/plugins/rs.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'timeout'
2
+ require 'net/http'
3
+ require 'cgi'
4
+
5
+ define_plugin("!rs") do |msg|
6
+ query = msg
7
+ reply "http://rs.4chan.org/?s=" + URI.escape(query, /[^a-zA-Z0-9_-]/)
8
+ end
@@ -0,0 +1,9 @@
1
+ define_plugin("shining finger") do |msg|
2
+ next unless msg =~ /ore no kono te ga hikatte unaru/i
3
+
4
+ reply "Omae o taose to kagayaki sakebu!", false
5
+ sleep 1
6
+ reply "HISSATSU!", false
7
+ sleep 1
8
+ reply "SHIIIIIINNNIIIIIIIINNNNNGGGGG FIIIIINNNNNGGGAAAAAAAA!!!!!!!", false
9
+ end
@@ -0,0 +1,3 @@
1
+ define_plugin("!shuffle") do |msg|
2
+ reply msg.split(/,\s*/).sort {rand <=> rand}.join(", ")
3
+ end
@@ -0,0 +1,4 @@
1
+ define_plugin("sugei inaka") do |msg|
2
+ next unless msg =~ /\bsugei inaka\b/i
3
+ reply "sugei~", false
4
+ end
@@ -0,0 +1,4 @@
1
+ define_plugin("suki dakara") do |msg|
2
+ next unless msg =~ /^(.+?) suki dakara$/ && @current_from != "meimei"
3
+ reply "KONO #{$1.upcase.strip} GA SUKI DAKARA!!!", false
4
+ end
data/plugins/ts.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'cgi'
2
+ require 'rubygems'
3
+ require 'json'
4
+
5
+ define_plugin("!ts") do |msg|
6
+ Net::HTTP.start("search.twitter.com", 80) do |http|
7
+ resp = http.get("/search.json?rpp=3&q=" + CGI.escape(msg), {"User-Agent" => "meimei"})
8
+
9
+ if resp.content_type == "application/json"
10
+ results = JSON.parse(resp.body)["results"].map {|x|
11
+ x["from_user"] + ": " + CGI.unescapeHTML(x["text"])
12
+ }
13
+
14
+ if results.empty?
15
+ reply "No matches"
16
+ else
17
+ results[0, 3].each do |result|
18
+ reply result
19
+ end
20
+ end
21
+ else
22
+ reply "Twitter is overloaded"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ define_plugin("tsundere") do |msg|
2
+ next unless msg =~ /don'?t get the wrong idea/i
3
+ next unless msg =~ /it'?s not like/i
4
+ reply "so tsundere <3"
5
+ end
data/plugins/tt.rb ADDED
@@ -0,0 +1,50 @@
1
+ require 'timeout'
2
+ require 'net/http'
3
+ require 'cgi'
4
+
5
+ define_plugin("!tt") do |msg|
6
+ begin
7
+ query = msg
8
+
9
+ if query =~ /^(anime|hentai|raw|music|manga|drama)/i
10
+ type = $1.capitalize
11
+ query = query.gsub(/^\S+ /, "")
12
+ else
13
+ type = nil
14
+ end
15
+
16
+ re_query = Regexp.new(Regexp.escape(query).gsub(/\\ /, ".+?"), Regexp::IGNORECASE)
17
+ cgi_query = query.gsub(/ /, "+")
18
+ Net::HTTP.start("www.tokyotosho.info", 80) do |http|
19
+ resp = http.post("/search.php", "terms=#{cgi_query}")
20
+ results = resp.body[/<table class="listing">(.+?)<\/table>/m, 1]
21
+ rows = results.scan(/<tr.+?<\/tr>/m)
22
+ matches = []
23
+ if rows.any?
24
+ rows[1..-1].each do |row|
25
+ if type == nil || row =~ /alt="#{type}"/
26
+ row =~ /<a rel="nofollow" type="application\/x-bittorrent" href="(.+?)">(.+?)<\/a>/
27
+ url = CGI.unescapeHTML($1.to_s)
28
+ desc = $2.to_s
29
+
30
+ if desc =~ re_query
31
+ matches << [desc, url]
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ if matches.any?
38
+ matches[0, 3].each do |m|
39
+ reply "\00311#{m[0]}: \00307#{m[1]}"
40
+ end
41
+ else
42
+ reply "No matches for #{query}"
43
+ end
44
+ end
45
+ rescue Timeout::Error
46
+ reply "time out"
47
+ rescue Exception => e
48
+ reply e.to_s
49
+ end
50
+ end
data/plugins/ttt.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'cgi'
2
+
3
+ define_plugin("!ttt") do |msg|
4
+ reply "http://www.tokyotosho.info/search.php?terms=" + CGI.escape(msg)
5
+ end
data/plugins/uptime.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require 'net/ssh'
3
+
4
+ define_plugin("!uptime") do |msg|
5
+ sonohara = `uptime`.strip
6
+ hijiribe = nil
7
+ dbserver = nil
8
+
9
+ Net::SSH.start("hijiribe", "albert") do |ssh|
10
+ hijiribe = ssh.exec!("uptime").strip
11
+ end
12
+
13
+ Net::SSH.start("dbserver", "albert") do |ssh|
14
+ dbserver = ssh.exec!("uptime").strip
15
+ end
16
+
17
+ reply "sonohara: #{sonohara}"
18
+ reply "hijiribe: #{hijiribe}"
19
+ reply "dbserver: #{dbserver}"
20
+ end
data/plugins/wawawa.rb ADDED
@@ -0,0 +1,5 @@
1
+ define_plugin("wawawa") do |msg|
2
+ if msg =~ /\bWA\s*WA\s*WA\b/i
3
+ reply "wasuremono~", false
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ define_plugin("!weather") do |msg|
2
+ query = msg
3
+
4
+ if query.any?
5
+ begin
6
+ Net::HTTP.start("www.google.com", 80) do |http|
7
+ resp = http.get("/search?num=1&q=weather+for+" + URI.escape(query, /[^a-zA-Z0-9]/))
8
+ if resp.body =~ /<table class="ts std">.+?<b>Weather<\/b> for <b>(.+?)<\/b>/m
9
+
10
+ result = "Weather for " + $1 + ": "
11
+
12
+ if resp.body =~ />Current: <b>(.+?)</m
13
+ result = result + $1 + ", "
14
+ end
15
+
16
+ if resp.body =~ /<div style="font-size:140%"><b>(.+?)<\/b>/m
17
+ result = result + $1 + ", "
18
+ end
19
+
20
+ if resp.body =~ />(Wind: .+?)</m
21
+ result = result + $1 + ", "
22
+ end
23
+
24
+ if resp.body =~ />(Humidity: .+?)</m
25
+ result = result + $1
26
+ end
27
+
28
+ reply result
29
+ else
30
+ reply "Google doesn't seem to know"
31
+ end
32
+ end
33
+ rescue Timeout
34
+ reply "timeout"
35
+ rescue Exception => e
36
+ reply e.to_s
37
+ end
38
+ end
39
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'meimei'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestMeimei < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end