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 +4 -4
- data/README.md +36 -4
- data/lib/lita/handlers/quote.rb +2 -2
- data/lita-quote.gemspec +1 -1
- 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: 54c00850248244df1aea3553cde8489441d1b09c
|
4
|
+
data.tar.gz: 1b3245e1737533291f5ce0c24c5819c7b6a6e5d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd2fe43d19aa5a94fe2719df4e506f656e42aa1a6389b57012bbb8cdff65634f368bd0be8ae8a213eb6425a3a38c109ccde0e03b756e0362dd0ace47e2c12c5e
|
7
|
+
data.tar.gz: e18b972b1405ac78e68e6ed995552d6e473ba8e0f5279f8ab2098f9d1c733bb5909bc44f3e81ec33f9e686305b0f1af7cfddcda69149fbdb28c2efa27ca2f811
|
data/README.md
CHANGED
@@ -1,22 +1,54 @@
|
|
1
1
|
# lita-quote
|
2
2
|
|
3
|
-
|
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
|
-
```
|
9
|
+
```ruby
|
10
10
|
gem "lita-quote"
|
11
11
|
```
|
12
12
|
|
13
13
|
## Configuration
|
14
14
|
|
15
|
-
|
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
|
-
|
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
|
|
data/lib/lita/handlers/quote.rb
CHANGED
@@ -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("
|
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
|
31
|
+
quote = quotes.sample
|
32
32
|
end
|
33
33
|
|
34
34
|
if quote
|
data/lita-quote.gemspec
CHANGED
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.
|
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-
|
11
|
+
date: 2014-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|