Sha256: 95e77b47969945e8433c958def54af938f44ffe8d942ebc9d6a194e40f5fd7f7
Contents?: true
Size: 678 Bytes
Versions: 10
Compression:
Stored size: 678 Bytes
Contents
require 'slack-ruby-client' Slack.configure do |config| config.token = ENV['SLACK_API_TOKEN'] raise 'Missing ENV[SLACK_API_TOKEN]!' unless config.token end client = Slack::RealTime::Client.new client.on :hello do puts "Successfully connected, welcome '#{client.self.name}' to the '#{client.team.name}' team at https://#{client.team.domain}.slack.com." 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
10 entries across 10 versions & 1 rubygems