diff --git a/Gemfile b/Gemfile index 111ca1d..b23b6b9 100644 --- a/Gemfile +++ b/Gemfile @@ -32,6 +32,9 @@ gem 'sdoc', '~> 0.4.0', group: :doc # Use Capistrano for deployment # gem 'capistrano-rails', group: :development +# Slack Bot +gem 'slack-ruby-bot' + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' diff --git a/Gemfile.lock b/Gemfile.lock index 57d1e85..05605b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + addressable (2.3.8) arel (6.0.3) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) @@ -51,9 +52,27 @@ GEM debug_inspector (0.0.2) diff-lcs (1.2.5) erubis (2.7.0) + eventmachine (1.0.8) execjs (2.6.0) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.9.2) + faraday (>= 0.7.4, < 0.10) + faraday_middleware-parse_oj (0.3.0) + faraday (~> 0.9.0) + faraday_middleware (~> 0.9.1) + oj (~> 2.0) + faye-websocket (0.10.1) + eventmachine (>= 0.12.0) + websocket-driver (>= 0.5.1) + giphy (2.0.2) + faraday (~> 0.9) + faraday_middleware (~> 0.9) + faraday_middleware-parse_oj (~> 0.3) + launchy (~> 2.4) globalid (0.3.6) activesupport (>= 4.1.0) + hashie (3.4.3) i18n (0.7.0) jbuilder (2.3.2) activesupport (>= 3.0.0, < 5) @@ -63,6 +82,8 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.3) + launchy (2.4.3) + addressable (~> 2.3) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.3) @@ -71,8 +92,10 @@ GEM mini_portile (0.6.2) minitest (5.8.3) multi_json (1.11.2) + multipart-post (2.0.0) nokogiri (1.6.6.4) mini_portile (~> 0.6.0) + oj (2.13.1) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -129,6 +152,18 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + slack-ruby-bot (0.4.5) + activesupport + giphy (~> 2.0.2) + hashie + slack-ruby-client + websocket-driver (~> 0.5.4) + slack-ruby-client (0.4.0) + eventmachine + faraday + faraday_middleware + faye-websocket + json spring (1.4.4) sprockets (3.4.1) rack (> 1, < 3) @@ -152,6 +187,9 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) + websocket-driver (0.5.4) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS ruby @@ -165,6 +203,7 @@ DEPENDENCIES rspec-rails sass-rails (~> 5.0) sdoc (~> 0.4.0) + slack-ruby-bot spring sqlite3 turbolinks diff --git a/bot/say.rb b/bot/say.rb new file mode 100644 index 0000000..c423eab --- /dev/null +++ b/bot/say.rb @@ -0,0 +1,5 @@ +class Say < SlackRubyBot::Commands::Base + command 'say' do |client, data, match| + send_message client, data.channel, match['expression'] + end +end diff --git a/bot/tattletale.rb b/bot/tattletale.rb new file mode 100644 index 0000000..5d04fda --- /dev/null +++ b/bot/tattletale.rb @@ -0,0 +1,8 @@ +$:.unshift File.dirname(__FILE__) +require 'say' + +Thread.abort_on_exception = true + +Thread.new do + SlackRubyBot::App.instance.run +end diff --git a/config/initializers/bot.rb b/config/initializers/bot.rb new file mode 100644 index 0000000..bc59ed4 --- /dev/null +++ b/config/initializers/bot.rb @@ -0,0 +1 @@ +require File.join(Rails.root, 'bot/tattletale')