ruboty-kokodeikku 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -0
- data/lib/ruboty/handlers/kokodeikku.rb +8 -3
- data/lib/ruboty/kokodeikku/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df8e71edfbb330b8354c06ea3e837f02d4604643
|
4
|
+
data.tar.gz: 880556d5c31121bb7f0340a55ef8005ba4e9972b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b34a9a3de20f750001af16096097c510feabda88dc42818ce754f8cc39f34a8897d305b6a22c4fb951426565400aac8953f77cca9d25dda54014aa0df88737f
|
7
|
+
data.tar.gz: 4798a47497433548adf9a2fdccd0be523c9a351521828fbf6e5a44897206065bd2ed4698bc246835b81c9956bb2e110b2895eca9b916af76da1be8d2c27c459b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,9 @@ module Ruboty
|
|
6
6
|
class Kokodeikku < Base
|
7
7
|
env 'KOKODEIKKU_CHANNEL', "if specified, kokodeikku will be enabled only on the specified channels (separated by comma)", optional: true
|
8
8
|
|
9
|
-
|
9
|
+
DEFAULT_PREFIX = "ここで一句"
|
10
10
|
|
11
|
+
env :KOKODEIKKU_PREFIX, 'Pass optional prefix message (default: ここで一句)', optional: true
|
11
12
|
env :KOKODEIKKU_RULE, 'Pass optional song rule (default: "5,7,5")', optional: true
|
12
13
|
|
13
14
|
on(
|
@@ -20,8 +21,8 @@ module Ruboty
|
|
20
21
|
def kokodeikku(message)
|
21
22
|
return if channels && !channels.include?(message.to)
|
22
23
|
|
23
|
-
if message.from != robot.name && !message.body.start_with?(
|
24
|
-
message.reply("#{
|
24
|
+
if message.from != robot.name && !message.body.start_with?("#{prefix} ") && (song = reviewer.find(message.body))
|
25
|
+
message.reply("#{prefix} #{song.phrases.map(&:join).join(' ')}")
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -35,6 +36,10 @@ module Ruboty
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
39
|
+
def prefix
|
40
|
+
ENV["KOKODEIKKU_PREFIX"] || DEFAULT_PREFIX
|
41
|
+
end
|
42
|
+
|
38
43
|
def reviewer
|
39
44
|
@reviewer ||= Ikku::Reviewer.new(rule: rule)
|
40
45
|
end
|