A Slack Bot that pulls Pixiv information and posts the full image(s) into Slack, with iOS shortcuts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
557 B

  1. module SlackMathbot
  2. module Commands
  3. class Calculate < SlackRubyBot::Commands::Base
  4. def self.call(data, _command, arguments)
  5. result = Dentaku::Calculator.new.evaluate(arguments.join)
  6. result = result.to_s if result
  7. if result && result.length > 0
  8. send_message data.channel, result
  9. else
  10. send_message_with_gif data.channel, 'Got nothing.', 'nothing'
  11. end
  12. rescue StandardError => e
  13. send_message_with_gif data.channel, "Sorry, #{e.message}.", 'idiot'
  14. end
  15. end
  16. end
  17. end