enerbot-slack 1.0.0 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c64e1086ccdfa0448057636b7108f5590521e0e54788cc4cea10b1645d96f1f4
4
- data.tar.gz: b03f92947d891aee5a5d99005677c47e0ea667281eb4fbeb5ebd498950f26bd3
3
+ metadata.gz: a8e768b87ed5b6b43965e79861fe36f3788b15c821ea3702f321ef8d96f42f11
4
+ data.tar.gz: c534f61919b7e639c5cea2fcc20712511be1831324e413315a54f49c6e62e18d
5
5
  SHA512:
6
- metadata.gz: bf03f4ea93b1ea77466e3e5e2a306fb91477cb512d4d728d396fa55bf09b1dff458711eee2664ea6000e566b01c5b9d8b6c60438cd26b6762e8203be4df39252
7
- data.tar.gz: 661324fa53960dd5609b38290a49e27d63e41908f619ba7cf3434ba95c824ef99c86bfc40fa77e29385bf2635dae43d042a841a228a880014ece14a7ff5ff783
6
+ metadata.gz: 9f52f04346896bcc63318418c4969283af6cfe0ac9359969020889dc831aa27ebfd4403b3196f6e6930faf37c9bd4aa5f77949c34cdf5e12991875083c01f4c3
7
+ data.tar.gz: 3c877c16c250f52d412eb97dcd175c89231f13bc297e9dea0daffbd27a8d2ff87c9f1054846cc381ed3fd4e7dd1dfc5c72bfb4b21cbe6ad66501df2a328f3161
@@ -7,6 +7,7 @@ require_relative 'credentials'
7
7
 
8
8
  # Groups client initialization with instance parameters
9
9
  class EnerbotSlack < Credentials
10
+ include SlackRealTime
10
11
  include SlackMessage
11
12
  include SlackImage
12
13
  include SlackFormat
@@ -0,0 +1,25 @@
1
+ require 'colorize'
2
+ require_relative 'slack_search'
3
+
4
+ # Module to read data from Slack and show it on console
5
+ module ConsoleSlack
6
+ include SlackSearch
7
+
8
+ def format_new_message(data)
9
+ user_p = if data.subtype == 'bot_message'
10
+ data.username
11
+ else
12
+ user = get_user_info(data.user)
13
+ user.real_name
14
+ end
15
+ text = data.text
16
+ channel_p = conversation_info(data.channel)
17
+ if @current_channel == channel_p.id
18
+ print "\n#{user_p}: ".yellow + text.blue
19
+ else
20
+ print "\n--- #{channel_p.name} ---".green
21
+ print "\n#{user_p}: ".yellow + text.blue
22
+ end
23
+ @current_channel = channel_p.id
24
+ end
25
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require './lib/slack_search'
3
+ require_relative 'slack_search'
4
4
 
5
5
  # Obtains data of user from Slack and then uses them to mimic looks.
6
6
  module SlackImage
@@ -0,0 +1,28 @@
1
+ require_relative 'slack_message'
2
+ require_relative 'slack_console'
3
+ require './actions/modes'
4
+
5
+ # Module for reading chat incoming messages
6
+ module SlackRealTime
7
+ include SlackConsole
8
+ include DirectiveLookup
9
+
10
+ def share_message(data, output)
11
+ case output
12
+ when 'slack'
13
+ check_type(data)
14
+ when 'console'
15
+ format_new_message(data)
16
+ else
17
+ format_new_message(data)
18
+ check_type(data)
19
+ end
20
+ end
21
+
22
+ def single_client(output = ENV['SLACK_DEFAULT_OUTPUT'])
23
+ @time_client.on :message do |data|
24
+ share_message(data, output)
25
+ end
26
+ @time_client.start!
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enerbot-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Adonis
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: async-websocket
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bson_ext
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -59,12 +87,14 @@ extensions: []
59
87
  extra_rdoc_files: []
60
88
  files:
61
89
  - lib/credentials.rb
62
- - lib/enerbot_slack.rb
90
+ - lib/enerbot-slack.rb
63
91
  - lib/modules/slack_admin.rb
64
92
  - lib/modules/slack_client.rb
93
+ - lib/modules/slack_console.rb
65
94
  - lib/modules/slack_format.rb
66
95
  - lib/modules/slack_image.rb
67
96
  - lib/modules/slack_message.rb
97
+ - lib/modules/slack_realtime.rb
68
98
  - lib/modules/slack_search.rb
69
99
  homepage: https://rubygems.org/gems/core_slack
70
100
  licenses: