Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cafe930
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
gem 'slack-ruby-client' | ||
|
||
gem 'celluloid-io', require: ['celluloid/current', 'celluloid/io'] | ||
|
||
gem 'dotenv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
activesupport (5.2.0) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (>= 0.7, < 2) | ||
minitest (~> 5.1) | ||
tzinfo (~> 1.1) | ||
celluloid (0.17.3) | ||
celluloid-essentials | ||
celluloid-extras | ||
celluloid-fsm | ||
celluloid-pool | ||
celluloid-supervision | ||
timers (>= 4.1.1) | ||
celluloid-essentials (0.20.5) | ||
timers (>= 4.1.1) | ||
celluloid-extras (0.20.5) | ||
timers (>= 4.1.1) | ||
celluloid-fsm (0.20.5) | ||
timers (>= 4.1.1) | ||
celluloid-io (0.17.3) | ||
celluloid (>= 0.17.2) | ||
nio4r (>= 1.1) | ||
timers (>= 4.1.1) | ||
celluloid-pool (0.20.5) | ||
timers (>= 4.1.1) | ||
celluloid-supervision (0.20.6) | ||
timers (>= 4.1.1) | ||
concurrent-ruby (1.0.5) | ||
dotenv (2.4.0) | ||
faraday (0.15.0) | ||
multipart-post (>= 1.2, < 3) | ||
faraday_middleware (0.12.2) | ||
faraday (>= 0.7.4, < 1.0) | ||
gli (2.17.1) | ||
hashie (3.5.7) | ||
hitimes (1.2.6) | ||
i18n (1.0.1) | ||
concurrent-ruby (~> 1.0) | ||
minitest (5.11.3) | ||
multipart-post (2.0.0) | ||
nio4r (2.3.0) | ||
slack-ruby-client (0.11.1) | ||
activesupport | ||
faraday (>= 0.9) | ||
faraday_middleware | ||
gli | ||
hashie | ||
websocket-driver | ||
thread_safe (0.3.6) | ||
timers (4.1.2) | ||
hitimes | ||
tzinfo (1.2.5) | ||
thread_safe (~> 0.1) | ||
websocket-driver (0.7.0) | ||
websocket-extensions (>= 0.1.0) | ||
websocket-extensions (0.1.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
celluloid-io | ||
dotenv | ||
slack-ruby-client | ||
|
||
BUNDLED WITH | ||
1.16.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
worker: bundle exec ruby typing.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'dotenv/load' | ||
require 'slack-ruby-client' | ||
|
||
raise 'Missing ENV[SLACK_API_TOKENS]!' unless ENV.key?('SLACK_API_TOKENS') | ||
|
||
$stdout.sync = true | ||
logger = Logger.new($stdout) | ||
logger.level = Logger::DEBUG | ||
|
||
ENV['SLACK_API_TOKENS'].split.each do |token| | ||
logger.info "Starting #{token[0..12]} ..." | ||
|
||
client = Slack::RealTime::Client.new(token: token) | ||
|
||
client.on :hello do | ||
logger.info "Successfully connected, welcome '#{client.self.name}' to the '#{client.team.name}' team at https://#{client.team.domain}.slack.com." | ||
end | ||
|
||
client.on(:user_typing) do |data| | ||
logger.info data | ||
client.typing channel: data.channel | ||
#client.message channel: data.channel, text: "What are you typing <@#{data.user}>?" | ||
end | ||
|
||
client.start_async | ||
end | ||
|
||
loop do | ||
Thread.pass | ||
end |
cafe930
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cafe :D