botkit 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 126b1d0a6961c78790abe15e3607474e0a2a61dc
4
- data.tar.gz: fa8e1d968e252a674df3ffad99a8b4c50c9f2077
3
+ metadata.gz: 795ad114beff6d289f8729b704aa0163873bda2f
4
+ data.tar.gz: a9113f03cb380b02d6e396f88270528fdf2fae1c
5
5
  SHA512:
6
- metadata.gz: c5f8cbbb4a6f76699393e2f247c117aa5c66a3f490f453d550e63d294c702df6d312cd2f79d21b28b4e55448c6c95646a85e6990082ff91b0be3c917be214d66
7
- data.tar.gz: af27da77e98237b8d1861b44b53c379e264f8ba061f74cfb139b12715dfe56b3d16830cca631fcc6d006839f00d848f9b2ad24592aa18d78364aa4fc9d388aeb
6
+ metadata.gz: 507feb6318363e512386acf69ee66deb1748bec48a4b5cbdc91b917c0c1b8f54af5a9fbebc8daa5f0c20aaaf14d62928f01d26e9630d027ec79cef7c4d5b7601
7
+ data.tar.gz: 8c429fe82829f4af5260f74e157b014b9400f378d02ae4947a25a5ac440aae0416a30a1280f540c78d4668f4d7ebf45107131ff2bf517e143ba0b5cee726f0e0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- botkit (0.0.4)
4
+ botkit (0.0.5)
5
5
  aitch
6
6
  signal
7
7
 
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # Botkit
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/botkit`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Botkit is a framework for creating chatbots for different services.
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'botkit'
10
+ gem "botkit"
13
11
  ```
14
12
 
15
13
  And then execute:
@@ -22,7 +20,7 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ To be written.
26
24
 
27
25
  ## Development
28
26
 
@@ -32,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
30
 
33
31
  ## Contributing
34
32
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/botkit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/fnando/botkit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
34
 
37
35
  ## License
38
36
 
@@ -40,4 +38,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
38
 
41
39
  ## Code of Conduct
42
40
 
43
- Everyone interacting in the Botkit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/botkit/blob/master/CODE_OF_CONDUCT.md).
41
+ Everyone interacting in the Botkit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fnando/botkit/blob/master/CODE_OF_CONDUCT.md).
@@ -8,6 +8,10 @@ module Botkit
8
8
  # after the current loop.
9
9
  attr_writer :halt
10
10
 
11
+ def initialize
12
+ @halt = false
13
+ end
14
+
11
15
  # Detect if bot should halt himself from the loop.
12
16
  def halt?
13
17
  @halt
@@ -31,15 +35,13 @@ module Botkit
31
35
  end
32
36
  end
33
37
 
34
- def parse_message(input, matcher = nil)
38
+ def parse_message(input)
35
39
  input = input.to_s
36
40
  _, command, text = *input.match(%r{\A/([^ @]+)(?:@.*?bot)?(?:\s+(.*?))?\z}i)
37
- matches = text.to_s.match(matcher) if matcher
38
41
 
39
42
  {
40
43
  command: command,
41
- text: command ? text : input,
42
- matches: matches&.named_captures
44
+ text: command ? text : input
43
45
  }
44
46
  end
45
47
 
@@ -2,15 +2,15 @@
2
2
 
3
3
  module Botkit
4
4
  class Message
5
- attr_reader :text, :command, :matches, :raw, :options, :channel_id
5
+ attr_reader :text, :command, :raw, :options, :channel_id, :id
6
6
 
7
- def initialize(text:, raw: {}, channel_id: nil, command: nil, matches: nil, options: {})
7
+ def initialize(text:, raw: {}, channel_id: nil, command: nil, options: {}, id: nil)
8
8
  @text = text
9
9
  @command = command
10
10
  @raw = raw
11
11
  @channel_id = channel_id
12
12
  @options = options
13
- @matches = matches
13
+ @id = id
14
14
  end
15
15
 
16
16
  def command?
@@ -11,13 +11,13 @@ module Botkit
11
11
 
12
12
  def call
13
13
  loop do
14
- next_tick
14
+ tick
15
15
  break if bot.halt?
16
16
  sleep(polling)
17
17
  end
18
18
  end
19
19
 
20
- private def next_tick
20
+ private def tick
21
21
  bot.call
22
22
  rescue StandardError => exception
23
23
  bot.report_exception(exception)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Botkit
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: botkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-12 00:00:00.000000000 Z
11
+ date: 2017-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aitch