lita-isolita 0.1.4 → 0.1.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 +4 -4
- data/lib/lita/handlers/isolita.rb +18 -6
- data/lita-isolita.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c2e268b9a1c9f8caf0107ac463cd69cefb330b
|
4
|
+
data.tar.gz: 688ade5c7f33a5952763bc9117f19afdba9da8b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a442b5cdf3837fe5938a484ad77241be2aad9074aa779a64ba2552ae0df54e0f2b8a67c97ec5c6dd92ed06af171dcef22c1d8e41eadeed600d821143d4d63765
|
7
|
+
data.tar.gz: 409b9df9396e9ee61e7c9d776c92dfbe396a03bf85cda9f4ee009d9ec25eef7b80759a6cfb8fa2df0d2b4edf32fa95923d2da81ff1e6340270bc7426b5436853
|
@@ -1,14 +1,24 @@
|
|
1
1
|
module Lita
|
2
2
|
module Handlers
|
3
3
|
class Isolita < Handler
|
4
|
-
route(/^(fuck).*/i, :mind_your_manners, help: {
|
5
|
-
"Fuck you" => "Advises to clean up your language."
|
6
|
-
})
|
7
4
|
|
8
|
-
|
5
|
+
## Get the username for who's talking to Lita.
|
6
|
+
def get_reply_to_name(response)
|
9
7
|
reply_to_name = response.user.metadata['mention_name'].nil? ?
|
10
8
|
"#{response.user.name}" :
|
11
9
|
"#{response.user.metadata['mention_name']}"
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
## Mind your manners will just focus on "Fuck"
|
14
|
+
## for now until others become a problem.
|
15
|
+
route(/fuck/i, :mind_your_manners, help: {
|
16
|
+
"lita: fuck you" => "Advises to clean up your language after saying `fuck`"
|
17
|
+
})
|
18
|
+
|
19
|
+
def mind_your_manners(response)
|
20
|
+
get_reply_to_name(response)
|
21
|
+
|
12
22
|
mind_manners = [
|
13
23
|
"Mind your manners #{reply_to_name}..",
|
14
24
|
"You better wash out that dirty mouth #{reply_to_name}!",
|
@@ -22,12 +32,14 @@ module Lita
|
|
22
32
|
response.reply mind_manners.sample
|
23
33
|
end
|
24
34
|
|
35
|
+
|
36
|
+
|
25
37
|
route(/^(show response json).*/i, :print_reply, help: {
|
26
|
-
"show response json" => "Prints out
|
38
|
+
"show response json" => "Prints out Lita's response"
|
27
39
|
})
|
28
40
|
|
29
41
|
def print_reply(response)
|
30
|
-
response.reply_privately response
|
42
|
+
response.reply_privately "#{response.user}"
|
31
43
|
end
|
32
44
|
|
33
45
|
end
|
data/lita-isolita.gemspec
CHANGED