Sha256: 8b57ddb59192a7e4814b2c9804ebaa9b6ad14f6329c31eabc4ed65b237f35844
Contents?: true
Size: 584 Bytes
Versions: 1
Compression:
Stored size: 584 Bytes
Contents
require 'slack-ruby-client' Slack.configure do |config| config.token = ENV['SLACK_API_TOKEN'] fail 'Missing ENV[SLACK_API_TOKEN]!' unless config.token end client = Slack::RealTime::Client.new client.on :hello do puts 'Successfully connected.' end client.on :message do |data| puts data case data['text'] when 'bot hi' then client.web_client.chat_postMessage channel: data['channel'], text: "Hi <@#{data['user']}>!" when /^bot/ then client.web_client.chat_postMessage channel: data['channel'], text: "Sorry <@#{data['user']}>, what?" end end client.start!
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slack-ruby-client-0.1.0 | examples/hi_real_time_and_web/hi.rb |