├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE.md ├── Procfile ├── README ├── typing.rb └── will_typing.mov /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | gem 'slack-ruby-client' 6 | 7 | gem 'celluloid-io', require: ['celluloid/current', 'celluloid/io'] 8 | 9 | gem 'dotenv' 10 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | activesupport (5.2.0) 5 | concurrent-ruby (~> 1.0, >= 1.0.2) 6 | i18n (>= 0.7, < 2) 7 | minitest (~> 5.1) 8 | tzinfo (~> 1.1) 9 | celluloid (0.17.3) 10 | celluloid-essentials 11 | celluloid-extras 12 | celluloid-fsm 13 | celluloid-pool 14 | celluloid-supervision 15 | timers (>= 4.1.1) 16 | celluloid-essentials (0.20.5) 17 | timers (>= 4.1.1) 18 | celluloid-extras (0.20.5) 19 | timers (>= 4.1.1) 20 | celluloid-fsm (0.20.5) 21 | timers (>= 4.1.1) 22 | celluloid-io (0.17.3) 23 | celluloid (>= 0.17.2) 24 | nio4r (>= 1.1) 25 | timers (>= 4.1.1) 26 | celluloid-pool (0.20.5) 27 | timers (>= 4.1.1) 28 | celluloid-supervision (0.20.6) 29 | timers (>= 4.1.1) 30 | concurrent-ruby (1.0.5) 31 | dotenv (2.4.0) 32 | faraday (0.15.0) 33 | multipart-post (>= 1.2, < 3) 34 | faraday_middleware (0.12.2) 35 | faraday (>= 0.7.4, < 1.0) 36 | gli (2.17.1) 37 | hashie (3.5.7) 38 | hitimes (1.2.6) 39 | i18n (1.0.1) 40 | concurrent-ruby (~> 1.0) 41 | minitest (5.11.3) 42 | multipart-post (2.0.0) 43 | nio4r (2.3.0) 44 | slack-ruby-client (0.11.1) 45 | activesupport 46 | faraday (>= 0.9) 47 | faraday_middleware 48 | gli 49 | hashie 50 | websocket-driver 51 | thread_safe (0.3.6) 52 | timers (4.1.2) 53 | hitimes 54 | tzinfo (1.2.5) 55 | thread_safe (~> 0.1) 56 | websocket-driver (0.7.0) 57 | websocket-extensions (>= 0.1.0) 58 | websocket-extensions (0.1.3) 59 | 60 | PLATFORMS 61 | ruby 62 | 63 | DEPENDENCIES 64 | celluloid-io 65 | dotenv 66 | slack-ruby-client 67 | 68 | BUNDLED WITH 69 | 1.16.1 70 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # most of typing.rb is from an example in the slack-ruby gem, so including their license: 2 | MIT License 3 | 4 | Copyright (c) 2015-2016 Daniel Doubrovkine, Artsy and Contributors 5 | Copyright (c) 2018 Will Leinweber 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: bundle exec ruby typing.rb 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | A very good program that makes it so it says i'm typing when anyone else is typing 2 | 3 | https://twitter.com/leinweber/status/989267343002951680 4 | -------------------------------------------------------------------------------- /typing.rb: -------------------------------------------------------------------------------- 1 | require 'dotenv/load' 2 | require 'slack-ruby-client' 3 | 4 | raise 'Missing ENV[SLACK_API_TOKENS]!' unless ENV.key?('SLACK_API_TOKENS') 5 | 6 | $stdout.sync = true 7 | logger = Logger.new($stdout) 8 | logger.level = Logger::DEBUG 9 | 10 | threads = [] 11 | 12 | ENV['SLACK_API_TOKENS'].split.each do |token| 13 | logger.info "Starting #{token[0..12]} ..." 14 | 15 | client = Slack::RealTime::Client.new(token: token) 16 | 17 | client.on :hello do 18 | logger.info "Successfully connected, welcome '#{client.self.name}' to the '#{client.team.name}' team at https://#{client.team.domain}.slack.com." 19 | end 20 | 21 | client.on(:user_typing) do |data| 22 | logger.info data 23 | client.typing channel: data.channel 24 | #client.message channel: data.channel, text: "What are you typing <@#{data.user}>?" 25 | end 26 | 27 | threads << client.start_async 28 | end 29 | 30 | threads.each(&:join) 31 | -------------------------------------------------------------------------------- /will_typing.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/will/slacktyping/6240c1ccb5e72c23eb47f585cb67318be8ba1135/will_typing.mov --------------------------------------------------------------------------------