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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ruboty/haiku_wo_yome/actions/haiku.rb +12 -1
- data/lib/ruboty/haiku_wo_yome/version.rb +1 -1
- data/lib/ruboty/handlers/haiku.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c07b5c86a17b3eb436206fccffdb09a34a9af3
|
4
|
+
data.tar.gz: 2fdfa0fe3146efc5afa2df42e5c8e0db14885748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cd86322100b6afd38cab0e3cdd175d3730df897ad35d7fa86afcd8bc56aa3580748b6fb513a1d26d0ee94fa480dcf01441454851c3dae849b8660bd49e72ab5
|
7
|
+
data.tar.gz: bd714462e171cd6ddbed1bf76fee7f09abe16b2e459cd31da98ada1dccc9dc1cd4276c4fd48d94db798b8d6457977aed97b03fd15d0a4c0daa4beda433d4057c
|
data/CHANGELOG.md
CHANGED
@@ -56,7 +56,14 @@ module Ruboty
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def user_public_messages
|
59
|
-
|
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)
|
@@ -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(
|
9
|
-
on(
|
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.
|
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-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|