enerbot-slack 1.0.5 → 1.0.7
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/enerbot-slack.rb +2 -2
- data/lib/{credentials.rb → modules/credentials.rb} +1 -1
- data/lib/modules/slack_client.rb +2 -2
- data/lib/modules/slack_console.rb +1 -1
- data/lib/modules/slack_message.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9badb515811b91a7d22a7634c6ba933df55f08c716245bdbc5cb3142857b25f9
|
4
|
+
data.tar.gz: b3ec646e1d658a2073878c8eca9da1941ae1d898b12d4633bce1bea24618e558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 125a8fc6a94085edf5b7682f8270718871ed7aa99a12beb5a02b10c1dbefa738b6bdb701fc8a2cb339a9040815157643d81ded226a1a6589a90756d689113b33
|
7
|
+
data.tar.gz: 5a205c46cf2437ef49eeaa805d2cb159542e1d28aa964de61c71c63b7cfa8b1245c02644b5168f5fca6d92c27364e3d4733f98a25d3a7716d24be3355d2c3c7d
|
data/lib/enerbot-slack.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative 'modules/slack_message'
|
|
4
4
|
require_relative 'modules/slack_search'
|
5
5
|
require_relative 'modules/slack_image'
|
6
6
|
require_relative 'modules/slack_format'
|
7
|
-
require_relative 'credentials'
|
7
|
+
require_relative 'modules/credentials'
|
8
8
|
|
9
9
|
# Groups client initialization with instance parameters
|
10
10
|
class EnerbotSlack < Credentials
|
@@ -15,7 +15,7 @@ class EnerbotSlack < Credentials
|
|
15
15
|
include SlackSearch
|
16
16
|
|
17
17
|
def initialize(name: '', image: '', token: nil, as_user: false)
|
18
|
-
|
18
|
+
set_defaults
|
19
19
|
|
20
20
|
Slack.configure do |config|
|
21
21
|
config.token = token.nil? ? @bot_token : token
|
data/lib/modules/slack_client.rb
CHANGED
@@ -4,10 +4,10 @@ require 'slack-ruby-client'
|
|
4
4
|
|
5
5
|
# Client initialization that powers the rest of interactions
|
6
6
|
module SlackClient
|
7
|
-
def configure_client(type = 'web', token =
|
7
|
+
def configure_client(type = 'web', token = ENV['SLACK_TOKEN'])
|
8
8
|
Slack.configure do |config|
|
9
9
|
config.token = token
|
10
|
-
config.raise 'Missing Bot token' unless config.token
|
10
|
+
config.raise 'Missing Bot token 2' unless config.token
|
11
11
|
end
|
12
12
|
|
13
13
|
case type
|
@@ -26,8 +26,8 @@ module SlackMessage
|
|
26
26
|
destination_points(data, ts)
|
27
27
|
client.chat_postMessage channel: @channel,
|
28
28
|
text: text,
|
29
|
-
icon_url: ENV['
|
30
|
-
username: ENV['
|
29
|
+
icon_url: ENV['SLACK_ICON'],
|
30
|
+
username: ENV['SLACK_NAME'],
|
31
31
|
thread_ts: @thread,
|
32
32
|
as_user: false
|
33
33
|
rescue Slack::Web::Api::Errors::SlackError => e
|
@@ -45,8 +45,8 @@ module SlackMessage
|
|
45
45
|
destination_points(data, ts)
|
46
46
|
client.chat_postMessage channel: @channel,
|
47
47
|
attachments: attachment,
|
48
|
-
icon_url: ENV['
|
49
|
-
username: ENV['
|
48
|
+
icon_url: ENV['SLACK_ICON'],
|
49
|
+
username: ENV['SLACK_NAME'],
|
50
50
|
thread_ts: @thread,
|
51
51
|
as_user: false
|
52
52
|
rescue Slack::Web::Api::Errors::SlackError => e
|
@@ -60,8 +60,8 @@ module SlackMessage
|
|
60
60
|
client.chat_postEphemeral channel: @channel,
|
61
61
|
text: text,
|
62
62
|
user: user,
|
63
|
-
icon_url: ENV['
|
64
|
-
username: ENV['
|
63
|
+
icon_url: ENV['SLACK_ICON'],
|
64
|
+
username: ENV['SLACK_NAME'],
|
65
65
|
as_user: false
|
66
66
|
rescue Slack::Web::Api::Errors::SlackError => e
|
67
67
|
print e.message
|
@@ -81,8 +81,8 @@ module SlackMessage
|
|
81
81
|
client.reactions_add channel: channel,
|
82
82
|
name: icon,
|
83
83
|
timestamp: thread,
|
84
|
-
icon_url: ENV['
|
85
|
-
username: ENV['
|
84
|
+
icon_url: ENV['SLACK_ICON'],
|
85
|
+
username: ENV['SLACK_NAME'],
|
86
86
|
as_user: false
|
87
87
|
rescue Slack::Web::Api::Errors::SlackError => e
|
88
88
|
print e.message
|
@@ -94,8 +94,8 @@ module SlackMessage
|
|
94
94
|
client = configure_client
|
95
95
|
destination_points(data, ts)
|
96
96
|
client.files_upload channels: @channel,
|
97
|
-
icon_url: ENV['
|
98
|
-
username: ENV['
|
97
|
+
icon_url: ENV['SLACK_ICON'],
|
98
|
+
username: ENV['SLACK_NAME'],
|
99
99
|
thread_ts: @thread,
|
100
100
|
file: Faraday::UploadIO.new(file, 'text'),
|
101
101
|
title: File.basename(file),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enerbot-slack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luciano Adonis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-websocket
|
@@ -86,8 +86,8 @@ executables: []
|
|
86
86
|
extensions: []
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
|
-
- lib/credentials.rb
|
90
89
|
- lib/enerbot-slack.rb
|
90
|
+
- lib/modules/credentials.rb
|
91
91
|
- lib/modules/slack_admin.rb
|
92
92
|
- lib/modules/slack_client.rb
|
93
93
|
- lib/modules/slack_console.rb
|