Browse Source

Changed test to echo. Might actually do a thing now

master
Daniel Muckerman 9 years ago
parent
commit
c50e0d44b8
3 changed files with 13 additions and 22 deletions
  1. +0
    -1
      slack-mathbot/commands/calculate.rb
  2. +13
    -0
      slack-mathbot/commands/echo.rb
  3. +0
    -21
      slack-mathbot/commands/test.rb

+ 0
- 1
slack-mathbot/commands/calculate.rb View File

@ -5,7 +5,6 @@ module SlackMathbot
command 'calculate'
def self.call(client, data, match)
send_message client, data.channel, match
result = Dentaku::Calculator.new.evaluate(match[:expression]) if match.names.include?('expression')
result = result.to_s if result
if result && result.length > 0

+ 13
- 0
slack-mathbot/commands/echo.rb View File

@ -0,0 +1,13 @@
module SlackMathbot
module Commands
class Echo < SlackRubyBot::Commands::Base
command 'echo'
def self.call(client, data, match)
send_message client, data.channel, match[:expression]
rescue StandardError => e
send_message client, data.channel, "Sorry, #{e.message}."
end
end
end
end

+ 0
- 21
slack-mathbot/commands/test.rb View File

@ -1,21 +0,0 @@
module SlackMathbot
module Commands
class Test < SlackRubyBot::Commands::Base
operator ']'
command 'test'
def self.call(client, data, match)
send_message client, data.channel, 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 client, data.channel, result
else
send_message client, data.channel, 'Got nothing.'
end
rescue StandardError => e
send_message client, data.channel, "Sorry, #{e.message}."
end
end
end
end

Loading…
Cancel
Save