lita-quote 0.0.1 → 0.0.2

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: 275240b0c3f33d865924686a35657049c22ac42d
4
- data.tar.gz: 4c71d91b20b7570ff29ad7c914ac42b3c7146a65
3
+ metadata.gz: 54c00850248244df1aea3553cde8489441d1b09c
4
+ data.tar.gz: 1b3245e1737533291f5ce0c24c5819c7b6a6e5d0
5
5
  SHA512:
6
- metadata.gz: 6dbcc2eb8c1b225eee982b29a87d2ded28bd3702f536ed0bcc8b871575304356c7aaf109d031de908b1a0b89b4f11ec20d8c567d6b74fd7ea02729238c10199c
7
- data.tar.gz: 107df58d184ff015b507ca9fd87269e819e169f7d5adbd0d573b671b43fcffe54d4552269769bc3b07d2da871d01162fb0ce7eaf22215ccd5f8b089c39fcbb68
6
+ metadata.gz: fd2fe43d19aa5a94fe2719df4e506f656e42aa1a6389b57012bbb8cdff65634f368bd0be8ae8a213eb6425a3a38c109ccde0e03b756e0362dd0ace47e2c12c5e
7
+ data.tar.gz: e18b972b1405ac78e68e6ed995552d6e473ba8e0f5279f8ab2098f9d1c733bb5909bc44f3e81ec33f9e686305b0f1af7cfddcda69149fbdb28c2efa27ca2f811
data/README.md CHANGED
@@ -1,22 +1,54 @@
1
1
  # lita-quote
2
2
 
3
- TODO: Add a description of the plugin.
3
+ **lita-quote** is a handler for [Lita](https://github.com/jimmycuadra/lita) to store and retrieve user quotes.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add lita-quote to your Lita instance's Gemfile:
8
8
 
9
- ``` ruby
9
+ ```ruby
10
10
  gem "lita-quote"
11
11
  ```
12
12
 
13
13
  ## Configuration
14
14
 
15
- TODO: Describe any configuration attributes the plugin exposes.
15
+ * `date_format` (String) - `strftime`-style date format to be appended to the quote. Optional, defaults to nil (no date appended).
16
+
17
+ ### Example
18
+
19
+ ```ruby
20
+ Lita.configure do |config|
21
+ config.handlers.quote.date_format = "[%Y-%m-%d]"
22
+ end
23
+ ```
16
24
 
17
25
  ## Usage
18
26
 
19
- TODO: Describe the plugin's features and how to use them.
27
+ ### Chat functions
28
+
29
+ Store a quote:
30
+ ```
31
+ Lita: qadd content of the quote
32
+ Added quote #42
33
+ ```
34
+
35
+ Get a random quote:
36
+ ```
37
+ Lita: qget
38
+ #36: a random quote [2014-03-21]
39
+ ```
40
+
41
+ Get a given quote:
42
+ ```
43
+ Lita: qget 42
44
+ #42: content of the quote [2014-03-22]
45
+ ```
46
+
47
+ Delete a quote:
48
+ ```
49
+ Lita: qdel 42
50
+ Deleted quote #42
51
+ ```
20
52
 
21
53
  ## License
22
54
 
@@ -20,7 +20,7 @@ module Lita
20
20
  message = "##{quote_id}: #{response.matches.flatten.first}"
21
21
  message += " #{Time.now.strftime(Lita.config.handlers.quote.date_format)}" if Lita.config.handlers.quote.date_format
22
22
  redis.hset("list", quote_id, message)
23
- response.reply("added quote ##{quote_id}")
23
+ response.reply("Added quote ##{quote_id}")
24
24
  end
25
25
 
26
26
  def get_quote(response)
@@ -28,7 +28,7 @@ module Lita
28
28
  quote = redis.hget("list", quote_id.to_i)
29
29
  else
30
30
  quotes = redis.hvals("list")
31
- quote = quotes[rand(quotes.length)]
31
+ quote = quotes.sample
32
32
  end
33
33
 
34
34
  if quote
data/lita-quote.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-quote"
3
- spec.version = "0.0.1"
3
+ spec.version = "0.0.2"
4
4
  spec.authors = ["Jonathan Amiez"]
5
5
  spec.email = ["jonathan.amiez@gmail.com"]
6
6
  spec.description = "Quote handler for Lita"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Amiez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita