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.
 

27 lines
642 B

module SlackMathbot
module Commands
class Base
def self.send_message(channel, text)
Slack.chat_postMessage(channel: channel, text: text)
end
def self.send_message_with_gif(channel, text, keywords)
gif = begin
Giphy.random(keywords)
rescue StandardError => e
logger.warn "Giphy.random: #{e.message}"
nil
end
text = text + "\n" + gif.image_url.to_s if gif
send_message channel, text
end
def self.logger
@logger ||= begin
$stdout.sync = true
Logger.new(STDOUT)
end
end
end
end
end