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.

28 lines
935 B

8 years ago
  1. # coding: utf-8
  2. module SlackMathbot
  3. module Commands
  4. class Pixiv < SlackRubyBot::Commands::Base
  5. match /pixiv\.net(?<url>.*)$/ do |client, _data, _match|
  6. #asdf
  7. puts _match[:url]
  8. #client.say(channel: _data.channel, text: "Testing: http://pixiv.net#{_match[:url]}")
  9. client.web_client.chat_postMessage(
  10. channel: _data.channel,
  11. as_user: true,
  12. attachments: [
  13. {
  14. fallback: "Ticket #1943: Can't rest my password - https://groove.hq/path/to/ticket/1943",
  15. title: "Ticket #1943: Can't reset my password",
  16. title_link: "http://www.pixiv.net" + _match[:url][1..-1],
  17. text: "Help! I tried to reset my password but nothing happened!",
  18. color: "#7CD197"
  19. }
  20. ].to_json
  21. )
  22. #send_message client, _data.channel, "Testing: #{_match[:url]}"
  23. end
  24. end
  25. end
  26. end