lita-markov 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/markov.rb +8 -2
- data/lita-markov.gemspec +1 -1
- data/spec/lita/handlers/markov_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81ef40b71792290867abcab42ba5084916de22e4
|
4
|
+
data.tar.gz: df3c14436f0a6a853db6440ace88f5874ddaf62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b1c70d92216f4e7ed5b533558e0ce48e92b9ffe69e87edc5893cf232f924e3dfddd6ccdaa2b528d34ada442ac1ec24afd4460d3225382d1a1db0f0cdbb6d660
|
7
|
+
data.tar.gz: 04e36c2f969b65b745bc969748114cf15243a714f1753ebf955e39507c326a28d4f18743b8d977f96a2a1cadae242d9413d4c92b3424658508f73f1e66bb1025
|
data/lib/lita/handlers/markov.rb
CHANGED
@@ -9,7 +9,7 @@ module Lita::Handlers
|
|
9
9
|
template_root File.expand_path('../../../../templates', __FILE__)
|
10
10
|
|
11
11
|
config :database_url, type: String, required: true
|
12
|
-
|
12
|
+
|
13
13
|
route(/.+/, :ingest, command: false)
|
14
14
|
|
15
15
|
route(/markov (.+)/, :generate, command: true, help: {
|
@@ -40,7 +40,7 @@ module Lita::Handlers
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def generate(chat)
|
43
|
-
name = chat.matches[0][0]
|
43
|
+
name = simplify_name chat.matches[0][0]
|
44
44
|
user = Lita::User.fuzzy_find name
|
45
45
|
|
46
46
|
if user.nil?
|
@@ -120,6 +120,12 @@ module Lita::Handlers
|
|
120
120
|
response.write render_template('backlog_form')
|
121
121
|
end
|
122
122
|
|
123
|
+
def simplify_name name
|
124
|
+
name
|
125
|
+
.strip
|
126
|
+
.tr('@', '')
|
127
|
+
end
|
128
|
+
|
123
129
|
Lita.register_handler self
|
124
130
|
end
|
125
131
|
end
|
data/lita-markov.gemspec
CHANGED
@@ -29,6 +29,15 @@ describe Lita::Handlers::Markov, lita_handler: true do
|
|
29
29
|
expect(possible_replies.any? { |r| reply.include?(r) }).to eql true
|
30
30
|
end
|
31
31
|
|
32
|
+
it 'will also accept @-names' do
|
33
|
+
send_message 'I like cookies.'
|
34
|
+
|
35
|
+
send_command "#{robot.name} markov @#{user.mention_name}"
|
36
|
+
|
37
|
+
expect(replies.count).to eql 1
|
38
|
+
expect(replies[0]).to include('I like cookies.')
|
39
|
+
end
|
40
|
+
|
32
41
|
it "will complain if the user hasn't said anything" do
|
33
42
|
send_command "#{robot.name} markov #{user.mention_name}"
|
34
43
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-markov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dirk Gadsden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.5.1
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Markov chains for Lita.
|