Browse Source

Upgraded to slack-ruby-bot 0.3.0.

master
dB 9 years ago
parent
commit
240bf536fc
7 changed files with 18 additions and 11 deletions
  1. +5
    -1
      .rubocop_todo.yml
  2. +1
    -1
      .travis.yml
  3. +2
    -2
      Gemfile
  4. +3
    -3
      Gemfile.lock
  5. +3
    -1
      slack-mathbot/commands/about.rb
  6. +3
    -2
      slack-mathbot/commands/calculate.rb
  7. +1
    -1
      slack-mathbot/commands/help.rb

+ 5
- 1
.rubocop_todo.yml View File

@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-07-09 16:07:58 -0400 using RuboCop version 0.31.0.
# on 2015-07-19 14:05:31 -0400 using RuboCop version 0.31.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@ -9,6 +9,10 @@
Lint/RescueException:
Enabled: false
# Offense count: 1
Metrics/AbcSize:
Max: 17
# Offense count: 11
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:

+ 1
- 1
.travis.yml View File

@ -1,3 +1,3 @@
rvm:
- 2.1.6
- 2.2.0

+ 2
- 2
Gemfile View File

@ -1,8 +1,8 @@
source 'http://rubygems.org'
ruby '2.1.6'
ruby '2.2.0'
gem 'slack-ruby-bot', '~> 0.2.0'
gem 'slack-ruby-bot', '~> 0.3.0'
gem 'puma'
gem 'sinatra'
gem 'dentaku'

+ 3
- 3
Gemfile.lock View File

@ -42,7 +42,7 @@ GEM
minitest (5.7.0)
multi_json (1.11.2)
multipart-post (2.0.0)
oj (2.12.9)
oj (2.12.10)
parser (2.3.0.pre.2)
ast (>= 1.1, < 3.0)
powerpack (0.1.1)
@ -85,7 +85,7 @@ GEM
faraday_middleware (~> 0.8)
faye-websocket (~> 0.9.2)
multi_json (~> 1.0, >= 1.0.3)
slack-ruby-bot (0.2.0)
slack-ruby-bot (0.3.0)
activesupport
giphy (~> 2.0.2)
hashie
@ -116,6 +116,6 @@ DEPENDENCIES
rspec
rubocop (= 0.31.0)
sinatra
slack-ruby-bot (~> 0.2.0)
slack-ruby-bot (~> 0.3.0)
vcr
webmock

+ 3
- 1
slack-mathbot/commands/about.rb View File

@ -1,7 +1,9 @@
module SlackMathbot
module Commands
class Default < SlackRubyBot::Commands::Base
def self.call(data, _command, _arguments)
match(/^(?<bot>\w*)$/)
def self.call(data, _match)
send_message_with_gif data.channel, SlackMathbot::ABOUT, 'math'
end
end

+ 3
- 2
slack-mathbot/commands/calculate.rb View File

@ -2,9 +2,10 @@ module SlackMathbot
module Commands
class Calculate < SlackRubyBot::Commands::Base
operator '='
command 'calculate'
def self.call(data, _command, arguments)
result = Dentaku::Calculator.new.evaluate(arguments.join)
def self.call(data, match)
result = Dentaku::Calculator.new.evaluate(match[:expression]) if match.names.include?('expression')
result = result.to_s if result
if result && result.length > 0
send_message data.channel, result

+ 1
- 1
slack-mathbot/commands/help.rb View File

@ -1,7 +1,7 @@
module SlackMathbot
module Commands
class Help < SlackRubyBot::Commands::Base
def self.call(data, _command, _arguments)
def self.call(data, _match)
send_message_with_gif data.channel, 'See https://github.com/dblock/slack-mathbot, please.', 'help'
end
end

Loading…
Cancel
Save