From 82ba015700e9ae2c09c36754611c78c369a28307 Mon Sep 17 00:00:00 2001 From: Daniel Muckerman Date: Fri, 9 Oct 2015 18:26:23 -0400 Subject: [PATCH] Maybe this time? --- slack-mathbot/commands.rb | 2 +- slack-mathbot/commands/echo.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 slack-mathbot/commands/echo.rb diff --git a/slack-mathbot/commands.rb b/slack-mathbot/commands.rb index d6975c4..73a2f68 100644 --- a/slack-mathbot/commands.rb +++ b/slack-mathbot/commands.rb @@ -1,4 +1,4 @@ require 'slack-mathbot/commands/calculate' +require 'slack-mathbot/commands/echo' require 'slack-mathbot/commands/about' require 'slack-mathbot/commands/help' -require 'slack-mathbot/commands/echo' diff --git a/slack-mathbot/commands/echo.rb b/slack-mathbot/commands/echo.rb new file mode 100644 index 0000000..acb4f77 --- /dev/null +++ b/slack-mathbot/commands/echo.rb @@ -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