Skip to content

Instantly share code, notes, and snippets.

@panchiga
Created October 28, 2016 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panchiga/cc48ee3542c3f70c3df34656875150e8 to your computer and use it in GitHub Desktop.
Save panchiga/cc48ee3542c3f70c3df34656875150e8 to your computer and use it in GitHub Desktop.
require 'slack-ruby-client'
TOKEN = ENV["SLACK_TOKEN"]
Slack.configure do |config|
config.token = TOKEN
end
client = Slack::RealTime::Client.new
client.on :hello do
puts '...'
end
client.on :message do |data|
if !data['text'][/しよう(。|\.)*/].nil?
client.message channel: data['channel'], text: 'フンス!'
else
client.message channel: data['channel'], text:'...'
end
end
client.start!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment