Skip to content

Instantly share code, notes, and snippets.

@zipkid

zipkid/slack.rb Secret

Created January 21, 2015 07:51
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 zipkid/22be5ae8edb003f3c5c2 to your computer and use it in GitHub Desktop.
Save zipkid/22be5ae8edb003f3c5c2 to your computer and use it in GitHub Desktop.
#!/bin/env ruby
# encoding: utf-8
require 'slack-rtmapi'
require 'pp'
token = '<token>'
channel = '<channel_id>`'
slack_rtm = SlackRTM.new(token: token)
slack_rtm.start_rtm
Thread.new do
loop do
sleep_time = 5
puts Time.new.inspect
slack_rtm.client.send(type: 'message', channel: channel, text: "It's #{Time.new.inspect}")
sleep sleep_time
end
end
slack_rtm.client.main_loop
assert false # never ending loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment