ruboty-haiku_wo_yome 0.3.1 → 0.3.2

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: 290cc0098888c2d95b458d1ee86a77183f2fc0df
4
- data.tar.gz: 54710400a219d4452706fd32c16e982c4dd6a879
3
+ metadata.gz: 58c07b5c86a17b3eb436206fccffdb09a34a9af3
4
+ data.tar.gz: 2fdfa0fe3146efc5afa2df42e5c8e0db14885748
5
5
  SHA512:
6
- metadata.gz: 04af8e5e625fdd377f1965063af38ed4cebe9ea6a97307e9f03747bfde1d4d763f67a69432a8c0ebacc0e71298c9672be7080df4ceaf609caac2b7f1ec6893d1
7
- data.tar.gz: 13a10223a4c7258c8011cc970d95adf5e17d3cdd59c54eda97c3188f532b064493e4359a92c7d28779b934cd422cd193cf359bafbc851880b4135a4fe7a25c49
6
+ metadata.gz: 1cd86322100b6afd38cab0e3cdd175d3730df897ad35d7fa86afcd8bc56aa3580748b6fb513a1d26d0ee94fa480dcf01441454851c3dae849b8660bd49e72ab5
7
+ data.tar.gz: bd714462e171cd6ddbed1bf76fee7f09abe16b2e459cd31da98ada1dccc9dc1cd4276c4fd48d94db798b8d6457977aed97b03fd15d0a4c0daa4beda433d4057c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.3.2
2
+
3
+ Add =サン handler
4
+
1
5
  # 0.3.1
2
6
 
3
7
  Cache search result
@@ -56,7 +56,14 @@ module Ruboty
56
56
  end
57
57
 
58
58
  def user_public_messages
59
- search_result = client.search_messages(query: user_name, count: 1000)
59
+ query = nil
60
+ begin
61
+ query = "from:#{user_name}"
62
+ rescue
63
+ query = search_word
64
+ end
65
+ puts query
66
+ search_result = client.search_messages(query: query, count: 1000)
60
67
  return [] if search_result.nil?
61
68
  return [] if search_result['messages'].nil?
62
69
  search_result['messages']['matches']
@@ -68,6 +75,10 @@ module Ruboty
68
75
  name.start_with?('@') ? name : "@#{name}"
69
76
  end
70
77
 
78
+ def search_word
79
+ message[:search_word]
80
+ end
81
+
71
82
  def haiku_reviewer(options = {})
72
83
  rule = options[:rule] || [5, 7, 5]
73
84
  @reviewer ||= Ikku::Reviewer.new(rule: rule)
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module HaikuWoYome
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -5,8 +5,10 @@ module Ruboty
5
5
  class Haiku < Ruboty::Handlers::Base
6
6
  env 'SLACK_TOKEN_FOR_SEARCH', "Slack token for search api (important: bot user can't call search api! require human api key"
7
7
 
8
- on('(?<user_name>.+) ハイクを詠め', name: :haiku_wo_yome, description: 'カイシャクしてやる', all: true)
9
- on('(?<user_name>.+) タンカを詠め', name: :tanka_wo_yome, description: 'カイシャクしてやる', all: true)
8
+ on(/ハイクを詠め\s\@?(?<user_name>\w+)[==]サン/, name: :haiku_wo_yome, description: 'カイシャクしてやる', all: true)
9
+ on(/タンカを詠め\s\@?(?<user_name>\w+)[==]サン/, name: :tanka_wo_yome, description: 'カイシャクしてやる', all: true)
10
+ on(/(?<search_word>.+)\s+ハイクを詠め/, name: :haiku_wo_yome, description: 'カイシャクしてやる', all: true)
11
+ on(/(?<search_word>.+)\s+タンカを詠め/, name: :tanka_wo_yome, description: 'カイシャクしてやる', all: true)
10
12
 
11
13
  def haiku_wo_yome(message)
12
14
  Ruboty::HaikuWoYome::Actions::Haiku.new(message).call
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-haiku_wo_yome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kinoshita.Yasuhiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty