baez_slack 0.0.5 → 0.0.6
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/modules/regex_slack.rb +25 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23b6d454e756aacf20d13590ce87c40bfcae3037d841f715140e3c7915bd6387
|
4
|
+
data.tar.gz: ad492a31a9d5e31d12a4e10c3c641a2e1411853c6b82d0d340ef0a962c327282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62397ffb5de0dc05070fe572b9e78d347689fa05709d4eaeaedc6a3dd8b99850b3a0443b34ac97fb4e0e6b3e29264990d0acdc02d9ae31b51822f5f22037c4e4
|
7
|
+
data.tar.gz: 4503e15d7b5e2e582ff08bf6d25434765b0852d2781605960c9dbf295551a0e2c89770413a0719072c56943d43e6b72c011073e0c081675a7b46d5b4dc4a405d
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Module for regular expressions that are common
|
2
|
+
module RegexpSlack
|
3
|
+
def get_values_from(text, type = 'user')
|
4
|
+
pattern = case type
|
5
|
+
when 'user'
|
6
|
+
/<@(.*)>/
|
7
|
+
when 'channel'
|
8
|
+
/<#(.*)\|(.*)>/
|
9
|
+
end
|
10
|
+
text.match(pattern)
|
11
|
+
end
|
12
|
+
|
13
|
+
def echo(data, _pattern = '\echo')
|
14
|
+
match = data.match(/^\\echo\s(\<[#@])?((.*)\|)?(.*?)(\>)? (.*?)$/i)
|
15
|
+
unless match.nil?
|
16
|
+
channel = match.captures[2] || match.captures[3]
|
17
|
+
text = match.captures[5]
|
18
|
+
check_ts = channel.match(/(.*)-(\d*\.\d*)/)
|
19
|
+
# Useless... until someone find something
|
20
|
+
channel = check_ts.captures[0] unless check_ts.nil?
|
21
|
+
thread = check_ts.captures[1] unless check_ts.nil?
|
22
|
+
end
|
23
|
+
[text, channel, thread]
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baez_slack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luciano Adonis
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/modules/console_slack.rb
|
65
65
|
- lib/modules/message_slack.rb
|
66
66
|
- lib/modules/read_slack.rb
|
67
|
+
- lib/modules/regex_slack.rb
|
67
68
|
- lib/modules/search_slack.rb
|
68
69
|
homepage: https://rubygems.org/gems/core_slack
|
69
70
|
licenses:
|