lita-pebbles 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/config/meigens.json +1 -0
- data/lib/lita/handlers/kansai.rb +29 -0
- data/lib/lita/handlers/misawa.rb +22 -0
- data/lib/lita/handlers/omikuji.rb +32 -0
- data/lib/lita/handlers/pebbles.rb +35 -0
- data/lib/lita/pebbles/version.rb +5 -0
- data/lib/lita-pebbles.rb +5 -0
- data/lita-pebbles.gemspec +30 -0
- metadata +142 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
module Lita
|
2
|
+
module Handlers
|
3
|
+
class Kansai < Handler
|
4
|
+
route /(.+)やろか(?:?|\?)*?$/, :seyaroka, command: false
|
5
|
+
route /(.+)やで(?:?|\?)*?$/, :seyade, command: false
|
6
|
+
route /(.+)やな(?:?|\?)*?$/, :seyana, command: false
|
7
|
+
|
8
|
+
def seyaroka(response)
|
9
|
+
return if rand(2) == 0
|
10
|
+
message = ['せやで', 'せやな', 'せやせや', 'ちゃうんちゃう?', 'ちゃうで'].sample
|
11
|
+
response.reply message
|
12
|
+
end
|
13
|
+
|
14
|
+
def seyade(response)
|
15
|
+
return if rand(2) == 0
|
16
|
+
message = ['せやろか', 'せやな', 'せやせや'].sample
|
17
|
+
response.reply message
|
18
|
+
end
|
19
|
+
|
20
|
+
def seyana(response)
|
21
|
+
return if rand(2) == 0
|
22
|
+
message = ['せやろか', 'せやな', 'せやせや'].sample
|
23
|
+
response.reply message
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
Lita.register_handler(Kansai)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Lita
|
4
|
+
module Handlers
|
5
|
+
class Misawa < Handler
|
6
|
+
route /^misawa/, :misawa, command: false
|
7
|
+
def misawa(response)
|
8
|
+
response.reply meigens.sample['image']
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def meigens
|
14
|
+
return @meigens if @meigens
|
15
|
+
spec = Gem::Specification.find_by_name("lita-pebbles")
|
16
|
+
meigens_json = File.join(spec.gem_dir, 'config', 'meigens.json')
|
17
|
+
@meigens = JSON.parse(File.open(meigens_json).read)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
Lita.register_handler(Misawa)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Lita
|
2
|
+
module Handlers
|
3
|
+
class Omikuji < Handler
|
4
|
+
LOTS = {
|
5
|
+
'大吉' => %w(万事好調なり 昇龍のごとし 飛躍の時 良き気運満つ),
|
6
|
+
'吉' => %w(安泰の気運続く 暫く平穏なり),
|
7
|
+
'中吉' => %w(気運上昇の時 可なく不可もなし 満願のきざしあり 好調なるも蔭あり),
|
8
|
+
'小吉' => %w(気運やや下降の時 波乱のきざしあり 気運高まるきざし 飛躍近し 待ちの時期なり),
|
9
|
+
'末吉' => %w(好転のきざしあり やや平穏が続く やや下降のきざし 蔭なくなる 気運切り開く時),
|
10
|
+
'凶' => %w{忍耐の時期なり やや低迷の時 実を結ばぬ時 じっと待つが吉 慎重なるが良し ねな(\ ˘ω˘)},
|
11
|
+
}
|
12
|
+
|
13
|
+
route /^omikuji/, :omikuji, command: false
|
14
|
+
def omikuji(response)
|
15
|
+
seed = Time.now.strftime('%Y%m%d') + response.user.id
|
16
|
+
random = Random.new(seed.to_i)
|
17
|
+
response.reply sample_omikuji(random)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def sample_omikuji(random)
|
23
|
+
lots = LOTS.keys
|
24
|
+
lot = lots[random.rand(lots.length)]
|
25
|
+
messages = LOTS[lot]
|
26
|
+
message = messages[random.rand(messages.length)]
|
27
|
+
[lot, message].join(': ')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
Lita.register_handler(Omikuji)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "lita"
|
2
|
+
require 'flippy'
|
3
|
+
require 'pebbles/suddenly_death_string'
|
4
|
+
|
5
|
+
module Lita
|
6
|
+
module Handlers
|
7
|
+
class Pebbles < Handler
|
8
|
+
route /^sudden\s+(\S.*)+/, :suddenly_death, command: false,
|
9
|
+
help: { "sudden [message]" => "> message <" }
|
10
|
+
def suddenly_death(response)
|
11
|
+
word = response.matches[0][0]
|
12
|
+
response.reply word.to_suddenly_death
|
13
|
+
end
|
14
|
+
|
15
|
+
route /^flip\s(.*)$/, :flip, command: false,
|
16
|
+
help: { "flip [message]" => "əɓɐssəɯ`" }
|
17
|
+
def flip(response)
|
18
|
+
response.reply response.matches[0][0].flip
|
19
|
+
end
|
20
|
+
|
21
|
+
route /((w|w)+)$/, :lol, command: false
|
22
|
+
def lol(response)
|
23
|
+
return if rand(2) == 0
|
24
|
+
response.reply response.matches[0][0]
|
25
|
+
end
|
26
|
+
|
27
|
+
route /\( ?˘ω˘\)\"?/, :suya, command: false # " this comment is workaround for sublime text syntax highlighting
|
28
|
+
def suya(response)
|
29
|
+
return if rand(2) == 0
|
30
|
+
response.reply response.matches[0]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
Lita.register_handler(Pebbles)
|
34
|
+
end
|
35
|
+
end
|
data/lib/lita-pebbles.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lita/pebbles/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lita-pebbles"
|
8
|
+
spec.version = Lita::Pebbles::VERSION
|
9
|
+
spec.authors = ["fukayatsu"]
|
10
|
+
spec.email = ["fukayatsu@gmail.com"]
|
11
|
+
spec.summary = %q{A Lita handlers for fun :)}
|
12
|
+
spec.description = %q{A Lita handlers for fun :)}
|
13
|
+
spec.homepage = "https://github.com/fukayatsu/lita-pebbles"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.metadata = { "lita_plugin_type" => "handler" }
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "lita", ">= 2.0"
|
24
|
+
spec.add_runtime_dependency 'pebbles-suddenly_death_string', '~> 0.0.4'
|
25
|
+
spec.add_runtime_dependency 'flippy', '~> 0.1.2'
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "pry"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-pebbles
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fukayatsu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pebbles-suddenly_death_string
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: flippy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A Lita handlers for fun :)
|
98
|
+
email:
|
99
|
+
- fukayatsu@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- config/meigens.json
|
110
|
+
- lib/lita-pebbles.rb
|
111
|
+
- lib/lita/handlers/kansai.rb
|
112
|
+
- lib/lita/handlers/misawa.rb
|
113
|
+
- lib/lita/handlers/omikuji.rb
|
114
|
+
- lib/lita/handlers/pebbles.rb
|
115
|
+
- lib/lita/pebbles/version.rb
|
116
|
+
- lita-pebbles.gemspec
|
117
|
+
homepage: https://github.com/fukayatsu/lita-pebbles
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata:
|
121
|
+
lita_plugin_type: handler
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.2.2
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: A Lita handlers for fun :)
|
142
|
+
test_files: []
|