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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbf7aed643189ede40b31e8d9c16ac1640371ed7
4
- data.tar.gz: 7d57eadbc324c28c5887b6b7180fe99919051ac7
3
+ metadata.gz: 81ef40b71792290867abcab42ba5084916de22e4
4
+ data.tar.gz: df3c14436f0a6a853db6440ace88f5874ddaf62d
5
5
  SHA512:
6
- metadata.gz: 9775fc10de2164232bc389b44d95d5a7fb0a0e51b70781a382a934f02bc80bf04eac6774a7771edd93a3548d37d80f9b0502e9bbd6f200c996fd93f329b436c8
7
- data.tar.gz: 563215674afaf190dac06aafbbf63f4d8208880884d0f5dd0cea867e17d48b984840d2447f0197132c46430ec26359c8ed84be7a83ac3eeb8549f920d58c903e
6
+ metadata.gz: 6b1c70d92216f4e7ed5b533558e0ce48e92b9ffe69e87edc5893cf232f924e3dfddd6ccdaa2b528d34ada442ac1ec24afd4460d3225382d1a1db0f0cdbb6d660
7
+ data.tar.gz: 04e36c2f969b65b745bc969748114cf15243a714f1753ebf955e39507c326a28d4f18743b8d977f96a2a1cadae242d9413d4c92b3424658508f73f1e66bb1025
@@ -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].strip
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-markov"
3
- spec.version = "1.2.0"
3
+ spec.version = "1.2.1"
4
4
  spec.authors = ["Dirk Gadsden"]
5
5
  spec.email = ["dirk@dirk.to"]
6
6
  spec.description = "Markov chains for Lita."
@@ -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.0
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: 2015-11-25 00:00:00.000000000 Z
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.4.5.1
195
+ rubygems_version: 2.5.1
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Markov chains for Lita.