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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 744584cebd84178ed8a311a5167e3308709bd03f
4
- data.tar.gz: c7a7d1826bd808b4a75c705ccd01251d7da8eee7
3
+ metadata.gz: df8e71edfbb330b8354c06ea3e837f02d4604643
4
+ data.tar.gz: 880556d5c31121bb7f0340a55ef8005ba4e9972b
5
5
  SHA512:
6
- metadata.gz: fc68893be40b92145c1b3815c880f7b03e851278ca929a4acd4a742a2d0aa6534bfe6c58928864f45e10b58538599e3d2ba7f9c4a3ecad39a8d15722b4970c6d
7
- data.tar.gz: 4f732f0f92ac70f00f60404d15dcb391f28713a106c884b90eb0347cb7ea9980325afa25e9494a3ea8dc2779f2b8bf80749d1cd4bc3a9b7f33d45c89d8e90ba7
6
+ metadata.gz: 9b34a9a3de20f750001af16096097c510feabda88dc42818ce754f8cc39f34a8897d305b6a22c4fb951426565400aac8953f77cca9d25dda54014aa0df88737f
7
+ data.tar.gz: 4798a47497433548adf9a2fdccd0be523c9a351521828fbf6e5a44897206065bd2ed4698bc246835b81c9956bb2e110b2895eca9b916af76da1be8d2c27c459b
@@ -1,3 +1,6 @@
1
+ ## 0.0.8
2
+ - Add KOKODEIKKU_PREFIX to change prefix message
3
+
1
4
  ## 0.0.7
2
5
  - Add KOKODEIKKU_RULE to change song rule
3
6
 
data/README.md CHANGED
@@ -16,5 +16,6 @@ heroku config:set \
16
16
  ## ENV
17
17
  ```
18
18
  KOKODEIKKU_CHANNEL - Pass comma-separated names to specify channels (optional)
19
+ KOKODEIKKU_PREFIX - Pass optional prefix message (default: `"ここで一句"`)
19
20
  KOKODEIKKU_RULE - Pass optional song rule (default: `"5,7,5"`)
20
21
  ```
@@ -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
- PREFIX = "ここで一句 "
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?(PREFIX) && (song = reviewer.find(message.body))
24
- message.reply("#{PREFIX}#{song.phrases.map(&:join).join(' ')}")
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
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Kokodeikku
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-kokodeikku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura